Skip to content

Commit 8bf9e7e

Browse files
authored
Mi/Xiaomi Desklamps: fix ignore_efuse_custom_mac, update component usage (#997)
1 parent fa7975a commit 8bf9e7e

File tree

2 files changed

+96
-23
lines changed

2 files changed

+96
-23
lines changed

src/docs/devices/Mi-Desklamp-1S/index.md

+35-18
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ board: esp32
88

99
```yaml
1010
substitutions:
11-
friendly_name: Mi Desk Lamp 1S Room
12-
device_name: mi-desklamp-1s-room
11+
friendly_name: Mi Desk Lamp 1S
12+
device_name: mi-desklamp-1s
1313

1414
# Basic Config
1515
esphome:
1616
name: ${device_name}
17+
friendly_name: ${devicename_friendly}
1718
comment: ${friendly_name}
1819

1920
esp32:
@@ -24,35 +25,39 @@ esp32:
2425
CONFIG_FREERTOS_UNICORE: y
2526
advanced:
2627
ignore_efuse_mac_crc: true
28+
# See https://github.com/esphome/issues/issues/6333
29+
ignore_efuse_custom_mac: true
2730

2831
# WiFi connection
2932
wifi:
3033
ssid: !secret wifi_ssid
3134
password: !secret wifi_password
35+
fast_connect: on
3236
ap:
3337
ssid: ${device_name}
3438
password: !secret ap_password
3539
ap_timeout: 1min
3640

37-
# Unavailable for esp-idf https://github.com/esphome/feature-requests/issues/1649
38-
# captive_portal:
39-
4041
# Enable logging
4142
logger:
4243

44+
# Enable captive portal (fallback AP)
45+
captive_portal:
46+
4347
# Enable Home Assistant API
4448
api:
49+
reboot_timeout: 0s
4550
encryption:
4651
key: !secret encryption_key
4752

4853
# Enable over-the-air updates
4954
ota:
50-
password: !secret ota_password
55+
- platform: esphome
56+
password: !secret ota_password
5157

52-
# Unavailable for esp-idf https://github.com/esphome/feature-requests/issues/1649
5358
# Enable Web server
54-
# web_server:
55-
# port: 80
59+
web_server:
60+
port: 80
5661

5762
# Sync time with Home Assistant
5863
time:
@@ -62,21 +67,28 @@ time:
6267
# Text sensors with general information
6368
text_sensor:
6469
- platform: version
65-
name: ${friendly_name} Version
70+
name: "Version"
71+
icon: mdi:cube-outline
72+
6673
- platform: wifi_info
6774
ip_address:
68-
name: ${friendly_name} IP Address
75+
name: "IP Address"
76+
icon: mdi:lan
6977

7078
sensor:
7179
# Uptime sensor
7280
- platform: uptime
73-
name: ${friendly_name} Uptime
81+
name: "Uptime"
82+
update_interval: 60s
83+
icon: mdi:clock-outline
84+
7485
# WiFi Signal sensor
7586
- platform: wifi_signal
76-
name: ${friendly_name} Wifi Signal
87+
name: "WiFi Signal"
7788
update_interval: 60s
89+
icon: mdi:wifi
7890

79-
# Mi Desk Lamp 1S Config
91+
# Knob
8092
- platform: rotary_encoder
8193
id: rotation
8294
pin_a: GPIO27
@@ -110,6 +122,7 @@ sensor:
110122
value: 0
111123

112124
binary_sensor:
125+
# Knob push-button
113126
- platform: gpio
114127
id: button
115128
pin:
@@ -121,13 +134,16 @@ binary_sensor:
121134
- light.toggle:
122135
id: light1
123136
transition_length: 0.2s
137+
filters:
138+
- delayed_off: 5ms
124139

125140
output:
126141
- platform: ledc
127142
pin: GPIO2
128143
id: output_cw
129-
frequency: 40000Hz
130144
power_supply: power
145+
frequency: 40000Hz
146+
131147
- platform: ledc
132148
pin: GPIO4
133149
id: output_ww
@@ -143,13 +159,14 @@ power_supply:
143159
light:
144160
- platform: cwww
145161
id: light1
162+
name: "Light"
146163
default_transition_length: 0s
147164
constant_brightness: true
148-
name: "${friendly_name} Light"
149165
cold_white: output_cw
150166
warm_white: output_ww
151167
cold_white_color_temperature: 4800 K
152-
warm_white_color_temperature: 2500 K #2500k is the original value of the lamp. To correct binning for 2700k to look more like 2700k use 2650k instead
153-
restore_mode: ALWAYS_ON
168+
# 2500k is the original value of the lamp. To correct binning for 2700k to look more like 2700k use 2650k instead
169+
warm_white_color_temperature: 2500 K
170+
restore_mode: RESTORE_DEFAULT_OFF
154171
gamma_correct: 0
155172
```

src/docs/devices/Mi-Desklamp-Pro/index.md

+61-5
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,15 @@ python.exe -m esptool -b 115200 --port COM3 read_flash 0x00000 0x400000 your/fol
4848
## Recommended Config
4949

5050
```yaml
51+
substitutions:
52+
friendly_name: Mi Desk Lamp Pro
53+
device_name: mi-desklamp-pro
54+
55+
# Basic Config
5156
esphome:
52-
name: midesklamppro
57+
name: ${device_name}
58+
friendly_name: ${devicename_friendly}
59+
comment: ${friendly_name}
5360

5461
esp32:
5562
board: esp32doit-devkit-v1
@@ -59,23 +66,69 @@ esp32:
5966
CONFIG_FREERTOS_UNICORE: y
6067
advanced:
6168
ignore_efuse_mac_crc: true
69+
# See https://github.com/esphome/issues/issues/6333
70+
ignore_efuse_custom_mac: true
6271

6372
wifi:
6473
ssid: !secret wifi_ssid
6574
password: !secret wifi_password
75+
fast_connect: on
76+
ap:
77+
ssid: ${device_name}
78+
password: !secret ap_password
79+
ap_timeout: 1min
6680

6781
# Enable logging
6882
logger:
6983

84+
# Enable captive portal (fallback AP)
85+
captive_portal:
86+
87+
# Enable Home Assistant API
7088
api:
7189
reboot_timeout: 0s
7290
encryption:
7391
key: !secret encryption_key
7492

93+
# Enable over-the-air updates
7594
ota:
76-
password: !secret password
95+
- platform: esphome
96+
password: !secret ota_password
97+
98+
# Enable Web server
99+
web_server:
100+
port: 80
101+
102+
# Sync time with Home Assistant
103+
time:
104+
- platform: homeassistant
105+
id: homeassistant_time
106+
107+
# Text sensors with general information
108+
text_sensor:
109+
- platform: version
110+
name: "Version"
111+
icon: mdi:cube-outline
112+
113+
- platform: wifi_info
114+
ip_address:
115+
name: "IP Address"
116+
icon: mdi:lan
77117

78118
sensor:
119+
# Uptime sensor
120+
- platform: uptime
121+
name: "Uptime"
122+
update_interval: 60s
123+
icon: mdi:clock-outline
124+
125+
# WiFi Signal sensor
126+
- platform: wifi_signal
127+
name: "WiFi Signal"
128+
update_interval: 60s
129+
icon: mdi:wifi
130+
131+
# Knob
79132
- platform: rotary_encoder
80133
id: rotation
81134
pin_a: GPIO26
@@ -109,6 +162,7 @@ sensor:
109162
value: 0
110163

111164
binary_sensor:
165+
# Knob push-button
112166
- platform: gpio
113167
id: button
114168
pin:
@@ -119,7 +173,7 @@ binary_sensor:
119173
then:
120174
- light.toggle:
121175
id: light1
122-
transition_length: 0.5s
176+
transition_length: 0.2s
123177
filters:
124178
- delayed_off: 5ms
125179

@@ -148,6 +202,7 @@ output:
148202
id: output_cw
149203
power_supply: power
150204
frequency: 100000Hz
205+
151206
- platform: ledc
152207
pin: GPIO4
153208
id: output_ww
@@ -163,13 +218,14 @@ power_supply:
163218
light:
164219
- platform: cwww
165220
id: light1
166-
name: "Mi Desk Lamp Pro"
221+
name: "Light"
167222
default_transition_length: 0s
168223
constant_brightness: true
169224
cold_white: output_cw
170225
warm_white: output_ww
171226
cold_white_color_temperature: 4800 K
172-
warm_white_color_temperature: 2500 K #2500k is the original value of the lamp. To correct binning for 2700k to look more like 2700k use 2650k instead
227+
# 2500k is the original value of the lamp. To correct binning for 2700k to look more like 2700k use 2650k instead
228+
warm_white_color_temperature: 2500 K
173229
restore_mode: RESTORE_DEFAULT_OFF
174230
gamma_correct: 1
175231
```

0 commit comments

Comments
 (0)