Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions crates/mqtt-proto/src/entity/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use hass_mqtt_macros::{entity_document, state_document};
///
/// See: <https://www.home-assistant.io/integrations/light.mqtt/#json-schema>
#[entity_document]
#[entity(extend_json(schema = "json"))]
#[entity(extend_json(schema = "json", platform = "light"))]
#[entity(validate(ColorModeWithoutSupportedColorModes))]
pub struct Light<'a> {
/// Flag that defines if the light supports brightness.
Expand Down Expand Up @@ -348,57 +348,57 @@ impl<'a> LightState<'a> {
pub struct LightColorState {
#[cfg_attr(
any(feature = "ser", feature = "de"),
serde(default, skip_serializing_if = "Option::is_none")
serde(default, skip_serializing_if = "Option::is_none", rename = "r")
)]
red: Option<u8>,
pub red: Option<u8>,

#[cfg_attr(
any(feature = "ser", feature = "de"),
serde(default, skip_serializing_if = "Option::is_none")
serde(default, skip_serializing_if = "Option::is_none", rename = "g")
)]
green: Option<u8>,
pub green: Option<u8>,

#[cfg_attr(
any(feature = "ser", feature = "de"),
serde(default, skip_serializing_if = "Option::is_none")
serde(default, skip_serializing_if = "Option::is_none", rename = "b")
)]
blue: Option<u8>,
pub blue: Option<u8>,

#[cfg_attr(
any(feature = "ser", feature = "de"),
serde(default, skip_serializing_if = "Option::is_none")
)]
cold_white: Option<u8>,
pub cold_white: Option<u8>,

#[cfg_attr(
any(feature = "ser", feature = "de"),
serde(default, skip_serializing_if = "Option::is_none")
)]
white: Option<u8>,
pub white: Option<u8>,

#[cfg_attr(
any(feature = "ser", feature = "de"),
serde(default, skip_serializing_if = "Option::is_none")
)]
x: Option<f32>,
pub x: Option<f32>,

#[cfg_attr(
any(feature = "ser", feature = "de"),
serde(default, skip_serializing_if = "Option::is_none")
)]
y: Option<f32>,
pub y: Option<f32>,

#[cfg_attr(
any(feature = "ser", feature = "de"),
serde(default, skip_serializing_if = "Option::is_none")
serde(default, skip_serializing_if = "Option::is_none", rename = "h")
)]
hue: Option<f32>,
pub hue: Option<f32>,

#[cfg_attr(
any(feature = "ser", feature = "de"),
serde(default, skip_serializing_if = "Option::is_none")
serde(default, skip_serializing_if = "Option::is_none", rename = "s")
)]
saturation: Option<f32>,
pub saturation: Option<f32>,
}

impl LightColorState {
Expand Down
Loading