I'm trying to control my cover with 2 buttons in ESP-Home.
When i click on it short, it should either stop or start (close/open) the cover.
But inside of the lambda, it always jumps into the stop-function. Even if the cover is not moving. What am I doing wrong here?
binary_sensor:
- platform: gpio
internal: True
pin:
number: D1
inverted: true
mode:
input: true
pullup: true
name: "Taster UP"
on_click:
min_length: 0ms
max_length: 350ms
then:
- lambda: |-
if((id(template_cover).current_operation == COVER_OPERATION_CLOSING)||(id(template_cover).current_operation == COVER_OPERATION_OPENING))
{
auto call1 = id(template_cover).make_call();
call1.set_command_stop();
call1.perform();
}
else
{
auto call1 = id(template_cover).make_call();
call1.set_command_open();
call1.perform();
}
on_press:
then:
- cover.open: template_cover
on_release:
then:
- cover.stop: template_cover