• Install the normal close 220vac solenoid to control water flow.
  • Connect the solenoid with a smart plug.
  • Integrate Mi Flora via ESPHome (measures the moisture level).
  • Create automation in Home Assistant to turn on the smart switch based on moisture level.
flowerpots in my home area

1st generation solution

I have ~10 flowerpots that need to be watered every day to maintain the moisture level at the acceptable rate. I started my solution with the 220vac solenoid valve and plug this valve with a smart plug.

220vac Solenoid Valve Installed to control water flow with bypass flow


With basic this basic integration, you can turn the traditional irrigation system into pre-smart version without using Home Assistant. I can control the on/off timer via eWelink app (ships with all Sonoff smart plugs).

The disadvantage of this solution is it's not smart enough. It always works as configured even on the raining days which I don't want.

BTW, be careful when you work with 220vac devices. Don't forget to keep the device in the box to prevent it from the rain or wet weather.

2nd Generation Solution

We need to add a brain to the 1st solution. The On/Off decision making must be made based on moisture level. We need more devices for this solution.


  • A Home Assistant System (yes, you should have one already)
  • Mi Flora Outdoor Sensor (Amazon $29.99)

Mi Flora is a bluetooth low energy sensor. You can't control it directly via HA. The only solution is, to integrate via ESPHome. I have a blog described steps of this integration. Once you have properly configured the ESPHome and Mi Flora, you should get the moisture level easily. Try it on the Developer tools.

Next step is just creating the automation based on the moisture level 2 times a day.

1st automation, on at 7:00 if moisture level is less than 60

2nd Automation: Turn Off the Smart Switch if It was On for more than 5 min

Adjust the On duration per your requirement.3rd Automation: Status Watchdog & Alert

This automation keeps monitor the status of Sonoff S26. If it turned from "off" to "on", it will just send the Line notification to my account. Adjust the instant messaging alert per your requirement.

Alerting for "on" to "off" is using the same mechanism, you shall be apply the configuration easily.

The 2nd generation solution works perfectly on my use case. I rarely need to check the status of this integration. The automation keeps reporting status of the smart switch almost immediately.

Line Alert
Buy me a coffee