Hi everyone,
I have a simple problem but unfortunately, I am even more so. I have a flow that I want to use to retrieve the set temperature of my climate system, and then set the new temperature of the furnace to 2 degrees less. I have already learned how to retrieve the 'set temperature' and placed it into the flow as "msg.payload".
var setTemp = msg.data.attributes.temperature-2;
msg.payload=setTemp;
return msg;
As you can see above, I have retrieved the set temperature of the climate control and I have subtracted 2 degrees C from this value and placed it into the msg.payload. This part works fine
Then, I know how to use a 'Call Service' node to set the temperature with data like {"temperature":22};
However, I do not know how to insert the msg.payload in place of the number (in this case 22)
Here is the complete flow. Just the last node 'Set Temp' is the problem.
[{"id":"94492e5d.e42928","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"e56ba6e.21bfad8","type":"debug","z":"94492e5d.e42928","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":610,"y":100,"wires":[]},{"id":"a79705ba.3185d8","type":"inject","z":"94492e5d.e42928","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":160,"wires":[["865e6bcc.52643"]]},{"id":"d257d30b.6fb71","type":"function","z":"94492e5d.e42928","name":"","func":"var setTemp = msg.data.attributes.temperature-2;\nmsg.payload=setTemp;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":320,"y":160,"wires":[["74bc2b60.be6bbc"]]},{"id":"865e6bcc.52643","type":"api-current-state","z":"94492e5d.e42928","name":"test","server":"1d707c49.07a204","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"climate.thermostat","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":110,"y":100,"wires":[["20092d4f.3f4682"]]},{"id":"20092d4f.3f4682","type":"switch","z":"94492e5d.e42928","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"heat","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":270,"y":100,"wires":[["d257d30b.6fb71"],[]]},{"id":"74bc2b60.be6bbc","type":"api-call-service","z":"94492e5d.e42928","name":"Set Temp","server":"fee4c7b2.b5e188","version":1,"debugenabled":false,"service_domain":"climate","service":"set_temperature","entityId":"climate.thermostat","data":"{\"temperature\":20}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":480,"y":120,"wires":[["e56ba6e.21bfad8"]]},{"id":"1d707c49.07a204","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"fee4c7b2.b5e188","type":"server","name":"Home Assistant","addon":true}]
Thanks
Sam