Compare commits

..

7 Commits

Author SHA1 Message Date
6d2dbd37f1
Slight macro cleanup
All checks were successful
Build and deploy automation_rs / Build automation_rs (push) Successful in 4m36s
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 06:03:25 +02:00
e469e290de
Improved the internals of the LuaDeviceConfig macro and improve the
usability of the macro
2024-04-26 06:03:25 +02:00
849c579d16
Use helper types to process config input into the right type 2024-04-26 06:02:59 +02:00
54c4b70d19
Added helper type to convert from ip addr to socketaddr with the correct port
All checks were successful
Build and deploy automation_rs / Build automation_rs (push) Successful in 7m28s
Build and deploy automation_rs / Build Docker image (push) Successful in 59s
Build and deploy automation_rs / Deploy Docker container (push) Has been skipped
2024-04-25 02:05:22 +02:00
ebdabed822
Added rename option to macro 2024-04-25 02:02:31 +02:00
6e1b2a8935
Everything needed to construct a new device is passed in through lua 2024-04-25 01:38:52 +02:00
0d1e15c676
Device config is now done through lua
All checks were successful
Build and deploy automation_rs / Build automation_rs (push) Successful in 7m59s
Build and deploy automation_rs / Build Docker image (push) Successful in 46s
Build and deploy automation_rs / Deploy Docker container (push) Has been skipped
2024-04-24 04:00:29 +02:00

View File

@ -141,10 +141,9 @@ 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, previous) in &mut trigger.devices { for (light, _) 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();
} }
} }