This is the Debug Messsage and I would like to add the 2663.03774 and 3205.9554799999996 and show the value in a gauge
3/8/2023, 11:10:04 AMnode: Total DC Watts
sbfspot/2130438358 : msg.payload : Object
object
sbfspot/2130438237: 2663.03774
sbfspot/2130438358: 3205.9554799999996
This is what I tried but it does not work: Get a NaN message
3/8/2023, 11:45:03 AM[node: Total DC Watts](http://192.168.1.110:1880/#)sbfspot/2130438358 : msg.payload : number
NaN
This is my edit node
msg.payload = (msg.payload.sbfspot / 2130438237) + (msg.payload.sbfspot / 2130438358);
return msg;
Colin
8 March 2023 10:12
2
Since the properties have special characters you need to use the square bracket notation to access them, otherwise javascript interprets the /
characters and divide symbols.
msg.payload = msg.payload["sbfspot/2130438237"] + msg.payload["sbfspot/2130438358"]
Edit, fixed the code, missing quotes.
Thank you very much @Colin ,
In the end this is what works.
msg.payload = msg.payload["sbfspot/2130438237"] + msg.payload["sbfspot/2130438358"];
Thank you very much for helping me.
1 Like
system
Closed
22 March 2023 12:46
4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.