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
| substitutions:
device_name: milight
device_description: EspHome versie van milight controll
device_id: '0x1F4D'
friendly_name1: Ledstrip links
icon1: 'mdi:led-strip-variant'
friendly_name2: TV ledstrip
icon2: 'mdi:led-strip-variant'
friendly_name3: Kast ledstrip
icon3: 'mdi:led-strip-variant'
friendly_name4: Eettafel lamp
icon4: 'mdi:ceiling-light-multiple'
esphome:
name: $device_name
comment: "${device_description}"
libraries:
- milight=https://github.com/hencou/esphome-milight
- nrf24/RF24
project:
name: xtraa.milight
version: "1.0"
external_components:
- source: github://hencou/esphome_components
components: mi
esp8266:
board: d1_mini
# Enable logging
logger:
level: DEBUG
web_server:
port: 80
# Enable Home Assistant API
api:
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: true
mi:
ce_pin: D0 #required, default: 4
csn_pin: D8 #required, default: 15
reset_pin: 0 #optional, default: 0, only needed with LT8900 radio
radio_interface_type: nrf24 #optional, default: nrf24, possible values: nrf24,lt8900
packet_repeats: 50 #optional, default: 50
listen_repeats: 20 #optional, default: 20
state_flush_interval: 5000 #optional, default: 10000
packet_repeat_throttle_threshold: 200 #optional, default: 200
packet_repeat_throttle_sensitivity: 0 #optional, default: 0
packet_repeat_minimum: 3 #optional, default: 3
enable_automatic_mode_switching: false #optional, default: false
rf24_power_level: MAX #optional, default: MAX, possible values: MIN, LOW, HIGH, MAX
rf24_listen_channel: LOW #optional, default: LOW, possible values: LOW, MID, HIGH
packet_repeats_per_loop: 10 #optional, default: 10
rf24_channels: #optional, 1-3 values required when used, default: LOW-MID-HIGH, possible values: LOW, MID, HIGH
- LOW
- MID
- HIGH
on_command_received: #optional, useful to send remote commands to HA and process them further there in automations
- homeassistant.event:
event: esphome.mi_command_received
data:
device_id: !lambda 'return format_hex(data.device_id);'
group_id: !lambda 'return data.group_id;'
remote_type: !lambda 'return data.remote_type.c_str();'
command: !lambda 'return data.command.c_str();'
light:
- platform: mi #required
id: milight1 #required
name: ${friendly_name1} #required
device_id: ${device_id} #required, hexadacimal value of MiLight id
group_id: 1 #required, 1-4 or 1-8, depending on remote type
remote_type: rgb_cct #required, possible values: rgb_cct, rgb, cct, rgbw, fut089, fut091, fut020
default_transition_length: 0s
icon: ${icon1}
disabled_by_default: true
- platform: mi #required
id: milight2 #required
name: ${friendly_name2} #required
device_id: ${device_id} #required, hexadacimal value of MiLight id
group_id: 2 #required, 1-4 or 1-8, depending on remote type
remote_type: rgbw #required, possible values: rgb_cct, rgb, cct, rgbw, fut089, fut091, fut020
default_transition_length: 0s
icon: ${icon2}
disabled_by_default: true
- platform: mi #required
id: milight3 #required
name: ${friendly_name3} #required
device_id: ${device_id} #required, hexadacimal value of MiLight id
group_id: 3 #required, 1-4 or 1-8, depending on remote type
remote_type: rgb_cct #required, possible values: rgb_cct, rgb, cct, rgbw, fut089, fut091, fut020
default_transition_length: 0s
icon: ${icon3}
- platform: mi #required
id: milight4 #required
name: ${friendly_name4} #required
device_id: ${device_id} #required, hexadacimal value of MiLight id
group_id: 4 #required, 1-4 or 1-8, depending on remote type
remote_type: rgb_cct #required, possible values: rgb_cct, rgb, cct, rgbw, fut089, fut091, fut020
default_transition_length: 0s
icon: ${icon4}
# optional variables: all variables of ESPHome base light component
#button possbile since HA version 2021.12
button:
- platform: mi
id: pair1
name: ${friendly_name1} pair
device_id: ${device_id}
group_id: 1
remote_type: rgb_cct
command: pair
entity_category: config
- platform: mi
id: unpair1
name: ${friendly_name1} unpair
device_id: ${device_id}
group_id: 1
remote_type: rgb_cct
command: unpair
entity_category: config
- platform: mi
id: pair2
name: ${friendly_name2} pair
device_id: ${device_id}
group_id: 2
remote_type: rgb_cct
command: pair
entity_category: config
- platform: mi
id: unpair2
name: ${friendly_name2} unpair
device_id: ${device_id}
group_id: 2
remote_type: rgb_cct
command: unpair
entity_category: config
- platform: mi
id: pair3
name: ${friendly_name3} pair
device_id: ${device_id}
group_id: 3
remote_type: rgb_cct
command: pair
entity_category: config
- platform: mi
id: unpair3
name: ${friendly_name3} unpair
device_id: ${device_id}
group_id: 3
remote_type: rgb_cct
command: unpair
entity_category: config
- platform: mi
id: pair4
name: ${friendly_name4} pair
device_id: ${device_id}
group_id: 4
remote_type: rgb_cct
command: pair
entity_category: config
- platform: mi
id: unpair4
name: ${friendly_name4} unpair
device_id: ${device_id}
group_id: 4
remote_type: rgb_cct
command: unpair
entity_category: config
sensor:
- platform: uptime
name: "Milight Uptime"
text_sensor:
- platform: wifi_info
ip_address:
name: "Milight IP Address"
mac_address:
name: "Milight MAC adress"
- platform: version
name: "ESPHome Version"
hide_timestamp: true |