Tag Archives: hass.io

Hass.io and a custom relay

While I’m currently OpenHab based, I was looking into Hass.io as an option, but that does leave the challenge of getting my WiFi controlled relays to work correctly.

This turns out to be fairly simple in the end, by using the platform command-line option + CURL

switch:
   - platform: command_line
     switches:
        relay1:
          command_on: '/usr/bin/curl -X GET http://<ip address>/relay/on'
          command_off: '/usr/bin/curl -X GET http://<ip address>/relay/off'
          command_state: '/usr/bin/curl -X GET http://<ip address>/relay/state'
          value_template: '{{ value == "ON" }}'
          friendly_name: My Relay