mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 09:17:46 +01:00
Expose WHITE/CWWW/RGBCT color modes over MQTT (#2231)
This commit is contained in:
parent
00aaf84c37
commit
f364788c03
1 changed files with 11 additions and 6 deletions
|
@ -38,18 +38,23 @@ void MQTTJSONLightComponent::send_discovery(JsonObject &root, mqtt::SendDiscover
|
||||||
|
|
||||||
root["color_mode"] = true;
|
root["color_mode"] = true;
|
||||||
JsonArray &color_modes = root.createNestedArray("supported_color_modes");
|
JsonArray &color_modes = root.createNestedArray("supported_color_modes");
|
||||||
if (traits.supports_color_mode(ColorMode::COLOR_TEMPERATURE))
|
if (traits.supports_color_mode(ColorMode::ON_OFF))
|
||||||
|
color_modes.add("onoff");
|
||||||
|
if (traits.supports_color_mode(ColorMode::BRIGHTNESS))
|
||||||
|
color_modes.add("brightness");
|
||||||
|
if (traits.supports_color_mode(ColorMode::WHITE))
|
||||||
|
color_modes.add("white");
|
||||||
|
if (traits.supports_color_mode(ColorMode::COLOR_TEMPERATURE) ||
|
||||||
|
traits.supports_color_mode(ColorMode::COLD_WARM_WHITE))
|
||||||
color_modes.add("color_temp");
|
color_modes.add("color_temp");
|
||||||
if (traits.supports_color_mode(ColorMode::RGB))
|
if (traits.supports_color_mode(ColorMode::RGB))
|
||||||
color_modes.add("rgb");
|
color_modes.add("rgb");
|
||||||
if (traits.supports_color_mode(ColorMode::RGB_WHITE))
|
if (traits.supports_color_mode(ColorMode::RGB_WHITE) ||
|
||||||
|
// HA doesn't support RGBCT, and there's no CWWW->CT emulation in ESPHome yet, so ignore CT control for now
|
||||||
|
traits.supports_color_mode(ColorMode::RGB_COLOR_TEMPERATURE))
|
||||||
color_modes.add("rgbw");
|
color_modes.add("rgbw");
|
||||||
if (traits.supports_color_mode(ColorMode::RGB_COLD_WARM_WHITE))
|
if (traits.supports_color_mode(ColorMode::RGB_COLD_WARM_WHITE))
|
||||||
color_modes.add("rgbww");
|
color_modes.add("rgbww");
|
||||||
if (traits.supports_color_mode(ColorMode::BRIGHTNESS))
|
|
||||||
color_modes.add("brightness");
|
|
||||||
if (traits.supports_color_mode(ColorMode::ON_OFF))
|
|
||||||
color_modes.add("onoff");
|
|
||||||
|
|
||||||
// legacy API
|
// legacy API
|
||||||
if (traits.supports_color_capability(ColorCapability::BRIGHTNESS))
|
if (traits.supports_color_capability(ColorCapability::BRIGHTNESS))
|
||||||
|
|
Loading…
Reference in a new issue