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