Addon State Check: Command Line Binary Sensor

I did! Although I wouldn’t say it’s the cleanest method but I used a REST sensor, replacing the bits in square brackets:

sensor:
  - platform: rest
    resource: "https://[home assistant web address]/api/hassio/addons/[addon name (from the address bar when you go to configure it in hass.io)]/info"
    headers:
      Authorization: "Bearer [user generated Long-Lived Access Token]"
      Content-Type: application/json
    name: [choose a name for this REST sensor]
    value_template: "{{value_json['data']['state']}}"

You can then also make a switch for it (which is useful for the interface / automations):

switch:
  - platform: template
    switches:
      [pick a switch name use underscores]:
        value_template: "{{ is_state('sensor.[REST sensor name]', 'started') }}"
        turn_on:
          service: hassio.addon_start
          data:
            addon: "[addon name]"
        turn_off:
          service: hassio.addon_stop
          data:
            addon: "[addon name]"
1 Like