I’ve been getting into some home automation for our apartment for a while, ever since my father got us an Amazon Alexa device to call home with. Since then we expanded our setup to include smart plugs, Philips Hue lighting, and some Broadlink IR controllers.

Whilst these products can function well in their respective eco-systems. The real power comes when leveraging a product such as Home Assistant to bring it all together into a single unified platform.

One thing we recently introduced in our setup was to include a very simple balcony watering system that can be controlled remotely and automated via timers and other triggers.

This post documents the equipment required outside of the standard Home Assistant setup and the configuration required to get going.

Parts

Setup

The setup with these components was straight forward, with the components pretty much connecting and screwing together and just working.

The only complicated thing was flashing custom firmware onto the smart plug as I wanted to have a purely offline setup. I went with espurna for this but you could also try esphome which provides a nice API and easy YAML configuration.

Home Assistant configuration

The automation currently consists of 3 parts.

  • A daily watering schedule which is triggered based on the time
  • Secondary schedule, triggered by time and temperature forecast
  • Manual invocation and automatic off after defined duration
  • Safety mechanism to ensure switch is off, for cases when reboot occurs during watering cycle.

For the first one I also decided to use Push Bullet to notify my devices when it was triggered, I wanted this to be notified easily whilst on vacation.

timers.yaml

For this setup you will need to setup two timers


# The main timer for automation triggers
balcony_water:
  duration: '00:02:00'

# Secondary timer for manual invocation
balcony_water_max:
  duration: '00:02:00'

Next configure the following automations.

- alias: 'Balcony water automatic (start)'
  trigger:
    - platform: time
      at: '21:30:00'
  action:
  - service: script.balcony_water_start

- alias: 'Balcony water hot day (start)'
  trigger:
    - platform: time
      at: '09:30:00'
  condition:
      condition: and
      conditions:
        - condition: numeric_state
          entity_id:  sensor.yr_temperature
          above: 25
  action:
  - service: script.balcony_water_start

- alias: 'Balcony water automatic (stop)'
  trigger:
  - platform: event
    event_type: timer.finished
    event_data:
      entity_id: timer.balcony_water
  action:
  - service: switch.turn_off
    entity_id: switch.socket_balcony
  - service: notify.pushbullet_chi
    data:
      message: 'Balcony watering finished'




- alias: 'Balcony water manual (start)'
  trigger:
  - platform: state
    entity_id: switch.socket_balcony
    to: 'on'
  action:
  - service: timer.start
    entity_id: timer.balcony_water_max

- alias: 'Balcony water manual (stop)'
  trigger:
  - platform: event
    event_type: timer.finished
    event_data:
      entity_id: timer.balcony_water_max
  action:
  - service: switch.turn_off
    entity_id: switch.socket_balcony




- alias: 'Ensure balcony is off on reboot'
  initial_state: 'on'
  trigger:
    - platform: homeassistant
      event: start
  action:
    service: switch.turn_off
    entity_id: switch.socket_balcony

Improvements

As the title says this setup is very basic right now and gives no feedback on the water remaining in the tank, the moisture in the soil, or outside air temperature.

All these points are things I would love to improve in the future, especially the first point.

Photos

Drip nozzle Water storage Setup

Further reading