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
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user