-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwindow_motor
89 lines (78 loc) · 1.77 KB
/
window_motor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
esphome:
name: zimmer3-motor-oberlicht
platform: ESP8266
board: nodemcuv2
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
password: "d875d5fcd8815050e872320309f5a382"
wifi:
ssid: "Sirion"
password: "4445558585"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Zimmer3-Motor-Oberlicht"
password: "0LlSB7aQiTwL"
captive_portal:
output:
- platform: gpio
id: 'win_1'
pin: D1
- platform: gpio
id: 'win_2'
pin: D2
switch:
- platform: output
name: "win1"
output: 'win_1'
id: win1
- platform: output
name: "win2"
output: 'win_2'
id: win2
cover:
- platform: template
name: "Window Control"
id: win_open
optimistic: true
open_action:
- switch.turn_off: win2
- switch.turn_on: win1
- delay: 360s
- switch.turn_off: win1
close_action:
- switch.turn_off: win1
- switch.turn_on: win2
- delay: 360s
- switch.turn_off: win2
stop_action:
- switch.turn_off: win1
- switch.turn_off: win2
binary_sensor:
- platform: gpio
pin: D3
name: "Window Control Button"
filters:
invert:
on_press:
then:
- lambda: |
if (id(win_open).state == cover::COVER_OPEN) {
if (id(win1).state){
// window is opening
id(win_open).stop();
} else {
// window is open and not moving
id(win_open).close();
}
} else {
if (id(win2).state){
// window is closing
id(win_open).stop();
} else {
// win is closed and not moving
id(win_open).open();
}
}