I have my thermostat set at our normal house schedules. However sometimes our schedule changes and I want to set up an automation that will check if user is family is home. If family is home it will check the current preset mode attribute of the thermostat and if not set to “home” then call service to set up the thermostat to “home” preset mode. This will cover the thermostat to be at right temperate when our schedule changes.
I know that the attribute I want to check is on
entitiy: climate.home
attribute path: data.attributes.climate_mode
But where I struggle is how to access that attribute of the thermostat so when that value is set to sleep or work or away then I call a service to change it to “home”. I dont have an issue calling the service. that works well. It is just accessing the data from that attribute.
Tried with function nodes and switches but still struggling to know how to get it right.
If you are trying to find the state (and its attributes) of an entity, use a ‘current state’ node. Put a debug node on the end showing the complete message, you will see the attributes you are try to check.
Sorry to reply directly to an answer you gave a while back.
As far as I understand, your answer allows the current state node to filter a single attribute of the home assistant entity, or compare it to a threshold value.
Would it be possible to simply set the payload or data to just the value of a single attribute?
For example, from the above example, assign the value of “current_temperature” to the payload, so that it can be stored in a flow variable or be used for comparing it to another value retrieved from another home assistant entity ?
Away from home so can’t check directly, but you should be able to set it to the payload or any other field directly from the current state node, there is a section for output properties at the bottom of the dialogue, or use a change node.
Sorry again.
But I can use this “magic” directly in an “event state node” and (of course) I can use it in a function-node … but is there a way to use it in a change-node?
Can I use any data found in the payload coming from an events-node , as part of the new payload in a change-node?
What is the syntax there? I have tried to copy the “path” that i found in a debug node.
If I use $entity(), what does that specifically point to (if not the payload)
Isn’t using single or double curly brackets supposed to indicate referring to a variable?
In a change node, it gets an error unless I include it into " ", but then of course it simply adds the literal string
“{{$entity().attributes” just adds this literally into the payload going out of the node.
I have tried change msg.payload to “string” and “Jexpression”
I have a similar situation to this thread, but want to set the data attribute of the generic thermostat in Home assistant from a function node in node red, The attribite I want to set is temperature. It looks like this inside the entity
What the function node does is set the temperature based on a schedule of preset periods. This needs to change the temperature set point of the generic thermostat and hence turn on or turn off the heater.
I have looked at the following global.set("homeassistant.homeAssistant.states['climate.central_heating'].attributes.temperature", temp);
but this is not right
Any ideas would be a greatly appreciated
basically used a call service node with the following
The temp variable is determined from my function node that sets the temp based on the period of the day (Mon -Fri, Sat, and Sun)
Thanks a lot for sharing this. I have been looking for a while and was unable to understand this - with your post this solves a part of my problem.
I wonder if you can guide on how can send a command to the thermostat? I have a nest thermostat and I would like it to start the boiler only if room temperature falls below a set point (usually it runs on a schedule and does not stop even if the room temperature is reached)