I measure the yield of my solar panels and created a Telegram interface. However, there is one problem I'm not able to solve...
This is the situation. The incoming MQTT message contains the total yield and I want to report the daily yield. So what I did: I created a trigger every day at 1:00 AM to set "flow.daystart" to the current total yield. This works. Then, when a new message is coming in, I try to set flow.dailyyield to the expression "msg.payload.yield - flow.daystart". However, this does not work, the flow.dailyyield is empty. If I adapt the change node to set flow.dailyyield to a numerical value (or to msg.payload.yield), there is no problem in using the value in the telegram message.
I cannot find out what is the cause. It seems that the trivial JSONata expression is not working. Do you have a clue what can be the problem?
Indirecty, as I set flow.daystart to the converted yield value.(For every MQTT message that comes in, I store flow.yield via above expression, and at 1:00 AM I set flow.daystart to flow.yield.)
I asked as the data will not be written to flow if it does not exist. The other flow data you see may be previous data. Post the debug of the previous node please.
The flow value would only be removed if the msg.payload.svalue2 did not exisit in the payload. Is that debug output defiantly after the switch and before the change node.