# Temperature sensors via ESPHome -\> MQTT —\> Virtual thermostat: help?

**URL:** <https://community.homey.app/t/temperature-sensors-via-esphome-mqtt-virtual-thermostat-help/40856>\
**Category:** Flows\
**Created:** [January 10, 2021, 8:14pm UTC](https://community.homey.app/t/temperature-sensors-via-esphome-mqtt-virtual-thermostat-help/40856 "2021-01-10T20:14:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Retetiba](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/retetiba/32/16426_2.png) [@Retetiba](https://community.homey.app/u/Retetiba)\
**Post date:** [January 10, 2021, 8:14pm UTC](https://community.homey.app/t/temperature-sensors-via-esphome-mqtt-virtual-thermostat-help/40856/1 "2021-01-10T20:14:01Z")

</div>

Hi everybody,

I am trying to setup a multi zone heating system in my home, controlled via Homey.

I have the following idea. I want to setup a multizone heating system for my home. I am planning to this as follows:

Due to distance constraints I do not use zig bee/zwave temperature sensors. I have coupled several Xiaomi temperature/humidity sensors via BLE to an ESPHOME. This unit sends the data over MQTT to the Homey-MQTT broker. Via a flow I want to have these data put into a virtual thermostat. In case the temperature is too low, it will open a floor heating valve, steered by a Shelly one.

What I have now is the sensors are connected to the ESP home. The data is sent over MQTT and received by Homey broker. As example, one sensor sends the following topic:

xiaomitemperature/sensors/sensor/sensor\_2\_temperature/state  
xiaomitemperature/sensors/sensor/sensor\_2\_humidity/state  
xiaomitemperature/sensors/sensor/sensor\_2\_batterylevel/state.

These topics sends data as 20.4 or 50% or 80%.

My problem is how to get the temperature data into the virtual thermostat as sensor value.

I thought to start a flow with receiving a message, containing sensor\_2\_temperature, moving this value into the thermostat sensor…

But I can not get it to work. Anyone any idea how this flow should look like?

Thank you

Rene

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [January 11, 2021, 6:32am UTC](https://community.homey.app/t/temperature-sensors-via-esphome-mqtt-virtual-thermostat-help/40856/2 "2021-01-11T06:32:20Z")

</div>

Something like this: [Gedeelde Flow | Homey](https://homey.app/nl-nl/flow/7oX8Mr/)

[![](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/5/3559fd267fb78859b811f09b0d4bb2e2dc3ef226.jpeg) ](https://flow-api-screenshot.athom.com/7oX8Mr.png)

The first card uses “Received topic trigger” and subscribes to the full “temperature” topic, the second card sets the capability value of a virtual device using the “value” token (the value that was received on the MQTT topic).

---

<div class="post-metadata">

**Author:** ![Retetiba](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/retetiba/32/16426_2.png) [@Retetiba](https://community.homey.app/u/Retetiba)\
**Post date:** [January 11, 2021, 7:20pm UTC](https://community.homey.app/t/temperature-sensors-via-esphome-mqtt-virtual-thermostat-help/40856/3 "2021-01-11T19:20:20Z")

</div>

Thanks Robert… dankjewel 🙂

I was close, but this did the job.

Another question. I am planning to use some of the humidity and battery values also. I suppose I can store these in the virtual sensor and store the values under “measure\_humidity” and “measure\_battery”. Is that correct?

thank you!

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [January 11, 2021, 7:23pm UTC](https://community.homey.app/t/temperature-sensors-via-esphome-mqtt-virtual-thermostat-help/40856/4 "2021-01-11T19:23:55Z")

</div>

> [@Retetiba](#):
>
> I am planning to use some of the humidity and battery values also. I suppose I can store these in the virtual sensor and store the values under “measure\_humidity” and “measure\_battery”. Is that correct?

Yes, that’s correct 😃
