hjespers / node-red-contrib-nest

Node-Red module for Nest thermostats and smoke detectors
20 stars 15 forks source link

set-temperature node modifies msg.payload #15

Open LembErad opened 6 years ago

LembErad commented 6 years ago

Thanks for programming a nice node-red module!

I’ve got everything registered and it is sending data to my thermostat just fine, but only on the initial pass. Every 5 minutes I check the electricity price, if it’s < 2, then turn the AC super cold. If it’s > 2, leave the AC hot.

if (currentrate < 2) { msg.payload = {target_temperature_f:68}; } else { msg.payload = {target_temperature_f:82}; } This runs and a debug output shows this: 7/2/2018, 11:35:17 AM node: Before Nest Set Temp msg : Object object topic: “” payload: object target_temperature_f: 83 _msgid: “ac67c98.f99e838”

So far so good, this passes to the Nest-thermostat-temperature-node and the thermostat sets the temp…but only the first time. 5 minute loops run but whatever value goes into the Nest-thermostat-temperature-node, stays that way forever. Here is the debug output immediately after the Nest-thermostat-temperature-node: 7/2/2018, 11:35:18 AM node: After Nest Set Temp msg : Object object topic: “” payload: “{“target_temperature_f”:83}” _msgid: “529d603e.82c2e”

I was expecting the output from the Nest-node to be the same as the input from the Nest-node. The Nest-node appears to be changing something.

Am I setting msg.payload.target_temperature_f properly? It does work the first loop, so I thought the syntax I’m using in my above function was good…

image