I installed a rangehood that has an IR remote to turn the light on/off, and change speed on the two fans from 1 to 4. The power button is a toggle button as well (meaning no separate buttons for on and off).
I am using a Broadlink RM4 Mini sitting on top of my cabinets (the IR is reflected back down to the rangehood) to send the IR signal. The script to turn on and off the light is:
rangehood_light:
sequence:
- service: remote.send_command
target:
device_id: db7ca8076ede2fb28d1f8337e336b253
data:
device: Rangehood
command: Light
mode: single
alias: Rangehood Light
I am trying to enable Alexa to turn on and off the rangehood light by using the appropriate “turn on” and “turn off” commands. Right now, I can say “turn on” for all my commands and it will toggle the light on the rangehood.
Since the rangehood can also be turned on manually, and it will not report back its state, Alexa and HA have to ignore whether it is on or off, and must just send the command. Using the script alone allows me to turn on the light with Alexa but it will not turn off (she says OK but nothing happens).
I lost track of all my attempts, but below is the latest template I have which is not working correctly (no off in Alexa):
switch:
- platform: template
switches:
blind:
friendly_name: "Rangehood Bulb"
value_template: "{{ is_state_attr('input.boolean.rangehood_bulb', 'sensor_state', 'on') }}"
turn_on:
service: script.turn_on
entity_id: script.rangehood_light_on
turn_off:
service: script.turn_off
entity_id: script.rangehood_light_off
It is temporarily called “Rangehood Bulb” to avoid conflicts with the “Rangehood Light” script (think verbal commands to Alexa).
On the frontend I currently just call the scripts and had to format it with large buttons to hide the “Run”:
A momentary button, would be ideal given the actual state will most often be wrong. Or… I can create something for Alexa to allow turning on/off verbally and something different for the UI.
Can someone help me unravel this?
-
How to I turn on / turn off something via a script by telling Alexa to turn it on or off?
-
Is there something like a momentary button that can fit better in this type of UI design: