Add notifier to break relay loop

This commit is contained in:
Tobias Reisinger 2023-12-07 04:30:33 +01:00
parent 83c1f033d5
commit 8785186dfa
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
12 changed files with 124 additions and 45 deletions
emgauwa-core/src/handlers/v1

View file

@ -84,7 +84,7 @@ pub async fn show_for_controller(
#[put("/api/v1/controllers/{controller_id}/relays/{relay_num}")]
pub async fn update_for_controller(
pool: web::Data<Pool<Sqlite>>,
app_server: web::Data<Addr<AppState>>,
app_state: web::Data<Addr<AppState>>,
path: web::Path<(String, i64)>,
data: web::Json<RequestUpdateRelay>,
) -> Result<HttpResponse, EmgauwaError> {
@ -140,7 +140,7 @@ pub async fn update_for_controller(
let return_relay = Relay::from_db_model(&mut pool_conn, relay)?;
app_server
app_state
.send(app_state::Action {
controller_uid: uid,
action: ControllerWsAction::Relays(vec![return_relay.clone()]),