Giter Club home page Giter Club logo

esp32-plant-waterer-for-esphome's Introduction

ESP32 Plant waterer, (ESPHome managed device with Home Assistant automation)

This is a simple low-cost automated plant watering system, designed to work with Home Assistant based on ESP32 configuration and Over-The-Air (OTA) updates and management from the ESPHome plugin.

The setup uses MQTT protocol to publish sensor data allowing Home Assistant to monitor and trigger watering automations based on automation patterns described in this setup.

The setup includes the following instructions and (working) code;

  • ESPHome code that needs to be flashed onto your ESP32 device
  • Home Assistant Dashboard YAML
  • Home Assistant watering automation YAML
  • historical_stat sensor YAML (acts as failsafe for watering automation)
  • Home Assistant Error & Alerting automation YAML

The project and code is built around low cost M Stack Atom Lite, a low cost minature ESP32-pico based board. I originally tested this with smaller ESP-32 pico based boards, however most of these do not have embedded USB ports so an additional USB/ TTL convertor is required to initially flash these devices and potentially a separate power regulator board would be required.

Home Assistant Dashboard configuration

The M5 Atom Lite includes USB-C connector, onboard RGB LED, and exposes enough GPIO pins to support this project in a single 24mm x 24mm package and available for around $7 USD at the time of writing.

At the time of writing M5Stack also have a nicely packaged watering addon retailing at arround $8 USD, which combines a capacitive water sensor (capacitive sensors have a longer lifespan than the cheaper conductive sensors out there) and low powered water pump in a single unit which is designed to plug straight into the M5 range via a Grove connection which makes the hardware easy to assemble. Home Assistant Dashboard configuration

The M5 Atom Lite can provide enough power to run the water pump, (only tested when plugged into use power).

Bill of materials

Hardware

Setup is pretty easy โ€“ as the M5 Atom Lite and the watering unit both use a compatible grove connector (cable is provided in the watering kit).

Home Assistant Dashboard configuration

ESP32 setup

The easiest way to set this up is to set up a new device in ESPHome and paste the YAML code and run the installation process.

This guide assumes you are familiar with ESPHome, and have installed the MQTT broker service in Home Assistant.

You need to add the "historical_stats" code to Home Assistant "configuration.yaml", and restart Home Assistant, this sensor monitors the number of times watering automations have run in the last 4 hours, and is used to prevent the automation getting in a loop and overwatering. Also as this project does not have a water level sensor in the resevoir this is also used to raise alerts that the water reservoir has run out or the water pipe or is not spraying water into the plant pot. (this last one could save a whole container of water being fed to your carpet if things go wrong!).

Once complete you should see the device show up in MQTT

Home Assistant Dashboard configuration

With the following entities detected;

Home Assistant Dashboard configuration

The example folder has example YAML for the following;

Dashboard

The example YAML files include a dashboard with the folloiing features;

  • Manual water pump switch
  • Moisture percentage sensor value
  • Counter of number of times watering automation has run in the last 4 hours
  • Moisture Gauge card

Home Assistant Dashboard configuration

Watering automation

The watering automation example YAML provides the following features;

  • Automated watering based on capacitive sensor values
  • Sends push alerts to home assistant app enabled mobile devices / web portal
  • Built in failsafe logic to prevent over watering (watering cannot run for an hour since last watering, and cannot run more than 4 times in a 4 hour window).

Alerting and failsafe automation

The example YAML provides a failsafe automation and alerting of the watering function;

  • Alerting and failsafe automation
  • Sends alerts if the watering has run 4 times in a 4 hour period, where the soil I still reporting dry.
  • Push alerts to mobiles
  • TTS/ voice service alerting (uses nabu casa service - but can be changed if you dont subscribe to this service or disabled if this feature gets annoying!)

Code tested and running

Setup, hardware and code tested and running on;

  • Home Assistant 2022.8.3 - 2022.8.5
  • Supervisor 2022.08.3
  • Operating System 8.4
  • Frontend 20220802.0 - latest
  • ESPHome 2202.6.3

Additional information/ instructions

All YAML code in this repository is heavily commented to provide additional instruction/ guidance on customisation/ configuration for your system. This is intended to make is more understandable and re-usable to a wider audience.

esp32-plant-waterer-for-esphome's People

Contributors

rasclatt-dot-com avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.