Add the siren.rs
This commit is contained in:
7 files changed
+122
No files matched your search
@@ -1115,6 +1115,29 @@ async fn handle_mqtt_message(
|
||||
.await
|
||||
.with_context(|| "Failed to publish floodlight_tasks")?;
|
||||
}
|
||||
MqttReplyRef {
|
||||
topic: "control/siren",
|
||||
message: "on",
|
||||
} => {
|
||||
let res = camera
|
||||
.run_task(|cam| {
|
||||
Box::pin(async move {
|
||||
cam.siren().await?;
|
||||
AnyResult::Ok(())
|
||||
})
|
||||
})
|
||||
.await;
|
||||
let reply = if let Err(e) = res {
|
||||
error!("Failed to trigger siren: {:?}", e);
|
||||
format!("FAIL: {e:?}")
|
||||
} else {
|
||||
"OK".to_string()
|
||||
};
|
||||
|
||||
mqtt.send_message("control/siren", &reply, false)
|
||||
.await
|
||||
.with_context(|| "Failed to publish siren")?;
|
||||
}
|
||||
MqttReplyRef {
|
||||
topic: "query/battery",
|
||||
..
|
||||
|
||||
Reference in new issue
Block a user