116 lines
2.5 KiB
YAML
116 lines
2.5 KiB
YAML
#https://github.com/mmakaay/esphome-xiaomi_bslamp2/blob/dev/packages/core-dev.yaml
|
|
esp32:
|
|
board: esp32doit-devkit-v1
|
|
framework:
|
|
type: esp-idf
|
|
sdkconfig_options:
|
|
CONFIG_FREERTOS_UNICORE: y
|
|
advanced:
|
|
ignore_efuse_custom_mac: true
|
|
ignore_efuse_mac_crc: true
|
|
|
|
external_components:
|
|
- source:
|
|
type: local
|
|
path: ../components/xiaomi_bslamp2
|
|
|
|
ota:
|
|
on_begin:
|
|
then:
|
|
- light.disco_on:
|
|
id: my_light
|
|
red: 0%
|
|
green: 0%
|
|
blue: 100%
|
|
brightness: 2%
|
|
transition_length: 0s
|
|
|
|
on_progress:
|
|
then:
|
|
- front_panel.set_level: !lambda return (x / 100.0f);
|
|
- front_panel.update_leds:
|
|
|
|
on_end:
|
|
then:
|
|
- light.disco_on:
|
|
id: my_light
|
|
red: 0%
|
|
green: 100%
|
|
blue: 0%
|
|
brightness: 2%
|
|
transition_length: 0s
|
|
|
|
on_error:
|
|
then:
|
|
- light.disco_on:
|
|
id: my_light
|
|
red: 100%
|
|
green: 0%
|
|
blue: 0%
|
|
brightness: 2%
|
|
- delay: 1s
|
|
- light.disco_off:
|
|
id: my_light
|
|
|
|
# ----------------------------------------------------------------------
|
|
# Hardware setup
|
|
# ----------------------------------------------------------------------
|
|
|
|
i2c:
|
|
id: front_panel_i2c
|
|
sda: GPIO21
|
|
scl: GPIO19
|
|
scan: true
|
|
|
|
output:
|
|
- platform: ledc
|
|
id: output_red
|
|
pin: GPIO13
|
|
frequency: 3000
|
|
channel: 0
|
|
- platform: ledc
|
|
id: output_green
|
|
pin: GPIO14
|
|
frequency: 3000
|
|
channel: 1
|
|
- platform: ledc
|
|
id: output_blue
|
|
pin:
|
|
number: GPIO5
|
|
ignore_strapping_warning: true
|
|
frequency: 3000
|
|
channel: 2
|
|
- platform: ledc
|
|
id: output_white
|
|
pin:
|
|
number: GPIO12
|
|
ignore_strapping_warning: true
|
|
frequency: 10000
|
|
channel: 4
|
|
- platform: gpio
|
|
id: output_master1
|
|
pin: GPIO33
|
|
- platform: gpio
|
|
id: output_master2
|
|
pin:
|
|
number: GPIO4
|
|
mode: OUTPUT
|
|
# This float output can be used to control the front panel illumination +
|
|
# level indicator LEDs. Value 0.0 turns off the illumination. Other values
|
|
# (up to 1.0) turn on the illumination and set the level indicator to the
|
|
# requested level.
|
|
- platform: xiaomi_bslamp2
|
|
id: my_front_panel_illumination
|
|
|
|
xiaomi_bslamp2:
|
|
light:
|
|
red: output_red
|
|
green: output_green
|
|
blue: output_blue
|
|
white: output_white
|
|
master1: output_master1
|
|
master2: output_master2
|
|
front_panel:
|
|
i2c: front_panel_i2c
|
|
address: 0x2C
|
|
trigger_pin: GPIO16 |