Skip to content

Instantly share code, notes, and snippets.

@vooon
Created November 6, 2021 12:04
Show Gist options
  • Save vooon/47469aad914449f9b24f02b5a586f735 to your computer and use it in GitHub Desktop.
Save vooon/47469aad914449f9b24f02b5a586f735 to your computer and use it in GitHub Desktop.
# Config for Xiaomi MJXDD01YL Ceiling lamp
# modified to have esp32 instead of mediatek chip.
#
# Based on: https://github.com/syssi/esphome-yeelight-ceiling-light
# See: https://github.com/syssi/esphome-yeelight-ceiling-light/issues/10
---
substitutions:
uname: Room2 Ceiling Light
device_name: room2-ceiling-light
friendly_name: $uname
device_description: "Room2 Ceiling Lamp"
esphome:
name: '${device_name}'
comment: '${device_description}'
project:
name: "vooon.mjxdd01yl_lamp"
version: "1.0.0"
on_boot:
- script.execute: power_on_scr
esp32:
# board: esp32doit-devkit-v1
board: ttgo-t7-v13-mini32
framework:
type: esp-idf
version: recommended
# sdkconfig_options:
# CONFIG_FREERTOS_UNICORE: y
# advanced:
# ignore_efuse_mac_crc: true
wifi:
networks: !secret wifi_networks
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "${uname} Fallback"
password: !secret wifi_ap_passwd
ota:
password: !secret ota_password
# Enable logging
logger:
# debug:
# Enable Home Assistant API
api:
id: api_apiserver
password: !secret api_password
reboot_timeout: 5min
# web_server:
# auth:
# username: admin
# password: !secret web_password
# prometheus:
preferences:
# id: preferences
flash_write_interval: 60s
esp32_ble_tracker:
id: ble_tracker
scan_parameters:
# interval: 100ms
# window: 99ms
duration: 5min
active: false
time:
- platform: homeassistant
id: esp_time
- platform: sntp
id: ntp_time
timezone: Europe/Moscow
power_supply:
- id: power_supply1
pin: GPIO22
output:
- platform: ledc
pin: GPIO19
id: output_warm
frequency: "2441Hz"
# min_power: 0.14
max_power: 0.50
power_supply: power_supply1
- platform: ledc
pin: GPIO23
id: output_cold
frequency: "2441Hz"
# min_power: 0.20
max_power: 0.88
power_supply: power_supply1
- platform: ledc
pin: GPIO18
id: output_nightlight
frequency: "19531Hz"
# min_power: 0.10
max_power: 1.00
power_supply: power_supply1
text_sensor:
- platform: wifi_info
ip_address:
name: "${friendly_name} - IP Address"
icon: mdi:wifi
ssid:
name: "${friendly_name} - Connected SSID"
icon: mdi:wifi-strength-2
bssid:
name: "${friendly_name} - BSSID"
- platform: version
hide_timestamp: true
name: "${friendly_name} - ESPHome Version"
- platform: ble_scanner
name: "${friendly_name} - BLE Scanner"
binary_sensor:
- platform: status
name: "$uname - Connected"
sensor:
- platform: wifi_signal
name: "$uname - WiFi Signal"
update_interval: 10s
- platform: uptime
name: "$uname - Uptime"
light:
- platform: monochromatic
name: "${uname} - Night Light"
id: night_light
output: output_nightlight
gamma_correct: 0
on_turn_on:
- light.turn_off: ceiling_light
- platform: cwww
name: "${uname} - Ceiling Light"
id: ceiling_light
cold_white: output_cold
warm_white: output_warm
cold_white_color_temperature: 6000 K
warm_white_color_temperature: 2700 K
constant_brightness: true
gamma_correct: 0
restore_mode: RESTORE_INVERTED_DEFAULT_ON
on_turn_on:
- light.turn_off: night_light
effects:
- random:
- pulse:
- strobe:
- flicker:
switch:
- platform: restart
name: "$uname - Reboot"
script:
- id: power_on_scr
then:
- logger.log:
level: INFO
format: "Power is ON!"
# - light.turn_on: ceiling_light
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment