HueLight is now HueGroup and uses a scene to turn the light on, the contact sensor will also not override the current light state if it is already on
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-08-18 04:08:15 +02:00
parent 044c38ba86
commit 9628b8a94b
7 changed files with 77 additions and 38 deletions

View File

@@ -167,7 +167,13 @@ impl OnMqtt for ContactSensor {
let mut light = light.write().await;
if let Some(light) = As::<dyn OnOff>::cast_mut(light.as_mut()) {
*previous = light.is_on().await.unwrap();
light.set_on(true).await.ok();
// Only turn the light on when it is currently off
// This is done such that if the light is on but dimmed for example it
// won't suddenly blast at full brightness but instead retain the current
// state
if !*previous {
light.set_on(true).await.ok();
}
}
}
} else {