-
Notifications
You must be signed in to change notification settings - Fork 0
/
ceiling-fan.yaml
108 lines (93 loc) · 3.95 KB
/
ceiling-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
# Part credits go to Sparky Dave
# https://community.home-assistant.io/u/sparkydave/summary
# https://community.home-assistant.io/t/esp-home-3-speed-fan-conversion/319552/8?
substitutions:
devicename: ceiling-fan
upper_devicename: Fan
ssid: myssid
defaultspeed: fanlow # < choose default fan speed when fan switch is turned on. fanlow, fanmed, fanhi
esphome:
name: $devicename
esp8266:
board: esp01_1m
wifi:
networks:
- ssid: $ssid
password: !secret wifi_password
power_save_mode: none
ap:
ssid: $upper_devicename
password: !secret wifi_password
web_server:
port: 80
logger:
api:
encryption:
key: !secret api_enc
ota:
- password: !secret ota_password
platform: esphome
captive_portal:
#remote_receiver:
# pin: GPIO04
# dump: raw
## - rc_switch
# tolerance: 25%
# filter: 5us
# idle: 4ms
# buffer_size: 1kb
remote_transmitter:
pin: GPIO01
# RF uses a 100% carrier signal
carrier_duty_percent: 100%
output:
- platform: template
id: ceiling_fan
type: float
write_action:
- if:
condition:
lambda: return ((state == 0));
then:
# action for off
- remote_transmitter.transmit_raw:
code: [224, -793, 693, -316, 692, -318, 618, -400, 189, -815, 190, -808, 195, -776, 736, -317, 206, -795, 695, -310, 197, -810, 192, -826, 191, -784, 232, -792, 200, -806, 198, -815, 202, -803, 201, -802, 201, -790, 212, -815, 204, -799, 715, -272, 731, -275, 232, -785, 221, -794, 212, -777, 736, -269, 767, -235, 779, -226, 752, -263, 249, -749, 750, -271, 235]
repeat: 5
- if:
condition:
lambda: return ((state > 0) && (state < 0.4));
then:
# action for speed 1
- remote_transmitter.transmit_raw:
code: [254, -750, 753, -252, 753, -254, 750, -269, 250, -753, 251, -752, 252, -752, 749, -269, 251, -749, 753, -256, 250, -753, 251, -766, 250, -748, 260, -749, 250, -753, 250, -766, 251, -749, 254, -753, 251, -753, 250, -766, 251, -751, 253, -751, 751, -256, 250, -765, 252, -752, 750, -254, 257, -747, 254, -765, 750, -254, 750, -255, 751, -254, 252, -757, 247]
repeat: 5
- if:
condition:
lambda: return ((state > 0.4) && (state < 0.7));
then:
# action for speed 2
- remote_transmitter.transmit_raw:
code: [211, -774, 726, -300, 708, -300, 703, -311, 208, -797, 207, -795, 207, -798, 703, -320, 201, -796, 706, -297, 207, -797, 210, -809, 205, -792, 211, -789, 214, -775, 230, -782, 236, -784, 216, -786, 216, -786, 223, -792, 225, -790, 207, -794, 707, -301, 704, -316, 205, -795, 706, -301, 705, -301, 204, -808, 720, -261, 748, -259, 248, -764, 727, -281, 224]
repeat: 5
- if:
condition:
lambda: return ((state > 0.7));
then:
# action for speed 3
- remote_transmitter.transmit_raw:
code: [243, -761, 741, -264, 741, -265, 740, -279, 240, -763, 241, -762, 241, -762, 740, -280, 238, -764, 739, -267, 239, -764, 239, -777, 239, -764, 241, -762, 241, -763, 240, -769, 247, -763, 241, -762, 241, -763, 241, -775, 740, -266, 239, -764, 240, -763, 739, -280, 239, -760, 745, -260, 247, -757, 755, -262, 251, -750, 749, -261, 243, -761, 241, -768, 237]
repeat: 5
button:
- platform: template
name: Big Light
id: light
on_press:
- remote_transmitter.transmit_raw:
code: [246, -759, 743, -260, 745, -261, 744, -275, 244, -759, 244, -753, 260, -743, 757, -268, 244, -759, 742, -264, 243, -756, 256, -758, 254, -750, 250, -759, 243, -760, 244, -772, 244, -759, 244, -760, 243, -760, 244, -771, 744, -262, 246, -757, 246, -757, 247, -769, 247, -751, 760, -245, 759, -246, 759, -261, 253, -754, 750, -255, 749, -258, 744, -265, 244]
repeat: 5
fan:
- platform: speed
id: ceilingfan
output: ceiling_fan
name: "Ceiling Fan"
speed_count: 3