Compare commits

..

3 Commits

Author SHA1 Message Date
c90cd00cfa
Slight macro cleanup
All checks were successful
Build and deploy automation_rs / Build automation_rs (push) Successful in 5m14s
Build and deploy automation_rs / Build Docker image (push) Successful in 33s
Build and deploy automation_rs / Deploy Docker container (push) Has been skipped
2024-04-26 05:18:46 +02:00
31169d32eb
Improved the internals of the LuaDeviceConfig macro and improve the
All checks were successful
Build and deploy automation_rs / Build automation_rs (push) Successful in 7m3s
Build and deploy automation_rs / Build Docker image (push) Successful in 39s
Build and deploy automation_rs / Deploy Docker container (push) Has been skipped
usability of the macro
2024-04-26 04:53:45 +02:00
396ac4a9f1
Use helper types to process config input into the right type
All checks were successful
Build and deploy automation_rs / Build automation_rs (push) Successful in 5m18s
Build and deploy automation_rs / Build Docker image (push) Successful in 41s
Build and deploy automation_rs / Deploy Docker container (push) Has been skipped
2024-04-25 05:38:21 +02:00

View File

@ -141,9 +141,10 @@ impl OnMqtt for ContactSensor {
if let Some(trigger) = &mut self.config.trigger { if let Some(trigger) = &mut self.config.trigger {
if !self.is_closed { if !self.is_closed {
for (light, _) in &mut trigger.devices { for (light, previous) in &mut trigger.devices {
let mut light = light.write().await; let mut light = light.write().await;
if let Some(light) = As::<dyn OnOff>::cast_mut(light.as_mut()) { if let Some(light) = As::<dyn OnOff>::cast_mut(light.as_mut()) {
*previous = light.is_on().await.unwrap();
light.set_on(true).await.ok(); light.set_on(true).await.ok();
} }
} }