I have my broadlink rm4 run commands to turn on the window fan via IR since simply turning it on via smart switch won’t turn it back on. It has to run through many commands (turn on, wait 2 seconds, fan speed up twice).
Unfortunately, it’s not 100% in turning it on initially, for some reason. Running this script a couple more times does eventually get it to turn on correctly. I’ve tried to have the script wait 30 seconds after running the broadlink commands to see if power consumption is over 20W based on the smart switch that it’s on, and if not, rerun the script. Doing this causes an infinite loop and causes HA to eventually crash when I try to view the trace. Is there a better way to have HA check 30 seconds after a script is run if something is running, if not, rerun the script? I’ve also tried to implement something similar in the automation and also causes issues with repeating the script even if power consumption was under 20W (based on traces)
The script I tried:
alias: Vornado Window Pull In
sequence:
- type: turn_off
entity_id: switch.bedroom_window_fan_on_off
domain: switch
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
- type: turn_on
entity_id: switch.bedroom_window_fan_on_off
domain: switch
- delay:
hours: 0
minutes: 0
seconds: 15
milliseconds: 0
- service: remote.send_command
data:
device: Vornado Window Fan
command: power
hold_secs: 5
target:
entity_id: remote.bedroom_broadlink_remote
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- service: remote.send_command
data:
device: Vornado Window Fan
command: speed_up
num_repeats: 3
delay_secs: 0.5
target:
entity_id: remote.bedroom_broadlink_remote
- delay:
hours: 0
minutes: 0
seconds: 30
milliseconds: 0
- condition: numeric_state
entity_id: sensor.bedroom_window_fan_electrical_measurement
below: '20'
- service: script.vornado_window_fan_on_pull
mode: single
icon: mdi:fan-chevron-up