Unable to get temperature data from climate home assistant

I have a thermostat automation in Home Assistant that triggers when the thermostat is set above a certain temp. I cannot figure out how to read this value in Node Red. I have tried both polling and state change, but both of them will only return the value of "heat" or "cool" that the thermostat is in, not the temperature (states.climate.thermostat.attributes.temperature). If I set the state type as number I only get the output of NaN. How do I test the actual temperature? I'm pretty excited about using Node Red but so far it has seemed much simpler to just code the yaml and use standard automations through HA. There seems to be a scarcity of specific and in-depth tutorials for Node Red. I can create a simple time based trigger flow (and find tutorials on doing so) quite easily, but more complex and detailed explanations do not seem to be available.

Hi and welcome to the forum.

The information is all there but because there is MUCH more freedom & far more possibilities, it is not really feasible to document everything (you wouldnt see the wood for the trees)

What is well documented is the building blocks and how tos.

It is best to learn how to get what you want out of node-red

I typically direct new users to this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

The cookbook is another good source

I was there something like a year ago...
The difference is that I never really considered yaml as being simple :slight_smile:
My reason to switch to nodered was my total inability to debug HA automations. At least with NR, debug is at a node reach.

As Steve pointed out, there are good examples in the cookbook and other places. And there is also the (very friendly) community! If you describe what is your problem, then without a doubt someone will give you the answer or will point you into the right direction.

In your case, if out of the "events state" change node, put a debug node with the entire msg. On the side you will see the full result and you will be able to pick the attribute you are looking for.
It should be something like msg.data.attributes.temperature and then up to you :wink:

Have a look at this video, skip through to 6:15

Well, your idea made sense, but no matter what I try I cannot extract the temperature state from the event. Non of the videos nor the cookbook go anywhere near into this depth. I'll keep trying and hoping someone knows how to accomplish this.

OK...more tinkering. I am able to send the temperature through a customs message using the trigger: state node. Now my problem is how to use that value. For example: if the temperature is > 69, set the thermostat to 69, otherwise take no action.

I was refering you your comment about "There seems to be a scarcity of specific and in-depth tutorials for Node Red" - There is lots of info.

Testing a value / changing a value / routeing a message are all covered in the videos and documentation.
In particular...

Putting these 3 concepts together, you can use the debug side-bar to get the path to the temperature then a switch node to test the value & route a message to change node where you change the temperature (or route to another path i.e. no where).

Part of the reason there is no in-depth or direct help for your particular problem is just that - it is your unique problem. node-red is infinitely flexible so unfortunately you have to learn the core concepts. Not that they are difficult, you just need to keep plugging away & re-watch that playlist a couple of times (trust me it is worth it).

Lastly, the reason you are getting generic help is two fold...

  1. You have provided no screenshots or flow export for people to examine and offer help on
  2. Your original issue was with a value you are getting from HA (this is the node-red forum - there are not that many HA users or threads here).

First of all, thank you for your responses. Though none of the videos or links are particularly helpful, I glean something from each of them. Part of my problem is I haven't been sure what I even need to ask.. I'm able to be quite specific now (I hope).

I am sending a custom message from the trigger: state node. In the debug window I am seeing msg: [ object, null, 62 ], but only when I have "Show Debug Information" checked. The only message I am able to see (which shows with that option checked or unchecked) is climate.thermostat: msg: Object { topic: "climate.thermostat", payload: "heat", data: object, _msgid: "xxxxx" }
I cannot determine how to get the 62 value out of the message. The switch node is definitely useful, but testing msg.payload[2] returns "a" (as that is the third letter of "heat"). How do I access the value in the custom message?

Can you do a screen snippet of the debug output (expand all properties before screenshotting)

Ensure debug node is set to show complete message

Also, can you copy the actual debug output using the debug copy button and paste it in a reply (correctly formatted so the forum doesn't screw it up)

paste copied value/code between three backticks like this


ok, so the value is an object - thats good.

so you said....


If you watch the video and read the text in the link I posted earlier...

you will learn you can get the correct path by using the "copy path" button. Then you can paste that path into the change node to move it into payload. You could then send that to a switch node to check if the value is > 69 then into a change node again to set the value if > 69.

Trying that now. Looks promising.

there are two(actually three) buttons there side by side - one is copy path and the other is copy value... I'm guessing you hit the wrong one by mistake

That did it! Thanks so much for your help. I will continue reading and learning. I still think there are some ways that just straight coding yaml is easier, but I expect this to be more robust in the end.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.