if i click on Call Service here, it will turn the TV on
how can i create a toggle switch in configuration.yaml for on and off?
thanks!
if i click on Call Service here, it will turn the TV on
how can i create a toggle switch in configuration.yaml for on and off?
thanks!
i have this in my config
- platform: template
switches:
tv4k:
value_template: "{{ is_state('sensor.tv4k', 'on') }}"
turn_on:
service: shell_command.tv_on
data:
entity_id: switch.tv4k_on
turn_off:
service: shell_command.tv_off
data:
entity_id: switch.tv4k_off
and i was able to see it:
BUT the TV refuses to turn on.
the strange thing i noticed is that the switch toggles back to OFF, automatically after about 5 seconds. so maybe TV was booting up, but the switch turned it off ??? TV takes about 8 seconds to fully turn on
what is the state of sensor.tv4k
? If that isn’t changing to on, the switch will turn off. Note that this doesn’t actually turn the TV off, it just changes the switch position.
You can lose the data:
and entity_id:switch.tv4k_on
portions of your config. They are not needed. The shell_command service does not need a entity ID.
As @silvrr said, try the basic version, and go from there:
- platform: template
switches:
tv4k:
turn_on:
service: shell_command.tv_on
turn_off:
service: shell_command.tv_off
so it seems i have to turn the TV on first, then boot up my Odroid C2 for the C2 to recognize the TV’s CEC. after that, i have no problem using the switch you suggested to turn the TV on. the switch does flip back to “off” but the TV does not turn off. that’s good.
BUT, when i hit the switch to turn TV back to off, nothing happens.
The switch is likely in the off position as HA doesn’t know it on. Therefore it’s not sending the off signal.
Can you add a means of determining the state?