mirror of
https://github.com/esphome/esphome.git
synced 2025-10-24 04:33:49 +01:00
tweak
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user