This repository has been archived by the owner on Aug 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
d1_dimmer_rf_soldered.yaml
202 lines (181 loc) · 4.57 KB
/
d1_dimmer_rf_soldered.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
# Set variables such as the device's name and friendly name
# The devicename is used internally which the friendly name is shown in the user interface
substitutions:
devicename: d1_dimmer
friendly_name: Dimmer
esphome:
name: $devicename
platform: ESP8266
board: esp01_1m
# Include our custom code
includes:
- d1_dimmer_rf_soldered.h
# TODO: Set these as your own Wi-Fi credentials
wifi:
ssid: Jeff
password: !secret wifi_password
fast_connect: true
ap:
ssid: ESP-${devicename}
password: !secret fallback_password
captive_portal:
# TODO: Set these as your own web server credentials
web_server:
port: 80
auth:
username: !secret web_username
password: !secret web_password
# Make sure to disable serial logging as it will interfere with our serial connection
logger:
baud_rate: 0
# TODO: Set your own API credentials
api:
password: !secret api_password
# TODO: Set your own OTA credentials
ota:
password: !secret ota_password
safe_mode: True
# Uses the onboard LED as status indicator
status_led:
pin:
number: GPIO13
inverted: True
# Report basic device information like it's Wi-Fi signal strength and uptime
sensor:
- platform: wifi_signal
name: ${friendly_name} WiFi Signal
update_interval: 60s
- platform: uptime
name: ${friendly_name} Uptime
filters:
- lambda: return x / 60.0;
unit_of_measurement: minutes
# Basic switch to allow you to restart the device remotely
switch:
- platform: restart
name: ${friendly_name} Restart
# Create our remote reciever
# Thanks craigueh! https://github.com/esphome/feature-requests/issues/611#issuecomment-691723990
remote_receiver:
pin: 4
dump: rc_switch
filter: 4us
idle: 4ms
tolerance: 50
# Set codes for our remote reciever
# Thanks craigueh! https://github.com/esphome/feature-requests/issues/611#issuecomment-691723990
binary_sensor:
- platform: status
name: "Sonoff D1 Status"
# Button 1 turns the light on
- platform: remote_receiver
name: "Sonoff Remote Button 1"
internal: true
rc_switch_raw:
code: "100010101110101111101000"
protocol: 1
filters:
delayed_off: 1s
on_state:
then:
- light.turn_on:
id: main
# Button 2 turns the light off
- platform: remote_receiver
name: "Sonoff Remote Button 2"
internal: true
rc_switch_raw:
code: "100010101110101111101100"
protocol: 1
filters:
delayed_off: 1s
on_state:
then:
- light.turn_off:
id: main
# Button 3 turns the light on to 100%
- platform: remote_receiver
name: "Sonoff Remote Button 3"
internal: true
rc_switch_raw:
code: "100010101110101111100100"
protocol: 1
filters:
delayed_off: 1s
on_state:
then:
- light.turn_on:
id: main
brightness: 100%
# Button 4 turns the light on to 60%
- platform: remote_receiver
name: "Sonoff Remote Button 4"
internal: true
rc_switch_raw:
code: "100010101110101111101001"
protocol: 1
filters:
delayed_off: 1s
on_state:
then:
- light.turn_on:
id: main
brightness: 60%
# Button 5 turns the light on to 1%
- platform: remote_receiver
name: "Sonoff Remote Button 5"
internal: true
rc_switch_raw:
code: "100010101110101111100010"
protocol: 1
filters:
delayed_off: 1s
on_state:
then:
- light.turn_on:
id: main
brightness: 1%
# Button 6 turns the light on to 40%
- platform: remote_receiver
name: "Sonoff Remote Button 6"
internal: true
rc_switch_raw:
code: "100010101110101111100101"
protocol: 1
filters:
delayed_off: 1s
on_state:
then:
- light.turn_on:
id: main
brightness: 40%
# Button 7 currently does nothing
- platform: remote_receiver
name: "Sonoff Remote Button 7"
internal: true
rc_switch_raw:
code: "100010101110101111100001"
protocol: 1
filters:
delayed_off: 1s
# Button 8 currently does nothing
- platform: remote_receiver
name: "Sonoff Remote Button 8"
internal: true
rc_switch_raw:
code: "100010101110101111100011"
protocol: 1
filters:
delayed_off: 1s
# Define our custom light component
light:
- platform: custom
lambda: |-
auto dimmer_light = new Sonoff_D1_Dimmer();
App.register_component(dimmer_light);
return {dimmer_light};
lights:
- name: $friendly_name
id: main
restore_mode: RESTORE_DEFAULT_OFF
gamma_correct: 0