LED capabilities detected at runtime, rgb_order migrated to channel_colors

board_options_led_control.yaml called set_brightness() unconditionally, so
every board whose status LED is a `binary` light logged
"'esp_light': brightness not supported" on each state change. Only the RGB
setter was guarded, by the per-board `board_has_rgb` substitution.

Both setters are now guarded by what the light itself reports:

    led->get_traits().supports_color_capability(...)

- `board_has_rgb` removed from 21 board files: its only two readers were the
  two lines in board_options_led_control.yaml
- the runtime test reproduces the flag exactly on every board - the 15 boards
  declaring "true" all drive an addressable strip (esp32_rmt_led_strip, or
  spi_led_strip on T-Connect), the 6 declaring "false" all drive a binary
  light - so RGB rendering is unchanged and only the warning disappears
- a monochromatic LED now gets brightness without RGB, which a single boolean
  could not express

Also migrated 16 `rgb_order: GRB` to `channel_colors: GRB`, deprecated in
ESPHome and removed in 2027.3.0. Same value, no behaviour change.
This commit is contained in:
Sleeper85 committed 2026-11-08 23:08:33 +01:00
1 parent e78df61e6f
commit 1af8514863
22 files changed
+157 -188

No files matched your search

+3 -5
View File
@@ -1,5 +1,5 @@
# Updated : 2026.07.30
# Version : 1.3.4
# Updated : 2026.08.26
# Version : 1.3.5
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -40,8 +40,6 @@ substitutions:
mcp2515_cs_pin: '10'
# talk_pin
talk_pin: '10' # ESP32: 4, ESP32-S3: 8, ESP32-C3: 10
# LED
board_has_rgb: "true" # LED `RGB` flag to show functionality is available
# LOOP_TASK_STACK
loop_task_stack_size: "8192" # see LOOP_TASK_STACK.md before changing
@@ -79,7 +77,7 @@ light:
# Internal : only specifying an id without a name will implicitly set this to true.
- platform: esp32_rmt_led_strip
id: esp_light
rgb_order: GRB
channel_colors: GRB
pin: 8
num_leds: 1
# rmt_channel: 0
+86 -88
View File
@@ -1,88 +1,86 @@
# Updated : 2026.07.30
# Version : 1.1.6
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
# This YAML is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/gpl.html>.
# https://wiki.vdbx.io/product/flip_c3
substitutions:
board_chip: "ESP32-C3"
board_name: "FlipC3"
# Interfaces GPIOs
# uart_esp_1 # UART PORT
tx_pin_1: '21'
rx_pin_1: '20'
# uart_esp_2 # I2C PORT (Using Grove to STEMMA QT / Qwiic / JST SH Cable with 3.3 pulled out and tied to 5V)
tx_pin_2: '1'
rx_pin_2: '0'
# uart_esp_3
tx_pin_3: '2'
rx_pin_3: '3'
# canbus_esp32_can
tx_pin_4: '7'
rx_pin_4: '6'
# canbus_mcp2515
spi_mosi_pin: '2'
spi_miso_pin: '3'
spi_clk_pin: '4'
mcp2515_cs_pin: '5'
# LED
board_has_rgb: "true" # LED `RGB` flag to show functionality is available
# LOOP_TASK_STACK
loop_task_stack_size: "8192" # see LOOP_TASK_STACK.md before changing
packages:
device_base: !include ../base/device_base.yaml
device_base_wifi: !include ../base/device_base_wifi.yaml
led_control: !include board_options_led_control.yaml
esp32:
variant: esp32c3
flash_size: 4MB # ajust according to your ESP32-C3 version
framework:
type: esp-idf
advanced:
loop_task_stack_size: ${loop_task_stack_size}
esphome:
platformio_options:
board_build.flash_mode: dio # use Dual IO (dio) instead of Quad IO (qio) to prevent boot loop after flashing
wifi:
id: my_network
ssid: !secret wifi_ssid
password: !secret wifi_password
domain: !secret domain
reboot_timeout: 0s
logger:
baud_rate: 0 # frees the 3rd UART and avoids some bugs like "WK2168 with canbus" or "BLE client with RS485 modbus"
hardware_uart: USB_SERIAL_JTAG
light:
# https://esphome.io/components/light/esp32_rmt_led_strip
# ESP Light used to see the inverter heartbeat
# Internal : only specifying an id without a name will implicitly set this to true.
- platform: esp32_rmt_led_strip
id: esp_light
rgb_order: GRB
pin: 8
num_leds: 1
# rmt_channel: 0
chipset: ws2812
entity_category: config
default_transition_length: 0ms
# Updated : 2026.08.26
# Version : 1.1.7
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
# This YAML is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/gpl.html>.
# https://wiki.vdbx.io/product/flip_c3
substitutions:
board_chip: "ESP32-C3"
board_name: "FlipC3"
# Interfaces GPIOs
# uart_esp_1 # UART PORT
tx_pin_1: '21'
rx_pin_1: '20'
# uart_esp_2 # I2C PORT (Using Grove to STEMMA QT / Qwiic / JST SH Cable with 3.3 pulled out and tied to 5V)
tx_pin_2: '1'
rx_pin_2: '0'
# uart_esp_3
tx_pin_3: '2'
rx_pin_3: '3'
# canbus_esp32_can
tx_pin_4: '7'
rx_pin_4: '6'
# canbus_mcp2515
spi_mosi_pin: '2'
spi_miso_pin: '3'
spi_clk_pin: '4'
mcp2515_cs_pin: '5'
# LOOP_TASK_STACK
loop_task_stack_size: "8192" # see LOOP_TASK_STACK.md before changing
packages:
device_base: !include ../base/device_base.yaml
device_base_wifi: !include ../base/device_base_wifi.yaml
led_control: !include board_options_led_control.yaml
esp32:
variant: esp32c3
flash_size: 4MB # ajust according to your ESP32-C3 version
framework:
type: esp-idf
advanced:
loop_task_stack_size: ${loop_task_stack_size}
esphome:
platformio_options:
board_build.flash_mode: dio # use Dual IO (dio) instead of Quad IO (qio) to prevent boot loop after flashing
wifi:
id: my_network
ssid: !secret wifi_ssid
password: !secret wifi_password
domain: !secret domain
reboot_timeout: 0s
logger:
baud_rate: 0 # frees the 3rd UART and avoids some bugs like "WK2168 with canbus" or "BLE client with RS485 modbus"
hardware_uart: USB_SERIAL_JTAG
light:
# https://esphome.io/components/light/esp32_rmt_led_strip
# ESP Light used to see the inverter heartbeat
# Internal : only specifying an id without a name will implicitly set this to true.
- platform: esp32_rmt_led_strip
id: esp_light
channel_colors: GRB
pin: 8
num_leds: 1
# rmt_channel: 0
chipset: ws2812
entity_category: config
default_transition_length: 0ms
@@ -1,5 +1,5 @@
# Updated : 2026.07.30
# Version : 1.3.7
# Updated : 2026.08.26
# Version : 1.3.8
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -43,8 +43,6 @@ substitutions:
mcp2515_cs_pin: '39'
# talk_pin
talk_pin: '8'
# LED
board_has_rgb: "true" # LED `RGB` flag to show functionality is available
# LOOP_TASK_STACK
loop_task_stack_size: "8192" # see LOOP_TASK_STACK.md before changing
@@ -82,7 +80,7 @@ light:
# Internal : only specifying an id without a name will implicitly set this to true.
- platform: esp32_rmt_led_strip
id: esp_light
rgb_order: GRB
channel_colors: GRB
pin: 35
num_leds: 1
# rmt_channel: 0
@@ -1,5 +1,5 @@
# Updated : 2026.07.30
# Version : 1.3.4
# Updated : 2026.08.26
# Version : 1.3.5
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -40,8 +40,6 @@ substitutions:
mcp2515_cs_pin: '10'
# talk_pin
talk_pin: '8' # ESP32: 4, ESP32-S3: 8, ESP32-C3: 10
# LED
board_has_rgb: "true" # LED `RGB` flag to show functionality is available
# LOOP_TASK_STACK
loop_task_stack_size: "8192" # see LOOP_TASK_STACK.md before changing
@@ -81,7 +79,7 @@ light:
- platform: esp32_rmt_led_strip
id: esp_light
# name: ${name} ESP32 Light
rgb_order: GRB
channel_colors: GRB
pin: 38
num_leds: 1
# rmt_channel: 0
@@ -1,5 +1,5 @@
# Updated : 2026.07.30
# Version : 1.3.6
# Updated : 2026.08.26
# Version : 1.3.7
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -40,8 +40,6 @@ substitutions:
mcp2515_cs_pin: '10'
# talk_pin
talk_pin: '8' # ESP32: 4, ESP32-S3: 8, ESP32-C3: 10
# LED
board_has_rgb: "true" # LED `RGB` flag to show functionality is available
# LOOP_TASK_STACK
loop_task_stack_size: "8192" # see LOOP_TASK_STACK.md before changing
@@ -81,7 +79,7 @@ light:
- platform: esp32_rmt_led_strip
id: esp_light
# name: ${name} ESP32 Light
rgb_order: GRB
channel_colors: GRB
pin: 48
num_leds: 1
# rmt_channel: 0
@@ -1,5 +1,5 @@
# Updated : 2026.07.30
# Version : 1.3.7
# Updated : 2026.08.26
# Version : 1.3.8
# GitHub : https://github.com/SeByDocKy/pvbrain2
substitutions:
@@ -37,8 +37,6 @@ substitutions:
wk2168_i2c_scl: '40'
# One Wire bus for Dallas Temperature Sensor
one_wire_pin: '47'
# LED
board_has_rgb: "true" # LED `RGB` flag to show functionality is available
# LOOP_TASK_STACK
loop_task_stack_size: "8192" # see LOOP_TASK_STACK.md before changing
@@ -89,7 +87,7 @@ light:
- platform: esp32_rmt_led_strip
name: ${name}_on_board_light_io48
id: esp_light
rgb_order: GRB
channel_colors: GRB
pin: 48
num_leds: 1
# rmt_channel: 0
+3 -5
View File
@@ -1,5 +1,5 @@
# Updated : 2026.07.30
# Version : 1.1.5
# Updated : 2026.08.26
# Version : 1.1.6
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -42,8 +42,6 @@ substitutions:
spi_miso_pin: '12' # MISO
# talk_pin
talk_pin: '8' # ESP32: 4, ESP32-S3: 8, ESP32-C3: 10
# LED
board_has_rgb: "true" # LED `RGB` flag to show functionality is available
# LOOP_TASK_STACK
loop_task_stack_size: "8192" # see LOOP_TASK_STACK.md before changing
@@ -83,7 +81,7 @@ light:
- platform: esp32_rmt_led_strip
id: esp_light
# name: ${name} ESP32 Light
rgb_order: GRB
channel_colors: GRB
pin: 48
num_leds: 1
# rmt_channel: 0
+3 -4
View File
@@ -1,5 +1,5 @@
# Updated : 2026.07.30
# Version : 1.1.2
# Updated : 2026.08.26
# Version : 1.1.3
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -44,7 +44,6 @@ substitutions:
talk_pin: '8' # ESP32: 4, ESP32-S3: 8, ESP32-C3: 10
# LED
led_pin: '48' # ajust according to your board model
board_has_rgb: "true" # LED `RGB` flag to show functionality is available
# LOOP_TASK_STACK
loop_task_stack_size: "8192" # see LOOP_TASK_STACK.md before changing
@@ -84,7 +83,7 @@ light:
- platform: esp32_rmt_led_strip
id: esp_light
# name: ${name} ESP32 Light
rgb_order: GRB
channel_colors: GRB
pin: ${led_pin}
num_leds: 1
# rmt_channel: 0
@@ -1,5 +1,5 @@
# Updated : 2026.07.30
# Version : 1.1.3
# Updated : 2026.08.26
# Version : 1.1.4
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -39,7 +39,6 @@ substitutions:
lilygo_led_2: '3'
lilygo_led_3: '21'
lilygo_led_4: '41'
board_has_rgb: "true" # LED `RGB` flag to show functionality is available
# buttons
lilygo_btn_a: '39'
lilygo_btn_b: '40'
@@ -85,7 +84,7 @@ light:
# RGB LED 1
- platform: esp32_rmt_led_strip
id: esp_light_1
rgb_order: GRB
channel_colors: GRB
pin: ${lilygo_led_1}
num_leds: 1
chipset: ws2812
@@ -95,7 +94,7 @@ light:
# RGB LED 2
- platform: esp32_rmt_led_strip
id: esp_light_2
rgb_order: GRB
channel_colors: GRB
pin: ${lilygo_led_2}
num_leds: 1
chipset: ws2812
@@ -105,7 +104,7 @@ light:
# RGB LED 3
- platform: esp32_rmt_led_strip
id: esp_light_3
rgb_order: GRB
channel_colors: GRB
pin: ${lilygo_led_3}
num_leds: 1
chipset: ws2812
@@ -115,7 +114,7 @@ light:
# RGB LED 4
- platform: esp32_rmt_led_strip
id: esp_light_4
rgb_order: GRB
channel_colors: GRB
pin: ${lilygo_led_4}
num_leds: 1
chipset: ws2812
@@ -1,5 +1,5 @@
# Updated : 2026.07.30
# Version : 1.2.1
# Updated : 2026.08.26
# Version : 1.2.2
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -45,8 +45,6 @@ substitutions:
spi_miso_pin: "13"
spi_clk_pin: "12"
mcp2515_cs_pin: "14"
# LED
board_has_rgb: "true" # LED `RGB` flag to show functionality is available
# LOOP_TASK_STACK
loop_task_stack_size: "8192" # see LOOP_TASK_STACK.md before changing
@@ -1,5 +1,5 @@
# Updated : 2026.07.30
# Version : 1.1.5
# Updated : 2026.08.26
# Version : 1.1.6
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -42,8 +42,6 @@ substitutions:
spi_miso_pin: '13'
# talk_pin
talk_pin: '8' # ESP32: 4, ESP32-S3: 8, ESP32-C3: 10
# LED
board_has_rgb: "true" # LED `RGB` flag to show functionality is available
# LOOP_TASK_STACK
loop_task_stack_size: "8192" # see LOOP_TASK_STACK.md before changing
@@ -83,7 +81,7 @@ light:
- platform: esp32_rmt_led_strip
id: esp_light
# name: ${name} ESP32 Light
rgb_order: GRB
channel_colors: GRB
pin: 48
num_leds: 1
# rmt_channel: 0
+2 -4
View File
@@ -1,5 +1,5 @@
# Updated : 2026.07.30
# Version : 1.2.0
# Updated : 2026.08.26
# Version : 1.2.1
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -38,8 +38,6 @@ substitutions:
spi_miso_pin: '4'
spi_clk_pin: '5'
mcp2515_cs_pin: '6'
# LED
board_has_rgb: "false" # LED `RGB` flag to show functionality is available
# LOOP_TASK_STACK
loop_task_stack_size: "8192" # see LOOP_TASK_STACK.md before changing
+3 -5
View File
@@ -1,5 +1,5 @@
# Updated : 2026.07.30
# Version : 1.1.7
# Updated : 2026.08.26
# Version : 1.1.8
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -33,8 +33,6 @@ substitutions:
# canbus_esp32_can
tx_pin_4: '17'
rx_pin_4: '18'
# LED
board_has_rgb: "true" # LED `RGB` flag to show functionality is available
# LOOP_TASK_STACK
loop_task_stack_size: "8192" # see LOOP_TASK_STACK.md before changing
@@ -74,7 +72,7 @@ light:
- platform: esp32_rmt_led_strip
id: esp_light
# name: ${name} ESP32 Light
rgb_order: GRB
channel_colors: GRB
pin: 48
num_leds: 1
# rmt_channel: 0
+3 -5
View File
@@ -1,5 +1,5 @@
# Updated : 2026.07.30
# Version : 1.3.5
# Updated : 2026.08.26
# Version : 1.3.6
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -43,8 +43,6 @@ substitutions:
mcp2515_cs_pin: '25'
# talk_pin
talk_pin: '33'
# LED
board_has_rgb: "true" # LED `RGB` flag to show functionality is available
# LOOP_TASK_STACK
loop_task_stack_size: "8192" # see LOOP_TASK_STACK.md before changing
@@ -81,7 +79,7 @@ light:
# Internal : only specifying an id without a name will implicitly set this to true.
- platform: esp32_rmt_led_strip
id: esp_light
rgb_order: GRB
channel_colors: GRB
pin: 27
num_leds: 1
# rmt_channel: 0
+3 -5
View File
@@ -1,5 +1,5 @@
# Updated : 2026.07.30
# Version : 1.3.5
# Updated : 2026.08.26
# Version : 1.3.6
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -43,8 +43,6 @@ substitutions:
mcp2515_cs_pin: '25'
# talk_pin
talk_pin: '33'
# LED
board_has_rgb: "true" # LED `RGB` flag to show functionality is available
# LOOP_TASK_STACK
loop_task_stack_size: "8192" # see LOOP_TASK_STACK.md before changing
@@ -81,7 +79,7 @@ light:
# Internal : only specifying an id without a name will implicitly set this to true.
- platform: esp32_rmt_led_strip
id: esp_light
rgb_order: GRB
channel_colors: GRB
pin: 27
num_leds: 1
# rmt_channel: 0
+2 -4
View File
@@ -1,5 +1,5 @@
# Updated : 2026.07.30
# Version : 1.3.4
# Updated : 2026.08.26
# Version : 1.3.5
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -40,8 +40,6 @@ substitutions:
mcp2515_cs_pin: '15'
# talk_pin
talk_pin: '4' # ESP32: 4, ESP32-S3: 8, ESP32-C3: 10
# LED
board_has_rgb: "false" # LED `RGB` flag to show functionality is available
# LOOP_TASK_STACK
loop_task_stack_size: "8192" # see LOOP_TASK_STACK.md before changing
@@ -1,5 +1,5 @@
# Updated : 2026.07.30
# Version : 1.1.9
# Updated : 2026.08.26
# Version : 1.2.0
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -20,8 +20,6 @@
substitutions:
board_chip: "ESP32"
board_name: "espBerry 2-CH-CAN"
# LED
board_has_rgb: "false" # LED `RGB` flag to show functionality is available
# LOOP_TASK_STACK
loop_task_stack_size: "8192" # see LOOP_TASK_STACK.md before changing
+2 -4
View File
@@ -1,5 +1,5 @@
# Updated : 2026.07.30
# Version : 1.3.5
# Updated : 2026.08.26
# Version : 1.3.6
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -40,8 +40,6 @@ substitutions:
mcp2515_cs_pin: '15'
# talk_pin
talk_pin: '4' # ESP32: 4, ESP32-S3: 8, ESP32-C3: 10
# LED
board_has_rgb: "false" # LED `RGB` flag to show functionality is available
# LOOP_TASK_STACK
loop_task_stack_size: "8192" # see LOOP_TASK_STACK.md before changing
@@ -1,5 +1,5 @@
# Updated : 2026.07.30
# Version : 1.2.0
# Updated : 2026.08.26
# Version : 1.2.1
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -41,8 +41,6 @@ substitutions:
spi_miso_pin: '5'
spi_clk_pin: '18'
mcp2515_cs_pin: '25'
# LED
board_has_rgb: "true" # LED `RGB` flag to show functionality is available
# LOOP_TASK_STACK
loop_task_stack_size: "8192" # see LOOP_TASK_STACK.md before changing
@@ -83,7 +81,7 @@ light:
# Internal : only specifying an id without a name will implicitly set this to true.
- platform: esp32_rmt_led_strip
id: esp_light
rgb_order: GRB
channel_colors: GRB
pin: 4
num_leds: 1
# rmt_channel: 0
+2 -4
View File
@@ -1,5 +1,5 @@
# Updated : 2026.07.30
# Version : 1.1.6
# Updated : 2026.08.26
# Version : 1.1.7
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -36,8 +36,6 @@ substitutions:
# canbus_esp32_can
tx_pin_4: '14' # to CAN transceiver CTX
rx_pin_4: '15' # to CAN transceiver CRX
# LED
board_has_rgb: "false" # LED `RGB` flag to show functionality is available
# LOOP_TASK_STACK
loop_task_stack_size: "8192" # see LOOP_TASK_STACK.md before changing
@@ -1,5 +1,5 @@
# Updated : 2026.07.30
# Version : 1.1.6
# Updated : 2026.08.26
# Version : 1.1.7
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -58,8 +58,6 @@ substitutions:
spi_miso_pin: '12'
spi_clk_pin: '14'
mcp2515_cs_pin: '15'
# LED
board_has_rgb: "false" # LED `RGB` flag to show functionality is available
# LOOP_TASK_STACK
loop_task_stack_size: "8192" # see LOOP_TASK_STACK.md before changing
+15 -6
View File
@@ -1,5 +1,5 @@
# Updated : 2026.02.03
# Version : 1.1.3
# Updated : 2026.08.26
# Version : 1.1.4
# GitHub : https://github.com/Sleeper85/esphome-yambms
# YamBMS ( Yet another multi-BMS Merging Solution )
@@ -199,6 +199,15 @@ interval:
auto *led = kv.first;
auto const &assigned_list = kv.second;
// Ask the light what it can actually do, rather than trusting a
// per-board flag. A `binary` light supports neither brightness nor
// RGB, a `monochromatic` one only brightness, an addressable strip
// both. Calling an unsupported setter is not fatal but logs a
// warning on every state change.
auto traits = led->get_traits();
bool has_brightness = traits.supports_color_capability(esphome::light::ColorCapability::BRIGHTNESS);
bool has_rgb = traits.supports_color_capability(esphome::light::ColorCapability::RGB);
// Filter assigned items to find how many active faults exist
int active_fault_count = 0;
for (auto &pair : assigned_list) {
@@ -352,8 +361,8 @@ interval:
bool need_update = !ctx.last_valid || (ctx.last_state != target_state);
if (!need_update && target_state) {
// Only compare when on
if (ctx.last_bri != target_bri) need_update = true;
if (${board_has_rgb}) {
if (has_brightness && ctx.last_bri != target_bri) need_update = true;
if (has_rgb) {
if (ctx.last_r != target_r || ctx.last_g != target_g || ctx.last_b != target_b) need_update = true;
}
}
@@ -363,8 +372,8 @@ interval:
auto call = led->make_call();
call.set_state(target_state);
if (target_state) {
call.set_brightness(target_bri);
if (${board_has_rgb}) call.set_rgb(target_r, target_g, target_b);
if (has_brightness) call.set_brightness(target_bri);
if (has_rgb) call.set_rgb(target_r, target_g, target_b);
}
call.perform();