Hi all,
I have defined a simple template cover in ESPHome as follows:
cover:
- platform: template
name: "Gate"
lambda: |-
if (id(gate_sensor).state) {
return COVER_OPEN;
} else {
return COVER_CLOSED;
}
open_action:
- button.press: gate_open
close_action:
- button.press: gate_close
toggle_action:
- button.press: gate_toggle
device_class: gate
The cover works perfectly fine; it opens, closes, and reports the right state both in ESPHome itself and in HomeAssistant.
The only snag is that if I try to toggle it from HomeAssistant using the cover.toggle
service, instead of calling the toggle_action
, it calls the open_action
and close_action
directly. This is not the desired outcome, as the logic behind the toggle button is slightly different than simply cycling through open and close.
Is this expected behaviour? Seems strange, otherwise having the toggle_action
would make no sense in the first place.
I’m using HomeAssistant 2024.8.2 and ESPHome 2024.7.3.
Thanks a lot for any help.