Hi all,
I’d like to refresh the status of my devices when HA reboots (for example when I reboot the raspberry for other reasons).
Happens this:
when I reboot HA and the TV is turned on, the input boolean remains turned off…
input_boolean:
tv:
name: Accensione tv
initial: off
icon: mdi:television
script:
sequenza_on_tv:
alias: "tv"
sequence:
- service: media_player.turn_on
entity_id: media_player.oled_lg
- service: media_player.turn_on
entity_id: media_player.skyq_living_room
sequenza_off_tv:
alias: "tv"
sequence:
- service: media_player.turn_off
entity_id: media_player.oled_lg
- service: media_player.turn_off
entity_id: media_player.skyq_living_room
automation tv:
- alias: "rileva TV ON"
trigger:
platform: state
entity_id: media_player.oled_lg
to: 'on'
condition:
condition: state
entity_id: input_boolean.tv
state: 'off'
action:
service: input_boolean.turn_on
entity_id: input_boolean.tv
- alias: "rileva TV OFF"
trigger:
platform: state
entity_id: media_player.oled_lg
to: 'off'
condition:
condition: state
entity_id: input_boolean.tv
state: 'on'
action:
service: input_boolean.turn_off
entity_id: input_boolean.tv
- alias: "tv"
trigger:
platform: state
entity_id: input_boolean.tv
condition: []
action:
service: script.turn_on
data_template:
entity_id: >
{% if trigger.to_state.state == 'on' %}
script.sequenza_on_tv
{% elif trigger.to_state.state == 'off' %}
script.sequenza_off_tv
{% endif %}
If HA refreshes the status of media_player.oled_lg, I think this won’t happens…