Update sonoff dual cover cookbook

This commit is contained in:
Otto Winter 2019-05-31 21:29:38 +02:00
parent 79904ada7f
commit 7a2669f576
No known key found for this signature in database
GPG Key ID: DB66C0BE6013F97E
1 changed files with 16 additions and 22 deletions

View File

@ -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
--------