Hello,
I added a if-then block in a script to switch a template fan off only if it is on, because it is controlled using infrared and it is the same command to switch it on or off.
On that side all is OK, it is only stopped if needed.
But I wish to execute some actions after that if-then block because I have to do a work around for a Google Assistant bug but I have the same behavior as conditions, the rest of the script is not executed when except an indentation error from me, the delay and the call to the service are out of the if-then block.
I checked it using debugging script, it stops after the if-then block where nothing is executed because the fan was off.
If I believe this example of the script documentation, script should continue.
Has someone an idea of what I missed?
The script:
heure_du_coucher:
description: éteint toutes les lumières et verrouille la porte d'entrée
alias: Heure du coucher
sequence:
- service: lock.lock
data: {}
entity_id: lock.porte_d_entree
- service: esphome.diffuseur_chambre_night_diffusion
- service: light.turn_off
entity_id:
- light.lustre_chambre
- light.lumieres_salon
- service: switch.turn_off
entity_id:
- switch.lustre_bureau
- delay: 00:00:01
- service: fan.turn_off
entity_id:
- fan.ventilateur_bureau
- fan.diffuseur_bureau
- fan.diffuseur_salon
- if:
- condition: state
entity_id: fan.ventilateur_chambre
state: "on"
then:
- service: fan.turn_off
entity_id: fan.ventilateur_chambre
- delay: 01:05:01
- service: media_player.media_stop
target:
entity_id: media_player.enceinte_chambre
mode: single
Sure, the delay is really particular, but I don’t think it is the cause because it is not executed