mirror of
https://github.com/esphome/esphome.git
synced 2025-10-25 21:23:53 +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;
|
ListEntitiesLightResponse msg;
|
||||||
auto traits = light->get_traits();
|
auto traits = light->get_traits();
|
||||||
const auto &color_modes_mask = traits.get_supported_color_modes();
|
const auto &color_modes_mask = traits.get_supported_color_modes();
|
||||||
msg.supported_color_modes.init(color_modes_mask.size());
|
msg.supported_color_modes = color_modes_mask.get_mask();
|
||||||
for (auto mode : color_modes_mask) {
|
|
||||||
msg.supported_color_modes.push_back(static_cast<enums::ColorMode>(mode));
|
|
||||||
}
|
|
||||||
if (traits.supports_color_capability(light::ColorCapability::COLOR_TEMPERATURE) ||
|
if (traits.supports_color_capability(light::ColorCapability::COLOR_TEMPERATURE) ||
|
||||||
traits.supports_color_capability(light::ColorCapability::COLD_WARM_WHITE)) {
|
traits.supports_color_capability(light::ColorCapability::COLD_WARM_WHITE)) {
|
||||||
msg.min_mireds = traits.get_min_mireds();
|
msg.min_mireds = traits.get_min_mireds();
|
||||||
|
|||||||
@@ -169,6 +169,9 @@ class ColorModeMask {
|
|||||||
constexpr Iterator begin() const { return Iterator(mask_, 0); }
|
constexpr Iterator begin() const { return Iterator(mask_, 0); }
|
||||||
constexpr Iterator end() const { return Iterator(mask_, 16); }
|
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:
|
private:
|
||||||
uint16_t mask_{0};
|
uint16_t mask_{0};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user