In the following code, when I tell the garage to open, I will get the “opening” message in my mushroom cover card. When “closing” I will not get the “closing” message. Other than that, it does as I have written. Is there something out of order here?
close_action:
- delay: 1s # Add a 1-second delay before close action
- repeat:
count: 10 # Repeat the following 10 times for 10 flashes
then:
- output.turn_on: garage_light # Turn on the output
- delay: .5s # Keep it on for .5 seconds
- output.turn_off: garage_light # Turn it off
- delay: .5s # Keep it off for .5 seconds
- lambda: !lambda |-
id(garage_door).current_operation = esphome::cover::COVER_OPERATION_CLOSING;
if (!id(closed_endstop).state) {
id(garage_switch).turn_on();
if (id(closed_endstop).state) {
id(performing_last_movement) = true; // Set flag to indicate we know where the door is
}
}
- output.turn_on: garage_light
- delay: 2min # Keep it on for 2 minutes
- output.turn_off: garage_light # Turn off the pin after 2 minutes
From lambdas, you can access the current state of the cover (note that these fields are read-only, if you want to act on the cover, use the make_call() method as shown above).
I was reading up on that. The weird thing is if i make the lambda part of the code first, and then add the flashing light code after, i get the closing message, but then it starts to close before the lights flash…let me read up on what you posted to see if something clicks. Thank you. Sometimes it helps to just bounce these thoughts off with others
It wouldn’t be the first time the docs were wrong. What happens if you add a lambda block with just this code in it right at the start? You can have multiple lambda blocks.
I just tried that. The code I have for the delay is different than what a lambda block will recognize so I used chat GPT to write me some lambda code. and it works half way…Just need to perfect it now