-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththree_speed_fan.yaml
126 lines (112 loc) · 2.81 KB
/
three_speed_fan.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
esphome:
name: three-speed-fan
platform: ESP8266
board: esp01_1m
wifi:
ssid: 'MYWIFI'
password: 'opensesame'
fast_connect: true
manual_ip:
static_ip: 192.168.1.100
gateway: 192.168.1.1
subnet: 255.255.255.0
ap:
ssid: "three-speed-fan"
password: "ap123456"
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: add_a_key_here
ota:
password: "ota123456"
captive_portal:
substitutions: #for the name of the fan to input below
name: Three Speed Fan
binary_sensor:
- platform: gpio
id: push_button
pin:
number: GPIO1
mode:
input: true
pullup: true
name: "Three Speed Fan Cycle"
filters:
- delayed_on: 150ms
- delayed_off: 150ms
on_press:
then:
- fan.cycle_speed: threespeedfan
switch:
- platform: gpio
internal: true
name: "${name} High Relay"
pin: GPIO14
inverted: false
icon: mdi:fan-speed-3
id: relay3
interlock: &interlock_group [relay1, relay2, relay3]
interlock_wait_time: 300ms
- platform: gpio
name: "${name} Medium Relay"
internal: true
pin: GPIO4
inverted: false
icon: mdi:fan-speed-2
id: relay2
interlock: *interlock_group
interlock_wait_time: 300ms
- platform: gpio
name: "${name} Low Relay"
internal: false
pin: GPIO5
inverted: false
icon: mdi:fan-speed-1
id: relay1
interlock: *interlock_group
interlock_wait_time: 300ms
output:
- platform: template
id: threespeedfan_1
type: float
write_action:
- if:
condition:
lambda: return ((state == 0));
then:
# action for off
- switch.turn_off: relay1
- switch.turn_off: relay2
- switch.turn_off: relay3
- if:
condition:
lambda: return ((state > 0) && (state < 0.4));
then:
# action for speed 1
- switch.turn_off: relay2
- switch.turn_off: relay3
- switch.turn_on: relay1
- if:
condition:
lambda: return ((state > 0.4) && (state < 0.7));
then:
# action for speed 2
- switch.turn_off: relay1
- switch.turn_off: relay3
- switch.turn_on: relay2
- if:
condition:
lambda: return ((state > 0.7));
then:
# action for speed 3
- switch.turn_off: relay1
- switch.turn_off: relay2
- switch.turn_on: relay3
fan:
- platform: speed
id: threespeedfan
output: threespeedfan_1
name: "Three Speed Fan"
speed_count: 3