Hello,
As my first non-trival project, I have a switchable legacy power outlet connected by USB to my Home Assistant server. I would like to integrate it in the Home Assistant frontend so I can use it to control the state of the power outlet.
I have a working command line tool on the server which has the functions toggling the on/off state and querying the current state (/home/homeassistant/bin/toggletv.sh -s
currently prints “on” and “off” respectively).
Reading some documentation and forum entries, I arrived at below addition to my configuration.yaml .
The input_boolean is visible in the frontend and can indeed switch the connected TV on and off.
However, I would like to achieve that the status of the input_boolean symbol in the frontend is updated whenever the state changes. This can happen independently of input_boolean and, therefore, would need to be based on the status query. Currently, my first attempt in the direction, binary_sensor, does not appear to work. At least its status is shown as “Unknown” since more than 12 hours.
automation toggle_tv:
- alias: "Toggle TV"
trigger:
platform: state
entity_id: input_boolean.toggle_tv
action:
service: shell_command.sispmctl_toggle_tv
input_boolean:
toggle_tv:
name: Toggle TV
binary_sensor:
- platform: command_line
name: Sispmctl TV Power Status
command: '/home/homeassistant/bin/toggletv.sh -s'
shell_command:
sispmctl_toggle_tv: '/home/homeassistant/bin/toggletv.sh'