Compare commits

..

8 Commits

Author SHA1 Message Date
8762a680a8
Slight macro cleanup
All checks were successful
Build and deploy automation_rs / Build automation_rs (push) Successful in 4m26s
Build and deploy automation_rs / Build Docker image (push) Successful in 34s
Build and deploy automation_rs / Deploy Docker container (push) Has been skipped
2024-04-26 06:03:54 +02:00
e7fb8bfb8d
Improved the internals of the LuaDeviceConfig macro and improve the
usability of the macro
2024-04-26 06:03:54 +02:00
dc3a7e5407
Use helper types to process config input into the right type 2024-04-26 06:03:54 +02:00
20606c6356
Added helper type to convert from ip addr to socketaddr with the correct port 2024-04-26 06:03:54 +02:00
d8198bf5b0
Added rename option to macro 2024-04-26 06:03:54 +02:00
9449a83f61
Everything needed to construct a new device is passed in through lua 2024-04-26 06:03:54 +02:00
2bc2dc6be1
Device config is now done through lua 2024-04-26 06:03:54 +02:00
40ba4c47cf
Fix: contact sensor turns off lights even if they were already on
All checks were successful
Build and deploy automation_rs / Build automation_rs (push) Successful in 3m57s
Build and deploy automation_rs / Build Docker image (push) Successful in 45s
Build and deploy automation_rs / Deploy Docker container (push) Successful in 29s
2024-04-26 06:00:53 +02:00

View File

@ -141,9 +141,10 @@ impl OnMqtt for ContactSensor {
if let Some(trigger) = &mut self.config.trigger {
if !self.is_closed {
for (light, _) in &mut trigger.devices {
for (light, previous) in &mut trigger.devices {
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();
}
}