Read sensor real to a virtual smart home

how i can send a real temperature to the temperature of virtual smart home termostat?
i sow that i create a inject node with : msg.payload.temperature number 30 it send this value on termosat temperature . so i think its possible but i dont know which function node i must write to do that .
Someone can help me ? tx

Your problem definition is not clear enough. What have you tried? Export and attach your flow.

image

temp is the sensor of plc maibe now read 27 c° , ciccio is the virtual smart home termostat where the temperature default is 0 . i need to transfer 27 c° into temperature of ciccio termostat

image


i need to send 28 to 35

OK trying to understand what you are asking for here

  1. You get an incoming temperature from a PLC device - this comes into Node Red
  2. You want to get this temperature message and then send it on to your smart thermostat ?

Based on the debug messages you have posted it looks like the thermostat expects the temperature to be in the msg.payload.temperature

Thererefore use a change node to take the msg.payload from the PLC and move it into msg.payload.temperature - no function node needed

Craig

Try msg.payload.temperature instead of msg.payload.value[0]


credo di non aver capito scusa ma sono alle prime armi
paolo non funziona

Can u show me how ?

[{"id":"f91f29146492ae46","type":"debug","z":"d2aef5a196a83414","name":"debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":780,"y":180,"wires":[]},{"id":"a875c905d420c989","type":"change","z":"d2aef5a196a83414","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.temperature","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":160,"wires":[["f91f29146492ae46"]]},{"id":"39d399e3d02d0518","type":"inject","z":"d2aef5a196a83414","name":"","props":[{"p":"payload.temperature","v":"27","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":210,"y":160,"wires":[["a875c905d420c989"]]}]

You need to watch the into videos to Node Red on youtube and read the basic doco

Craig

I think what @Paul-Reed was saying was.. try changing Line-1 of your original flow to...

var output = msg.payload.temperature;

grazie ora funziona ma non bisogna usare set ma bensi' MOVE .
Ancora infinite grazie per aiuto