Friday, 10 June 2016

home assistant

Home assistant uses a configuration.yaml script. That's where I put all my switches, light bulbs, etc, and rules. https://community.home-assistant.io

The automation rules for turning my irrigation on/off are based on sunrise:

- alias: 'Rule 1 irrigation turn on at sunrise'
  trigger:
    platform: sun
    event: sunrise
    offset: "00:00:00"
  action:
    service: switch.turn_on
    entity_id: switch.irrigation_front
- alias: 'Rule 2 irrigation turn off 15 after sunrise'
  trigger:
    platform: sun
    event: sunrise
    offset: "00:15:00"
  action:
    service: switch.turn_off
    entity_id: switch.irrigation_front

Declaring the irrigation switch is just a couple of lines:

switch:
  - platform: command_line
    switches:
      irrigation_front:
        oncmd:  /home/foobar/ha-post-Aon.sh irrigatorA on
        offcmd: /home/foobar/ha-post-Aoff.sh irrigatorA off





ha-post-Aon.sh and ha-post-Aoff.sh are bash shell scripts talking to the sparkFun 8266 Arduino shield.

No comments:

Post a Comment