感謝Mini 以及Simon大大提供方式
解決雙鍵右鍵指示燈不亮的問題
並加上指示燈背光微亮設定
以下為個人常用的設定分享
單鍵
substitutions:
devicename: m5-1button
upper_devicename: "M5 1Button"
friendly_name: M5 1Button
esphome:
name: $devicename
on_boot:
then:
- light.dim_relative:
id: backlight
relative_brightness: 20%
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
# password: "your-ota-password"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "M5-1Button"
password: "87654321"
web_server:
captive_portal:
# Example configuration entry
text_sensor:
- platform: wifi_info
ip_address:
name: IP Address
ssid:
name: Connected SSID
mac_address:
name: Mac Address
sensor:
# Uptime
- platform: uptime
name: ${friendly_name} Uptime
# WiFi Signal
- platform: wifi_signal
name: ${friendly_name} WiFi Signal
update_interval: 60s
status_led:
pin:
number: GPIO5
inverted: true
switch:
- platform: gpio
id: relay_1
name: "Button"
pin: 23
on_turn_on:
- output.turn_on: buttonlight
on_turn_off:
- output.turn_off: buttonlight
output:
- platform: ledc
pin: 18
frequency: 1000 Hz
id: backlight_ledc
- platform: gpio
id: buttonlight
pin: 19
light:
- platform: monochromatic
output: backlight_ledc
name: "Back Light"
id: backlight
binary_sensor:
- platform: gpio
id: button
pin:
number: 0
mode: INPUT_PULLUP
on_press:
- switch.toggle: relay_1
雙鍵
substitutions:
devicename: m5-2button
upper_devicename: "M5 2Button"
friendly_name: M5 2Button
esphome:
name: $devicename
on_boot:
then:
- light.dim_relative:
id: backlight
relative_brightness: 30%
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
# password: "your-ota-password"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "M5-2Button"
password: "87654321"
web_server:
captive_portal:
# Example configuration entry
text_sensor:
- platform: wifi_info
ip_address:
name: IP Address
ssid:
name: Connected SSID
mac_address:
name: Mac Address
sensor:
# Uptime
- platform: uptime
name: ${friendly_name} Uptime
# WiFi Signal
- platform: wifi_signal
name: ${friendly_name} WiFi Signal
update_interval: 60s
status_led:
pin:
number: GPIO5
inverted: true
switch:
- platform: gpio
id: relay_1
name: "Button Left"
pin: 23
- platform: gpio
id: relay_2
pin: 19
name: "Button Right"
on_turn_on:
- output.turn_on: buttonlight_2
on_turn_off:
- output.turn_off: buttonlight_2
output:
- platform: ledc
pin: 18
frequency: 1000 Hz
id: backlight_ledc
- platform: gpio
id: buttonlight_2
pin: 22
light:
- platform: monochromatic
output: backlight_ledc
name: "Back Light"
id: backlight
binary_sensor:
- platform: gpio
id: left_button
pin:
number: 4
mode: INPUT_PULLUP
on_press:
- switch.toggle: relay_1
- platform: gpio
id: right_button
pin:
number: 15
mode: INPUT_PULLUP
on_press:
- switch.toggle: relay_2
三鍵
substitutions:
devicename: m5-3button
upper_devicename: "M5 3Button"
friendly_name: M5 3Button
esphome:
name: $devicename
on_boot:
then:
- light.dim_relative:
id: backlight
relative_brightness: 30%
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
# password: "your-ota-password"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "M5-3Button"
password: "87654321"
web_server:
captive_portal:
# Example configuration entry
text_sensor:
- platform: wifi_info
ip_address:
name: IP Address
ssid:
name: Connected SSID
mac_address:
name: Mac Address
sensor:
# Uptime
- platform: uptime
name: ${friendly_name} Uptime
# WiFi Signal
- platform: wifi_signal
name: ${friendly_name} WiFi Signal
update_interval: 60s
status_led:
pin:
number: GPIO5
inverted: true
switch:
- platform: gpio
id: relay_1
name: "Button Left"
pin: 23
- platform: gpio
id: relay_2
pin: 19
name: "Button Middle"
- platform: gpio
id: relay_3
pin: 22
name: "Button Right"
output:
- platform: ledc
pin: 18
frequency: 1000 Hz
id: backlight_ledc
light:
- platform: monochromatic
output: backlight_ledc
name: "Back Light"
id: backlight
binary_sensor:
- platform: gpio
id: left_button
pin:
number: 4
mode: INPUT_PULLUP
on_press:
- switch.toggle: relay_1
- platform: gpio
id: middle_button
pin:
number: 0
mode: INPUT_PULLUP
on_press:
- switch.toggle: relay_2
- platform: gpio
id: right_button
pin:
number: 15
mode: INPUT_PULLUP
on_press:
- switch.toggle: relay_3