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
|
@ -3,6 +3,7 @@ use std::sync::Arc;
|
|||
use actix::Addr;
|
||||
use emgauwa_lib::errors::EmgauwaError;
|
||||
use emgauwa_lib::models::Controller;
|
||||
use emgauwa_lib::types::RelayStates;
|
||||
use tokio::sync::Notify;
|
||||
|
||||
use crate::app_state;
|
||||
|
@ -42,11 +43,11 @@ pub async fn app_state_reload(app_state: &Addr<AppState>) -> Result<(), EmgauwaE
|
|||
|
||||
pub async fn app_state_update_relays_on(
|
||||
app_state: &Addr<AppState>,
|
||||
relay_states: Vec<Option<bool>>,
|
||||
relay_states: RelayStates,
|
||||
) -> Result<(), EmgauwaError> {
|
||||
app_state
|
||||
.send(app_state::UpdateRelaysOn {
|
||||
relays_are_on: relay_states,
|
||||
.send(app_state::UpdateRelayStates {
|
||||
relay_states: relay_states,
|
||||
})
|
||||
.await
|
||||
.map_err(EmgauwaError::from)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue