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 ?
Best would be that NodeRed checks temp vs condition that I set up and send message to turn on or off to sonoff device?
Can Home Assistant be used for that purpose?
I could change micropython code in ESP32 to check conditions, but then again, I need to send some message to sonoff device.
You can use a Home Assistant automation or automate it in node red, or even automate it in ESPHome.
The advantage of doing the automation in ESPHome is that it will continue to work while Home Assistant is offline. However this is only possible if your switch and sensors are on the one device. If you have to send the sensor information to the switch running ESPHome via home assistant then you might as well do the automation there.
e.g. You could try an automation like this in the Home Assistant automation editor: