Skip to content

Commit

Permalink
* Add serde default handling, to ensure existing state files can be …
Browse files Browse the repository at this point in the history
…loaded with new api models
  • Loading branch information
chrivers committed Sep 16, 2024
1 parent 22ab813 commit 47006cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/hue/api/grouped_light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ pub struct GroupedLight {
pub color_temperature: Option<Stub>,
#[serde(skip_serializing_if = "Option::is_none")]
pub color_temperature_delta: Option<Stub>,
#[serde(default)]
pub dimming_delta: Stub,
#[serde(default)]
pub dynamics: Stub,
pub on: Option<On>,
pub owner: ResourceLink,
Expand Down
3 changes: 2 additions & 1 deletion src/hue/api/scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pub struct Scene {
pub palette: Value,
pub speed: f64,
pub status: Option<SceneStatus>,
#[serde(default)]
pub recall: SceneRecall,
}

Expand Down Expand Up @@ -117,7 +118,7 @@ impl SceneUpdate {
}
}

#[derive(Debug, Serialize, Deserialize, Clone)]
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
pub struct SceneRecall {
#[serde(skip_serializing_if = "Option::is_none")]
pub action: Option<SceneStatusUpdate>,
Expand Down

0 comments on commit 47006cd

Please sign in to comment.