Hello fellow smart homers! I have recently discovered it is possible to track device on/off states with ping in Home Assistant
binary_sensor:
- platform: ping
name: device_name
host: xx.xx.xx.xx
scan_interval: 15
count: 5
switch:
- platform: template
switches:
device_name:
value_template: "{{ is_state('binary_sensor.device_name', 'on') }}"
But how do I incorporate that into my script such as this
tv_off_plex_off:
alias: Turn TV & Plex off
sequence:
- service: switch.turn_off
data:
entity_id: switch.tv_power
if “{{ is_state(‘binary_sensor.plex’, ‘on’) }}”
run
- service: switch.turn_off
data:
entity_id: switch.plex_power
else
So that Plex only gets turned off if it’s on?