/
Sonoff_iFAN03_buzzer.yaml
230 lines (207 loc) · 5.92 KB
/
Sonoff_iFAN03_buzzer.yaml
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
esphome:
name: fan_ifan03
platform: ESP8266
board: esp8285
includes:
- ifan03.h
wifi:
ssid: "SSID"
password: "PASSWORD"
ap:
ssid: "iFAN03"
password: "PASS"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
password: "PASS"
ota:
password: "PASS"
remote_receiver:
pin: GPIO3
binary_sensor:
- platform: gpio
id: button
pin:
number: GPIO0
on_press:
then:
- light.toggle: ifan03_light
- platform: remote_receiver
name: "Buzzer"
id: remote_buzzer
internal: true
raw:
code: [-207, 104, -103, 104, -104, 103, -104, 207, -104, 103, -104, 103, -104, 104, -103, 104, -103, 104, -104, 107, -721, 105, -206, 207, -518, 105, -931, 104, -104, 103, -725, 104, -104, 103, -725, 104, -104, 103, -207, 104, -414]
on_release:
then:
- switch.toggle: buzzer_dummy
- platform: remote_receiver
name: "Fan 0"
id: remote_0
raw:
code: [-207, 104, -103, 104, -104, 103, -104, 207, -104, 103, -104, 104, -103, 104, -104, 103, -104, 105, -102, 104, -725, 104, -311, 103, -518, 104, -933, 103, -104, 104, -725, 104, -932, 104, -207, 207, -519]
on_release:
then:
- fan.turn_off: ifan03_fan
internal: true
- platform: remote_receiver
id: remote_fan1
raw:
code: [-207, 104, -104, 103, -104, 104, -103, 207, -104, 104, -103, 104, -104, 103, -104, 104, -103, 104, -104, 103, -726, 103, -312, 103, -518, 104, -933, 103, -104, 104, -725, 104, -103, 104, -726, 103, -104, 311, -518]
on_release:
then:
- fan.turn_on:
id: ifan03_fan
speed: LOW
- if:
condition:
and:
- switch.is_on: buzzer_dummy
then:
- output.turn_on: buzzer
- delay: 50ms
- output.turn_off: buzzer
internal: true
- platform: remote_receiver
id: remote_fan2
raw:
code: [-208, 103, -104, 104, -103, 104, -103, 208, -103, 104, -104, 103, -104, 104, -103, 104, -104, 103, -104, 103, -726, 104, -310, 104, -518, 104, -933, 103, -104, 104, -725, 104, -207, 104, -622, 103, -416, 102, -415]
on_release:
then:
- fan.turn_on:
id: ifan03_fan
speed: MEDIUM
- if:
condition:
and:
- switch.is_on: buzzer_dummy
then:
- output.turn_on: buzzer
- delay: 50ms
- output.turn_off: buzzer
- delay: 50ms
- output.turn_on: buzzer
- delay: 50ms
- output.turn_off: buzzer
internal: true
- platform: remote_receiver
id: remote_fan3
raw:
code: [-207, 104, -104, 103, -104, 104, -103, 208, -103, 104, -104, 103, -104, 104, -103, 104, -104, 103, -104, 103, -726, 104, -311, 104, -518, 103, -934, 103, -103, 104, -726, 103, -104, 207, -622, 104, -103, 104, -207, 104, -415]
on_release:
then:
- fan.turn_on:
id: ifan03_fan
speed: HIGH
- if:
condition:
and:
- switch.is_on: buzzer_dummy
then:
- output.turn_on: buzzer
- delay: 50ms
- output.turn_off: buzzer
- delay: 50ms
- output.turn_on: buzzer
- delay: 50ms
- output.turn_off: buzzer
- delay: 50ms
- output.turn_on: buzzer
- delay: 50ms
- output.turn_off: buzzer
internal: true
- platform: remote_receiver
id: remote_light
raw:
code: [-207, 104, -103, 104, -104, 103, -104, 207, -104, 103, -104, 104, -103, 104, -103, 104, -104, 103, -104, 104, -725, 104, -311, 103, -518, 104, -933, 103, -104, 103, -726, 103, -311, 104, -518, 104, -207, 104, -103, 104, -414]
on_release:
then:
- light.toggle: ifan03_light
output:
- platform: custom
type: float
outputs:
id: fanoutput
lambda: |-
auto ifan03_fan = new IFan03Output();
App.register_component(ifan03_fan);
return {ifan03_fan};
- platform: gpio
pin: GPIO9
id: relay_light
inverted: true
- platform: gpio
pin: GPIO10
id: buzzer
inverted: true
light:
- platform: binary
name: "iFan03 Light"
output: relay_light
id: ifan03_light
switch:
- platform: template
id: buzzer_dummy
name: "Buzzer"
optimistic: True
- platform: template
id: update_fan_speed
optimistic: True
turn_on_action:
then:
- delay: 200ms
- if:
condition:
and:
- switch.is_off: relay_fan1
- switch.is_off: relay_fan2
- switch.is_off: relay_fan3
then:
- fan.turn_off: ifan03_fan
- if:
condition:
and:
- switch.is_on: relay_fan1
- switch.is_off: relay_fan2
- switch.is_off: relay_fan3
then:
- fan.turn_on:
id: ifan03_fan
speed: LOW
- if:
condition:
and:
- switch.is_off: relay_fan1
- switch.is_on: relay_fan2
- switch.is_off: relay_fan3
then:
- fan.turn_on:
id: ifan03_fan
speed: MEDIUM
- if:
condition:
and:
- switch.is_off: relay_fan1
- switch.is_off: relay_fan2
- switch.is_on: relay_fan3
then:
- fan.turn_on:
id: ifan03_fan
speed: HIGH
- switch.turn_off: update_fan_speed
- platform: gpio
pin: GPIO14
id: relay_fan1
- platform: gpio
pin: GPIO12
id: relay_fan2
- platform: gpio
pin: GPIO15
id: relay_fan3
fan:
- platform: speed
output: fanoutput
id: ifan03_fan
name: "iFan03 Fan"