# Thermostat via external sensor | Understanding MQTT or Home Assistant

**URL:** <https://discourse.nodered.org/t/thermostat-via-external-sensor-understanding-mqtt-or-home-assistant/70490>\
**Category:** General\
**Tags:** mqtt\
**Created:** [12 November 2022 11:27 UTC](https://discourse.nodered.org/t/thermostat-via-external-sensor-understanding-mqtt-or-home-assistant/70490 "2022-11-12T11:27:59Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![dokwon](https://avatars.discourse-cdn.com/v4/letter/d/b5a626/32.png) [@dokwon](https://discourse.nodered.org/u/dokwon)\
**Post date:** [12 November 2022 11:27 UTC](https://discourse.nodered.org/t/thermostat-via-external-sensor-understanding-mqtt-or-home-assistant/70490/1 "2022-11-12T11:27:59Z")

</div>

First post, hope it's not terrible!

Hi guys. So, as the title suggests I am planning a specific automation while also trying to understand as much as possible about node red in the process.

I am running HA dockerized on an RPi4, zigbee2mqtt and mosquitto.  
Thermostat: Aqara Smart Radiator Thermostat E1 (SRTS-A01) by Xiaomi  
Thermometer: Aqara temperature, humidity and pressure sensor (WSDCGQ11LM) by Xiaomi

Now I dont know if it's just me, but the interaction with Thermostats is really confusing and counter-intuitive at times. HA provides a multitude of entities for these devices, the ones that I assume are the most relevant are the switch and the climate entity. Which leads me to my first question:

- The current temperature is managed relative to the devices own thermometer- which is not very usefull since it resides very close to the radiator. Since I also have other thermometers in my room- how can I make sure that the device does not implement its own logic, but only listens to the one provided by node red. What would such a flow like?

Another observation that I made in HA is that it does not matter whether I turn the device on or off via the switch. Neither does it matter if the mode is "heat", "manual" or "none". It will just heat according to room temp. relative to measured temp. This does not seem very reliable at all!

- Is it possible to manage devices/entities in node red only, even though HA knows about them?

Sorry, I am aware that this post is a bit of a mess. Just struggling to formulate my questions at this point.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [12 November 2022 11:42 UTC](https://discourse.nodered.org/t/thermostat-via-external-sensor-understanding-mqtt-or-home-assistant/70490/2 "2022-11-12T11:42:31Z")

</div>

Welcome to the forum @dokwon

Very few here use HA and as this appears to be a question about HA specifically you might be better on a HA forum.

---

<div class="post-metadata">

**Author:** ![dokwon](https://avatars.discourse-cdn.com/v4/letter/d/b5a626/32.png) [@dokwon](https://discourse.nodered.org/u/dokwon)\
**Post date:** [12 November 2022 11:45 UTC](https://discourse.nodered.org/t/thermostat-via-external-sensor-understanding-mqtt-or-home-assistant/70490/3 "2022-11-12T11:45:32Z")

</div>

Hi Colin,

thanks, I understand.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [12 November 2022 11:49 UTC](https://discourse.nodered.org/t/thermostat-via-external-sensor-understanding-mqtt-or-home-assistant/70490/4 "2022-11-12T11:49:11Z")

</div>

Alternatively, you could ditch HA and go to a node-red based system.

---

<div class="post-metadata">

**Author:** ![dokwon](https://avatars.discourse-cdn.com/v4/letter/d/b5a626/32.png) [@dokwon](https://discourse.nodered.org/u/dokwon)\
**Post date:** [12 November 2022 12:37 UTC](https://discourse.nodered.org/t/thermostat-via-external-sensor-understanding-mqtt-or-home-assistant/70490/5 "2022-11-12T12:37:16Z")

</div>

Im already considering this 🙂  
Whats the best way to learn? I know about the documentation and browsed it a couple of times. Any other place that you can recommend, especially regarding fundamentals around smarthome devices?

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [12 November 2022 12:58 UTC](https://discourse.nodered.org/t/thermostat-via-external-sensor-understanding-mqtt-or-home-assistant/70490/6 "2022-11-12T12:58:45Z")

</div>

There is a [playlist on youtube](https://www.youtube.com/watch?v=ksGeUD26Mw0&list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6) from the developers (short videos), it will take your through all the essentials of node-red, watch them all and you will grasp a lot of the concepts.

You are using zigbee2mqtt, you can directly use this in node-red via mqtt nodes for example.

---

<div class="post-metadata">

**Author:** ![dokwon](https://avatars.discourse-cdn.com/v4/letter/d/b5a626/32.png) [@dokwon](https://discourse.nodered.org/u/dokwon)\
**Post date:** [12 November 2022 13:14 UTC](https://discourse.nodered.org/t/thermostat-via-external-sensor-understanding-mqtt-or-home-assistant/70490/7 "2022-11-12T13:14:05Z")

</div>

Thank you!

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [12 November 2022 13:46 UTC](https://discourse.nodered.org/t/thermostat-via-external-sensor-understanding-mqtt-or-home-assistant/70490/8 "2022-11-12T13:46:40Z")

</div>

> [@dokwon](#):
>
> I am running HA dockerized on an RPi4, zigbee2mqtt and mosquitto.

I suggest starting without Docker or Home Assistant, maybe migrate once you have things working.

Docker makes things much more complicated (just my opinion).  
It's very useful software but I found it has a considerable learning curve.

No doubt as Andreas Spiess [says on youtube](https://www.youtube.com/watch?v=3nwr7tasnLE) "The Home Assistant project ... is the de facto standard for serious home automation" but for me it lacks the elegance of Node-red.  
I have never used it but I have seen lots of questions on this forum from HA users and the number of different node types they have is mind boggling.  
I wonder about the quality of support too, there must be a reason that HA users ask here instead of a HA forum.

---

<div class="post-metadata">

**Author:** ![stefan24](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stefan24/32/23075_2.png) [@stefan24](https://discourse.nodered.org/u/stefan24)\
**Post date:** [12 November 2022 13:56 UTC](https://discourse.nodered.org/t/thermostat-via-external-sensor-understanding-mqtt-or-home-assistant/70490/9 "2022-11-12T13:56:37Z")

</div>

After the first automatic scan of Devices, most of the configuration is done via yaml files in HA. (if I got it right, while testing it)  
I also prefer the Node-RED style 😃

---

<div class="post-metadata">

**Author:** ![dokwon](https://avatars.discourse-cdn.com/v4/letter/d/b5a626/32.png) [@dokwon](https://discourse.nodered.org/u/dokwon)\
**Post date:** [17 November 2022 12:49 UTC](https://discourse.nodered.org/t/thermostat-via-external-sensor-understanding-mqtt-or-home-assistant/70490/10 "2022-11-17T12:49:30Z")

</div>

Some of the Home Assistant Nodes are very convenient. Like the "current state" node for a radiator/open window scenario.  
I would love to learn node red the right way though, without having the underlying logic abstracted away from me. Did anyone ever create a space where the Home Assisntant nodes are listed and reproduced with native node red nodes? That would be a good place for beginners (and people migrating) to start.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [18 November 2022 07:33 UTC](https://discourse.nodered.org/t/thermostat-via-external-sensor-understanding-mqtt-or-home-assistant/70490/11 "2022-11-18T07:33:03Z")

</div>

> Like the "current state" node for a radiator/open window scenario.

Depending on your device and its capabilities, you can either request its state or you need to maintain some state table. Maintaining state is something HA is good at. Within NR you can keep track of states using context or a database or something.

I am using zwave devices for the radiators and can request the current state of the radiator and perform the logic in NR where needed.

---

<div class="post-metadata">

**Author:** ![dokwon](https://avatars.discourse-cdn.com/v4/letter/d/b5a626/32.png) [@dokwon](https://discourse.nodered.org/u/dokwon)\
**Post date:** [18 November 2022 10:38 UTC](https://discourse.nodered.org/t/thermostat-via-external-sensor-understanding-mqtt-or-home-assistant/70490/12 "2022-11-18T10:38:41Z")

</div>

I think the intended scope behind automations is just different in HA.  
For a lot of use-cases, HA automations are more than enough and due to the limited scope in comparison to Node-RED it compensates with a very intuitive UI with almost no learning curve. The fact that you can enhance automations with NR for those who want to go further is very thoughtful imho.  
I think both tools are amazing and they arent really competing for the same thing.

---

<div class="post-metadata">

**Author:** ![dokwon](https://avatars.discourse-cdn.com/v4/letter/d/b5a626/32.png) [@dokwon](https://discourse.nodered.org/u/dokwon)\
**Post date:** [18 November 2022 10:44 UTC](https://discourse.nodered.org/t/thermostat-via-external-sensor-understanding-mqtt-or-home-assistant/70490/13 "2022-11-18T10:44:10Z")

</div>

Sorry, I have two followup questions if you dont mind 🙂  
• What do you mean by 'using context'  
• How do you request the current state?

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [18 November 2022 13:16 UTC](https://discourse.nodered.org/t/thermostat-via-external-sensor-understanding-mqtt-or-home-assistant/70490/14 "2022-11-18T13:16:03Z")

</div>

> [@dokwon](#):
>
> What do you mean by 'using context'

Means saving the reading to either RAM or to disk, so that you can quickly recall it at a later time.

> [@dokwon](#):
>
> How do you request the current state?

Sending a message to the device asking it to return a message with the current reading.  
The request message can take different formats depending upon the device.  
A lot of users use MQTT for this.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [18 November 2022 19:14 UTC](https://discourse.nodered.org/t/thermostat-via-external-sensor-understanding-mqtt-or-home-assistant/70490/15 "2022-11-18T19:14:22Z")

</div>

There is a [lot of documentation](https://nodered.org/docs/user-guide/context) available that should get you going.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [17 January 2023 19:15 UTC](https://discourse.nodered.org/t/thermostat-via-external-sensor-understanding-mqtt-or-home-assistant/70490/16 "2023-01-17T19:15:11Z")

</div>

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