How to use attribute from current state node


First off all I am new at NR but it is fantastic.
I have an evohome system and what I try to do is getting an attribute value and then have two options: true or false on which I want to continue my automation.

I want to read the attribute: data.attributes.current_temperature and if this value is under 19 degrees celsius do this, if it is above 19 degrees celsius do something else.

What did I try already:

The strange thing on this config is that it is always falls… I am just not seeing it at the moment. Can someone help me out here or give me some directions on the best way to get this done?

Agree, Node-RED is fantastic.

The confusion with setting up this node, I believe, comes from the fact that it comes pre-populated with output parameters that do not exactly relate to how the ‘if state’ JSONata has to work.

The output properties selection list includes ‘entity state’ being assigned to msg.payload, and ‘entity’ being assigned to This just means that after the node has run, in the output message, msg.payload contains the entity state value, and contains the entity information. Thus, in the following nodes, I could reference

However, in the node, does not exist. The JSONata expressions require $entity() to get and reference the entity data, and this function returns the entire entity object, so here $entity().attributes will return just the attribute object part. No ‘data’ is required.

In the ‘if state’ box, with the ‘JSONata’ option, the JSONata expression needs to return a Boolean true or false (to drive the output flow), so removing the ‘data’ from the JSON path you already have should work.

$entity().attributes.current_temperature < 18

In the output properties, try $entity().attributes.current_temperature if you just want the current temperature attribute value to be returned in the msg.payload.

I don’t have your entity so I can’t test this.
This still confuses me and I hope I have got this right! Kermit will certainly know.


aaah thank you. you are correct. I have got it working now :slight_smile: