I’m trying to create a script to increase my fan speed so I can trigger the speed with my harmony through emulated_roku. I’m on hassio 163 (0.92.2) and using a ifan02 flashed with tasmota, the fan control is working fine through lovelace and google assistant.
I’m not very familiar with scripts in homeassistant, I found the following to use for my lights and its working well.
‘1234567892’:
alias: MasterBedroom Brightness Increase Button
sequence:
service: light.turn_on
data_template:
entity_id: light.master_bedroom_ceiling
transition: ‘1’
brightness: "{% if not state_attr(‘light.master_bedroom_ceiling’, ‘brightness’)\
\ == None %} {% set n = state_attr(‘light.master_bedroom_ceiling’, ‘brightness’)\
\ + 25 %} {% if n > 255 %}\n 255\n{% else %}\n {{ n }}\n{% endif %} {%\
\ else %} 25 {% endif %}\n"
Looking to do the same with my fan, which has the following options for state, “off, low, medium, high”. I would like the script to set the speed to low if the fan is off, med if the fan is low, high if the fan is med, leave high if fan is high; at the time the script is executed.
Has anyone found a good write up for HA scripting they could share? I don’t find the components documentation very helpful for my current needs.
I’m pretty good at powershell scripting, but this is completely different.
Almost seems like the elseif statements are not processing. Also curious if I might need to specify ‘fan.living_room_fan.speed’ instead of just state based on the image, since “State” is only showing “on”