Add handler for relay states
This commit is contained in:
parent
82f2d49dc6
commit
55617dbd7c
8 changed files with 53 additions and 20 deletions
emgauwa-controller/src/ws
|
@ -78,7 +78,9 @@ async fn read_app_state(
|
|||
loop {
|
||||
notifier.notified().await;
|
||||
log::debug!("Relay change detected");
|
||||
let ws_action = ControllerWsAction::Register(app_state_get_this(&app_state).await?);
|
||||
let this = app_state_get_this(&app_state).await?;
|
||||
let relay_states = this.get_relay_states();
|
||||
let ws_action = ControllerWsAction::RelayStates((this.c.uid, relay_states));
|
||||
|
||||
let ws_action_json = serde_json::to_string(&ws_action)?;
|
||||
tx.unbounded_send(Message::text(ws_action_json))
|
||||
|
@ -122,9 +124,6 @@ async fn handle_message(
|
|||
log::error!("Error deserializing action: {:?}", e);
|
||||
}
|
||||
},
|
||||
Message::Ping(_) => {
|
||||
log::debug!("Received ping");
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue