This tutorial will introduce how to use the Unit Key single button input unit with the CoreS3 main controller and integrate it into Home Assistant to achieve button state acquisition and light control.
CONTINUE.
New Device Setup to enter the device creation wizard.
NEXT.
ESP32S3.
SKIP to skip the encryption key setup.
EDIT to enter the YAML configuration page and customize device functionality.
board is set to m5stack-cores3 and framework is set to arduino for the Unit Key to function properly.Add the Binary Sensor component to obtain button state.
binary_sensor:
- platform: gpio
name: "Button"
id: unit_key_button
pin:
number: GPIO8 # CoreS3 PORT.B, please adjust according to the actual connected GPIO pin
mode:
input: true
pullup: true
inverted: true
filters:
- delayed_on: 10ms
- delayed_off: 10ms
on_press:
then:
- logger.log: "Pressed"
- light.toggle: unit_key_led
on_multi_click:
- timing:
- ON for at least 1s
then:
- logger.log: "Hold"
- light.turn_off: unit_key_led Add the Light component to control the backlight RGB LED.
light:
- platform: neopixelbus
name: "LED"
id: unit_key_led
type: GRB
variant: SK6812
pin: GPIO9 # CoreS3 PORT.B, please adjust according to the actual connected GPIO pin
num_leds: 1
method:
type: esp32_rmt
channel: 0
default_transition_length: 200ms
restore_mode: RESTORE_DEFAULT_OFF SAVE in the upper right corner to save the configuration, then click INSTALL.
Manual Download in the pop-up window.
Download and select Factory format (Previously Modern), then save the firmware locally.
CONNECT.
INSTALL.
Settings > Devices & Services in sequence to enter the integration management page.
Discovered area, click CONFIGURE and follow the wizard to complete the configuration.
