windkh / node-red-contrib-shelly

Shelly control nodes for node red.
MIT License
33 stars 21 forks source link

Read out each external temperature #186

Open PowerZone21 opened 4 hours ago

PowerZone21 commented 4 hours ago

Hi,

I got two external temp sensors, and debug node show both, but how do I split these two in two different debug notes

Temp 1, from debug node: {"component":"temperature:100","name":"temperature","id":100,"now":1729947351.4536982,"info":{"component":"temperature:100","id":100,"event":"temperature_measurement","tC":24.8,"tF":76.6,"ts":1729947351.45}}

Temp 2, from debug node: {"component":"temperature:101","name":"temperature","id":101,"now":1729947531.460916,"info":{"component":"temperature:101","id":101,"event":"temperature_measurement","tC":24.2,"tF":75.7,"ts":1729947531.46}}

windkh commented 2 hours ago

@PowerZone21 I guess there should be a split node in the palette. I never used it but you should be able to distinguish between the two by simply evaluating the "id" property.

I prefer adding a function node. Configure it that it has two outputs. Then add some javascript code like if(msg.payload.id === "100") { node.send([msg, null]); }

if(msg.payload.id === "101") { node.send([null, msg]); }