Simple sprinkler on/off via http

Hi,

I’m very new to home assistant and the first device i’m trying to setup is a remote relay board which turns sprinklers on and off. I think i’ve managed to set one of the relays up in configuration.yaml but, I have no idea how i can then trigger it via the home assistant interface.

I’ve found documentation on how to set it up in configuration.yaml - but no idea where to from there, it doesn’t appear in devices or integrations in the home assistant interface? I’m not sure if this suggests it doesn’t work, or i’m supposed to look elsewhere?

Any help even if it’s pointing me at the correct documentation would be much appreciated.

Here’s my configuration.yaml:

# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

switch:
  - platform: command_line
    switches:
      axis:
        friendly_name: 'Sprinkler'
        command_on: 'curl -k "http://192.168.1.48/?relay1=off"'
        command_off: 'curl -k "http://192.168.1.48/?relay1=on"'

You need to restart home assistant after adding that configuration.

Add the switch to a dashboard card and turn the switch on.

1 Like

It actually looks like I do have an error in the log:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 366, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/usr/src/homeassistant/homeassistant/components/command_line/switch.py", line 43, in async_setup_platform
    slugify(discovery_info[CONF_NAME]): discovery_info
            ~~~~~~~~~~~~~~^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

I found a github page talking about this error here:

The last comment seems to suggest that this was because configuration syntax changed at some point. I try using the example in the linked documentation ( Command line - Home Assistant ) but now i get a different error:

Invalid config for ‘command_line’ at configuration.yaml, line 22: expected a dictionary for dictionary value ‘command_line->0->switch’, got None, please check the docs at Invalid config for ‘command_line’ at configuration.yaml, line 23: ‘name’ is an invalid option for ‘command_line’, check: command_line->0->name, please check the docs at Invalid config for ‘command_line’ at configuration.yaml, line 24: ‘command_on’ is an invalid option for ‘command_line’, check: command_line->0->command_on, please check the docs at Invalid config for ‘command_line’ at configuration.yaml, line 25: ‘command_off’ is an invalid option for ‘command_line’, check: command_line->0->command_off, please check the docs at

My current configuration is:

command_line:
 - switch:
   name: Sprinkler
   command_on: curl -k "http://192.168.1.48/relay1=off"
   command_off: curl -k "http://192.168.1.48/relay1=on"

Watch your indentation. It is important. See the example here: https://www.home-assistant.io/integrations/command_line#example-switch-platform

command_line:
 - switch:
     name: Sprinkler
     command_on: curl -k "http://192.168.1.48/relay1=off"
     command_off: curl -k "http://192.168.1.48/relay1=on"