# Sonoff with esphome listening to mqtt messages

**URL:** <https://discourse.nodered.org/t/sonoff-with-esphome-listening-to-mqtt-messages/43012>\
**Category:** General\
**Created:** [22 March 2021 14:54 UTC](https://discourse.nodered.org/t/sonoff-with-esphome-listening-to-mqtt-messages/43012 "2021-03-22T14:54:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajocius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ajocius/32/19024_2.png) [@ajocius](https://discourse.nodered.org/u/ajocius)\
**Post date:** [22 March 2021 14:54 UTC](https://discourse.nodered.org/t/sonoff-with-esphome-listening-to-mqtt-messages/43012/1 "2021-03-22T14:54:12Z")

</div>

I have ESP32 based temp measuring device in my greenhouse. Data is sent via mqtt protocol. Node-Red is capturing mqtt message and saves data to influxDB. I measure temp in several locations, but here important are temp at the top of greenhouse and soil temp. I would like to have solution where I can turn device when certain temp conditions are met. I have ventilator that moves air from the top of greenhouse under surface and therefore warm up soil during cold spring days.

I have flashed ESPhome to sonoff device and not sure what can I do next. I have tested sonoff device with Home Assistant, I can turn it on and off.

What kind of solution can I make ?

1. Best would be that NodeRed checks temp vs condition that I set up and send message to turn on or off to sonoff device?
2. Can Home Assistant be used for that purpose?
3. I could change micropython code in ESP32 to check conditions, but then again, I need to send some message to sonoff device.

---

<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:** [21 May 2021 14:54 UTC](https://discourse.nodered.org/t/sonoff-with-esphome-listening-to-mqtt-messages/43012/2 "2021-05-21T14:54:18Z")

</div>

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