Writing a node-red sequence to increment the radiator setpoints

I have a series of danfoss z-wave radiator valves. Normally they are controlled using Schedy, but I want to add simple buttons to increment the setpoints up and down.

It’s no problem using climate.set_temperature to set the target temperature on the valve, but what I can’t figure out is how to create a json payload to increment it by 1 degree. What I want is to be able to do “setpoint = current setpoint + 1” but I can’t figure out to get the current setpoint in the node-red sequence.

Do I need to add a function node to retrieve the current setpoint and store it in a variable? If so, how? (I’m useless at json)

1 Like

The easiest way I can think of to solve this would be to throw a current-state node near the beginning of the flow and then use the value in a function node:. I have an ecobee, so the data structure might be different. You could do the calc in a function node, or you can set the value to a flow variable as well.

Thanks for that. I figured it was something to do with current state but I couldn’t see how to set the ‘if’ element of the node def.

I now have the correct temp in msg.payload, but how do I send that back? I’m trying to use the call service node-type. I have the correct entity selected and the following in the data {"temperature": msg.payload }, but it doesn’t like it.

You can build that in the function node easily:

var new_temp = msg.data.attributes.target_temp_high + 1;

msg.payload = {
    domain: 'climate',
    service: 'set_temperature',
    data: {
        entity_id: 'climate.home_thermostat',
        temperature: new_temp
    }
}

return msg;

Then just pass that to an empty call-service node:

Thanks. That works OK

1 Like
{
    "temperature": $entities("climate.home_thermostat").attributes.target_temp_high  + 1
}

2 Likes