Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

Just FYI I use the HASSIO Docker install method. This will create a basic switch which toggles a boolean value of on/off and then runs a script to create a testfile. 

Note: I found I had to restart the docker container, even using the WebUI for restarts didn't work (I don't want to say how long it took me to figure that out...)

place the following in configurations.yaml:

input_boolean:
  test_boolean:
    name: On Off Boolean Switch

switch:
  platform: template
  switches:
    test_boolean:
      value_template: >
        {{ is_state('input_boolean.test_boolean', 'on') }}
      turn_on:
        - service: input_boolean.turn_on
          entity_id: input_boolean.test_boolean
        - service: shell_command.test_cmd
      turn_off:
        - service: input_boolean.turn_off
          entity_id: input_boolean.test_boolean
        - service: shell_command.test_cmd

shell_command:
    test_cmd: 'touch /config/testfile'

#https://community.home-assistant.io/t/create-a-toggle-switch/110794/5
#https://jsonformatter.org/yaml-formatter

  • No labels