Add relay pulse functionality
This commit is contained in:
parent
e2f3d7b82a
commit
61a3c6093b
14 changed files with 201 additions and 13 deletions
emgauwa-controller/src/ws
|
@ -140,6 +140,9 @@ pub async fn handle_action(
|
|||
}
|
||||
ControllerWsAction::Relays(relays) => handle_relays(conn, &this, relays).await?,
|
||||
ControllerWsAction::Schedules(schedules) => handle_schedules(conn, schedules).await?,
|
||||
ControllerWsAction::RelayPulse((relay_num, duration)) => {
|
||||
handle_relay_pulse(app_state, relay_num, duration).await?
|
||||
}
|
||||
_ => return Ok(()),
|
||||
};
|
||||
|
||||
|
@ -234,3 +237,11 @@ async fn handle_relays(
|
|||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn handle_relay_pulse(
|
||||
app_state: &Addr<AppState>,
|
||||
relay_num: i64,
|
||||
duration: Option<u32>,
|
||||
) -> Result<(), EmgauwaError> {
|
||||
utils::app_state_relay_pulse(app_state, relay_num, duration).await
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue