1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-24 04:33:49 +01:00
This commit is contained in:
J. Nick Koston
2025-10-18 10:01:39 -10:00
parent c76e386a79
commit b01ab914f3
2 changed files with 4 additions and 4 deletions

View File

@@ -478,10 +478,7 @@ uint16_t APIConnection::try_send_light_info(EntityBase *entity, APIConnection *c
ListEntitiesLightResponse msg;
auto traits = light->get_traits();
const auto &color_modes_mask = traits.get_supported_color_modes();
msg.supported_color_modes.init(color_modes_mask.size());
for (auto mode : color_modes_mask) {
msg.supported_color_modes.push_back(static_cast<enums::ColorMode>(mode));
}
msg.supported_color_modes = color_modes_mask.get_mask();
if (traits.supports_color_capability(light::ColorCapability::COLOR_TEMPERATURE) ||
traits.supports_color_capability(light::ColorCapability::COLD_WARM_WHITE)) {
msg.min_mireds = traits.get_min_mireds();

View File

@@ -169,6 +169,9 @@ class ColorModeMask {
constexpr Iterator begin() const { return Iterator(mask_, 0); }
constexpr Iterator end() const { return Iterator(mask_, 16); }
/// Get the raw bitmask value for API encoding
constexpr uint16_t get_mask() const { return this->mask_; }
private:
uint16_t mask_{0};