Closed Stupco closed 1 year ago
Does the fan itself physically turn back on? Or is it only the button on the UI display that turns back on but the fan is physically off?
Here is my check:
[fan.b3_fan] off
[input_boolean.b3_fan_state] off
[input_select.b3_fan_speed] 33
Button Row highlight - OFF
Use LOW setting on card
[fan.b3_fan] on [input_boolean.b3_fan_state] on [input_select.b3_fan_speed] 33 Button Row highlight - LOW
Use OFF setting on card
[fan.b3_fan] flash off for 3 seconds, then turn back to on [input_boolean.b3_fan_state] flash off for 3 seconds, then turn back to on [input_select.b3_fan_speed] 33 Button Row highlight - OFF
Reminder, this does not occur when using entity card for fan and toggling entity off.
Logs:
2023-01-05 10:46:42.758 INFO (MainThread) [homeassistant.helpers.script.bedroom_3_fan] Bedroom 3 Fan: Running template script
2023-01-05 10:46:42.758 INFO (MainThread) [homeassistant.helpers.script.bedroom_3_fan] Bedroom 3 Fan: Executing step call service
2023-01-05 10:46:42.758 INFO (MainThread) [homeassistant.helpers.script.bedroom_3_fan] Bedroom 3 Fan: Running template script
2023-01-05 10:46:42.758 INFO (MainThread) [homeassistant.helpers.script.bedroom_3_fan] Bedroom 3 Fan: Executing step call service
2023-01-05 10:46:42.769 INFO (MainThread) [homeassistant.components.script.fan_off] Fan Off: Running script sequence
2023-01-05 10:46:42.769 INFO (MainThread) [homeassistant.components.script.fan_off] Fan Off: Executing step call service
2023-01-05 10:46:42.772 INFO (MainThread) [homeassistant.components.script.fan_set_speed] Fan (speed): Running script sequence
2023-01-05 10:46:42.772 INFO (MainThread) [homeassistant.components.script.fan_set_speed] Fan (speed): Executing step call service
2023-01-05 10:46:42.787 WARNING (MainThread) [homeassistant.components.input_select] Invalid option: 0 (possible options: 33, 66, 100)
2023-01-05 10:46:42.789 INFO (MainThread) [homeassistant.components.script.fan_off] Fan Off: Executing step delay 0:00:02
2023-01-05 10:46:42.793 INFO (MainThread) [homeassistant.components.script.fan_set_speed] Fan (speed): Executing step delay 0:00:02
2023-01-05 10:46:44.791 INFO (MainThread) [homeassistant.components.script.fan_off] Fan Off: Executing step call service
2023-01-05 10:46:44.794 INFO (MainThread) [homeassistant.components.script.fan_set_speed] Fan (speed): Executing step call service
2023-01-05 10:46:44.798 INFO (MainThread) [homeassistant.components.script.fan_on] Fan On: Running script sequence
2023-01-05 10:46:44.799 INFO (MainThread) [homeassistant.components.script.fan_on] Fan On: Executing step call service
2023-01-05 10:46:44.805 INFO (MainThread) [homeassistant.components.script.fan_on] Fan On: Executing step call service
2023-01-05 10:46:44.807 INFO (MainThread) [homeassistant.components.script.fan_33] Fan (min): Running script sequence
2023-01-05 10:46:44.808 INFO (MainThread) [homeassistant.components.script.fan_33] Fan (min): Executing step call service
2023-01-05 10:46:44.809 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities input_select.b3_fan_speed or it is/they are currently not available
2023-01-05 10:46:44.809 INFO (MainThread) [homeassistant.components.script.fan_33] Fan (min): Executing step call service
Edit: after looking into the logs, I noted the issue with not having a 0 option for my input select. However, adding it means the card now works as expected (though I need to through in an error handle for speed.0 now).
The fan doesn't turn back on, but using the Button Row OFF still switches the entity state and input boolean to ON after a few seconds (but it doesn't send a command as speed is "0" and not handled in RF commands).
Is it possible that maybe the card does send the Percentage Value when you use the off button? It seems to be calling my Set_fan_Speed script even when I am turning off, which is causing the script to turn it back on...
As such, I've implemented the following condition workaround within my Set_Fan_Speed script:
fan_set_speed:
alias: Fan (speed)
mode: queued
sequence:
- service: input_select.select_option
target:
entity_id: input_select.{{ room }}_fan_speed
data:
option: "{{ percentage }}"
- condition: template
value_template: "{{ percentage != 0 }}"
- service: script.fan_on
data:
room: "{{ room }}"
Is it possible that maybe the card does send the Percentage Value when you use the off button?
No. it only sends the off command as far as I can see looking in the code.
at least it seems you've got it working using your updated code.
All the buttons work for me, except turning the fan off.
I have an RF fan so I use RF signals.
If I use an entity card to turn the fan off, there are no issues.
However, if I use the custom card and select off... it turns back on after a few seconds to the speed it was previously at.
This is frustrating as I don't want to use the entity card just to turn off the fan correctly... Am I missing something obvious here???
Code: