How to use attributes in Node-Red?

Hi all,

I’ve an Netatmo smart thermostat to control my heating in my house. I would like to use some automations in Node-Red when my thermostat starts the boiler to heat the house. Unfortunately in Home Assistant I only can see the thermostat it’s state as “heating”. Even when the thermostat is not heating, the state in Home Assistant is heating.

When looking at the states page in Home Assistant, I can see an attribute called hvac_action. This attribute does change states when the heating goes on and off. Off = “Idle” and On = “Heating”.

I would like to use this attribute to control some automations like the floor heating pump, but I have no idea how to use it.

Any help would be nice! Thanks.

Yes this is pretty much possible. One way to easily get an attribute is to simply listen to the state change with a debug node (make sure to set the debug node to complete msg and the state node to trigger even if the state is the same).
Example:

Great, I got to the point where I’ve two options in de debug: new_state and old_state. Does that make any difference? I’m using the event_state node.

old_state is the previous state. new_state is the current state.

Ok, so now I’ve a test setup like this:

Where the switch node is setup like this:
image

When I change the thermostat to heating, I will first get an idle message and then a heating message:
image
Idle comes in first, then directly after that the heating message. Same happens when I change back to idle.

Any thoughts?

So, the problem is that your netatmo does not correctly represent the attribute of hvac_action?
I dont have a device to check it on my end.

If I understand correctly, you mentioned that when you change from idle to heating you will get 2 messages with new_state.attribute.hvac_action. 1st: Idle, 2nd: Heating
When you change back to from Heating to Idle this order is reversed?

If so, then you maybe able to just discard the first message.

Well, the netatmo does work correctly. When it starts my boiler to heat the house, the attribute hvac_action state goes to heating. When boiler is off the state goes to idle.

Problem is, and I don’t know where it is coming from, that i’ll get to messages when the states changes. If I make an automation on both states it means both automations will be activated.

Well in that case try to figure out why you receive both messages. Might be just a config issues.
Or just try to implement the workaround i suggested above.

This should give you some pointers:
How to Only respond to 2nd message (within time window) - General - Node-RED Forum (nodered.org)

Dg Darryl,

Ik heb eigenlijk dezelfde soort vraag, ook met Netatmo. Hoe ben je hier mee verder gegaan?

Groeten,
Matthijs

Hi Matthijs,

I stopped using Node-Red for this automation. I did manage to implement this automation through Home Assistant Automations.

You have to make two automations; one for turning on the floor heating pump, and one to turn off.
The trigger for both automations is by using the thermostat, then the attribute ‘Hvac action’. For turning on the pump use attribute hvac action idle to heating, and vice versa for turning off the pump. See screenshot below. Then for the action use your pump obviously.

Ah, ok! Thanks for the update. I did manage to use automations as well, but was trying to implement it in Node Red to try some other functionalities.

Thanks for the reply!

Cool, let me know when you manage to get it working in Node-Red :smiley:

One additional question as you also have setup Home Assistant with Netatmo. When changing the temperature in Home Assistant, it instantly triggers the temperature in Netatmo. In HASS however the temperature stays the same and only updates minutes later.

Do you have the same issue? Or is it a setting somewhere how often the data is transfered?

When I change the temperature on the thermostat or in Home assistant, the other will update 5-10 seconds later.

What do you mean with HASS?

Home Assistant :slight_smile:

Then what do you mean with that when changing the temp in home assistant it will change temp in netatmo instantly, but in home assistant the temp stays the same for a few minutes? I don’t understand what you mean.

@Matthijs_NL I have similar issues with my thermostat control. It is the integration interaction with their crappy cloud server (carrier home). There’s delays in both getting and setting attributes.

1 Like