mattdavis90 / node-red-contrib-tado-client

Tado web API client node for Node Red
MIT License
23 stars 16 forks source link

Correct way to set Temp from dashboard slider #22

Closed gmum4d closed 3 years ago

gmum4d commented 4 years ago

Hi, I'm a complete noob to node red so please bear with me...

What is the correct way to set the temp from a dashboard slider? I have a slider that has it's value populated from "getZoneState". when I adjust the slider, the msg.payload has the new value, How do I inject the new value into Tado? I have tried the "SetZoneOverlay" node but I don't know how to get the payload into the temperature field.

Any help is much appreciated

Brewj commented 4 years ago

Hi Gmum, I've not yet worked out how to dynamically set the temperature I have some 'preset' buttons that set a room or series of rooms to a specific temperature. B Screenshot 2020-04-30 at 13 50 57 y using a Set a zones's overlay call to set the specific temperature. One of these for every zone.

gmum4d commented 4 years ago

Thank you for the quick reply. I shall do the same until a dynamic alternative is available. to set it from a slider would be really great. Thanks again.

G

mattdavis90 commented 4 years ago

Hi @gmum4d Thanks for the question. If I have understood correctly I think you will need to add a function block between the slider input and the Tado node. The function block should take the msg.payload and translate it to msg.temperature. Something like;

msg.temperature = msg.payload;
return msg;
mattdavis90 commented 4 years ago

This flow may help

[{"id":"699c47a8.7b6aa8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"826c43c9.79cb","type":"ui_gauge","z":"699c47a8.7b6aa8","name":"","group":"68a73246.b09cac","order":1,"width":0,"height":0,"gtype":"gage","title":"gauge","label":"units","format":"{{value}}","min":0,"max":"25","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":810,"y":260,"wires":[]},{"id":"966b8cfb.a18f","type":"ui_slider","z":"699c47a8.7b6aa8","name":"","label":"slider","tooltip":"","group":"68a73246.b09cac","order":0,"width":0,"height":0,"passthru":true,"outs":"end","topic":"","min":0,"max":"25","step":1,"x":190,"y":260,"wires":[["e2ec395.78fabc8"]]},{"id":"92d4570e.144fd8","type":"tado","z":"699c47a8.7b6aa8","configName":"d1cf260f.0bb368","apiCall":"setZoneOverlay","homeId":"197607","deviceId":"","zoneId":"2","power":"on","temperature":"18","terminationType":"manual","terminationTimeout":900,"name":"","reportDate":"","presence":"HOME","geoTracking":true,"temperatureOffset":0,"windowDetection":true,"windowDetectionTimeout":900,"openWindowMode":true,"timetableId":"","x":490,"y":260,"wires":[["555df10f.f51c8"]]},{"id":"555df10f.f51c8","type":"function","z":"699c47a8.7b6aa8","name":"","func":"if (msg.topic == \"clearZoneOverlay\") {\n msg.payload = 0;\n} else {\n msg.payload = msg.temperature;\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":660,"y":260,"wires":[["826c43c9.79cb"]]},{"id":"e2ec395.78fabc8","type":"function","z":"699c47a8.7b6aa8","name":"","func":"msg.temperature = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":340,"y":260,"wires":[["92d4570e.144fd8"]]},{"id":"85bc7d32.8d5a8","type":"ui_button","z":"699c47a8.7b6aa8","name":"","group":"68a73246.b09cac","order":2,"width":0,"height":0,"passthru":false,"label":"Clear","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":190,"y":320,"wires":[["fc2db9ec.4bf058"]]},{"id":"fc2db9ec.4bf058","type":"tado","z":"699c47a8.7b6aa8","configName":"d1cf260f.0bb368","apiCall":"clearZoneOverlay","homeId":"197607","deviceId":"","zoneId":"2","power":"on","temperature":"18","terminationType":"manual","terminationTimeout":900,"name":"","reportDate":"","presence":"HOME","geoTracking":true,"temperatureOffset":0,"windowDetection":true,"windowDetectionTimeout":900,"openWindowMode":true,"timetableId":"","x":490,"y":320,"wires":[["555df10f.f51c8"]]},{"id":"68a73246.b09cac","type":"ui_group","z":"","name":"Default","tab":"846350bf.dccb4","order":1,"disp":true,"width":"6","collapse":false},{"id":"d1cf260f.0bb368","type":"tado-config","z":"","name":""},{"id":"846350bf.dccb4","type":"ui_tab","z":"","name":"Home","icon":"fa-home"}]