Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mi/Xiaomi Desklamps: fix ignore_efuse_custom_mac, update component usage #997

Merged
merged 1 commit into from
Feb 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 35 additions & 18 deletions src/docs/devices/Mi-Desklamp-1S/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ board: esp32

```yaml
substitutions:
friendly_name: Mi Desk Lamp 1S Room
device_name: mi-desklamp-1s-room
friendly_name: Mi Desk Lamp 1S
device_name: mi-desklamp-1s

# Basic Config
esphome:
name: ${device_name}
friendly_name: ${devicename_friendly}
comment: ${friendly_name}

esp32:
Expand All @@ -24,35 +25,39 @@ esp32:
CONFIG_FREERTOS_UNICORE: y
advanced:
ignore_efuse_mac_crc: true
# See https://github.com/esphome/issues/issues/6333
ignore_efuse_custom_mac: true

# WiFi connection
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: on
ap:
ssid: ${device_name}
password: !secret ap_password
ap_timeout: 1min

# Unavailable for esp-idf https://github.com/esphome/feature-requests/issues/1649
# captive_portal:

# Enable logging
logger:

# Enable captive portal (fallback AP)
captive_portal:

# Enable Home Assistant API
api:
reboot_timeout: 0s
encryption:
key: !secret encryption_key

# Enable over-the-air updates
ota:
password: !secret ota_password
- platform: esphome
password: !secret ota_password

# Unavailable for esp-idf https://github.com/esphome/feature-requests/issues/1649
# Enable Web server
# web_server:
# port: 80
web_server:
port: 80

# Sync time with Home Assistant
time:
Expand All @@ -62,21 +67,28 @@ time:
# Text sensors with general information
text_sensor:
- platform: version
name: ${friendly_name} Version
name: "Version"
icon: mdi:cube-outline

- platform: wifi_info
ip_address:
name: ${friendly_name} IP Address
name: "IP Address"
icon: mdi:lan

sensor:
# Uptime sensor
- platform: uptime
name: ${friendly_name} Uptime
name: "Uptime"
update_interval: 60s
icon: mdi:clock-outline

# WiFi Signal sensor
- platform: wifi_signal
name: ${friendly_name} Wifi Signal
name: "WiFi Signal"
update_interval: 60s
icon: mdi:wifi

# Mi Desk Lamp 1S Config
# Knob
- platform: rotary_encoder
id: rotation
pin_a: GPIO27
Expand Down Expand Up @@ -110,6 +122,7 @@ sensor:
value: 0

binary_sensor:
# Knob push-button
- platform: gpio
id: button
pin:
Expand All @@ -121,13 +134,16 @@ binary_sensor:
- light.toggle:
id: light1
transition_length: 0.2s
filters:
- delayed_off: 5ms

output:
- platform: ledc
pin: GPIO2
id: output_cw
frequency: 40000Hz
power_supply: power
frequency: 40000Hz

- platform: ledc
pin: GPIO4
id: output_ww
Expand All @@ -143,13 +159,14 @@ power_supply:
light:
- platform: cwww
id: light1
name: "Light"
default_transition_length: 0s
constant_brightness: true
name: "${friendly_name} Light"
cold_white: output_cw
warm_white: output_ww
cold_white_color_temperature: 4800 K
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
restore_mode: ALWAYS_ON
# 2500k is the original value of the lamp. To correct binning for 2700k to look more like 2700k use 2650k instead
warm_white_color_temperature: 2500 K
restore_mode: RESTORE_DEFAULT_OFF
gamma_correct: 0
```
66 changes: 61 additions & 5 deletions src/docs/devices/Mi-Desklamp-Pro/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,15 @@ python.exe -m esptool -b 115200 --port COM3 read_flash 0x00000 0x400000 your/fol
## Recommended Config

```yaml
substitutions:
friendly_name: Mi Desk Lamp Pro
device_name: mi-desklamp-pro

# Basic Config
esphome:
name: midesklamppro
name: ${device_name}
friendly_name: ${devicename_friendly}
comment: ${friendly_name}

esp32:
board: esp32doit-devkit-v1
Expand All @@ -59,23 +66,69 @@ esp32:
CONFIG_FREERTOS_UNICORE: y
advanced:
ignore_efuse_mac_crc: true
# See https://github.com/esphome/issues/issues/6333
ignore_efuse_custom_mac: true

wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: on
ap:
ssid: ${device_name}
password: !secret ap_password
ap_timeout: 1min

# Enable logging
logger:

# Enable captive portal (fallback AP)
captive_portal:

# Enable Home Assistant API
api:
reboot_timeout: 0s
encryption:
key: !secret encryption_key

# Enable over-the-air updates
ota:
password: !secret password
- platform: esphome
password: !secret ota_password

# Enable Web server
web_server:
port: 80

# Sync time with Home Assistant
time:
- platform: homeassistant
id: homeassistant_time

# Text sensors with general information
text_sensor:
- platform: version
name: "Version"
icon: mdi:cube-outline

- platform: wifi_info
ip_address:
name: "IP Address"
icon: mdi:lan

sensor:
# Uptime sensor
- platform: uptime
name: "Uptime"
update_interval: 60s
icon: mdi:clock-outline

# WiFi Signal sensor
- platform: wifi_signal
name: "WiFi Signal"
update_interval: 60s
icon: mdi:wifi

# Knob
- platform: rotary_encoder
id: rotation
pin_a: GPIO26
Expand Down Expand Up @@ -109,6 +162,7 @@ sensor:
value: 0

binary_sensor:
# Knob push-button
- platform: gpio
id: button
pin:
Expand All @@ -119,7 +173,7 @@ binary_sensor:
then:
- light.toggle:
id: light1
transition_length: 0.5s
transition_length: 0.2s
filters:
- delayed_off: 5ms

Expand Down Expand Up @@ -148,6 +202,7 @@ output:
id: output_cw
power_supply: power
frequency: 100000Hz

- platform: ledc
pin: GPIO4
id: output_ww
Expand All @@ -163,13 +218,14 @@ power_supply:
light:
- platform: cwww
id: light1
name: "Mi Desk Lamp Pro"
name: "Light"
default_transition_length: 0s
constant_brightness: true
cold_white: output_cw
warm_white: output_ww
cold_white_color_temperature: 4800 K
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
# 2500k is the original value of the lamp. To correct binning for 2700k to look more like 2700k use 2650k instead
warm_white_color_temperature: 2500 K
restore_mode: RESTORE_DEFAULT_OFF
gamma_correct: 1
```
Loading