mirror of
https://github.com/esphome/esphome-docs.git
synced 2025-01-13 20:11:53 +01:00
Update sonoff dual cover cookbook
This commit is contained in:
parent
79904ada7f
commit
7a2669f576
@ -55,47 +55,41 @@ for some motors.
|
|||||||
then:
|
then:
|
||||||
# logic for cycling through movements: open->stop->close->stop->...
|
# logic for cycling through movements: open->stop->close->stop->...
|
||||||
- lambda: |
|
- lambda: |
|
||||||
if (id(cover).state == COVER_OPEN) {
|
if (id(my_cover).current_operation == COVER_OPERATION_IDLE) {
|
||||||
if (id(open).state){
|
// Cover is idle, check current state and either open or close cover.
|
||||||
// cover is in opening movement, stop it
|
if (id(my_cover).is_fully_closed()) {
|
||||||
id(cover).stop();
|
id(my_cover).open();
|
||||||
} else {
|
} else {
|
||||||
// cover has finished opening, close it
|
id(my_cover).close();
|
||||||
id(cover).close();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (id(close).state){
|
// Cover is opening/closing. Stop it.
|
||||||
// cover is in closing movement, stop it
|
id(my_cover).stop();
|
||||||
id(cover).stop();
|
|
||||||
} else {
|
|
||||||
// cover has finished closing, open it
|
|
||||||
id(cover).open();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch:
|
switch:
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
pin: GPIO12
|
pin: GPIO12
|
||||||
interlock: [open, close]
|
interlock: &interlock [open_cover, close_cover]
|
||||||
id: open
|
id: open_cover
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
pin: GPIO5
|
pin: GPIO5
|
||||||
interlock: [open, close]
|
interlock: *interlock
|
||||||
id: close
|
id: close_cover
|
||||||
|
|
||||||
cover:
|
cover:
|
||||||
- platform: time_based
|
- platform: time_based
|
||||||
name: "Cover"
|
name: "Cover"
|
||||||
id: cover
|
id: my_cover
|
||||||
open_action:
|
open_action:
|
||||||
- switch.turn_on: open
|
- switch.turn_on: open_cover
|
||||||
open_duration: 60s
|
open_duration: 60s
|
||||||
close_action:
|
close_action:
|
||||||
- switch.turn_on: close
|
- switch.turn_on: close_cover
|
||||||
close_duration: 60s
|
close_duration: 60s
|
||||||
stop_action:
|
stop_action:
|
||||||
- switch.turn_off: open
|
- switch.turn_off: open_cover
|
||||||
- switch.turn_off: close
|
- switch.turn_off: close_cover
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
--------
|
--------
|
||||||
|
Loading…
Reference in New Issue
Block a user