ElektraInitiative / opensesame

3 stars 5 forks source link

Implementation of SensorChange::Alarm(w) #90

Open fel115 opened 1 year ago

fel115 commented 1 year ago

For now, only a message is sent to Nextcloud. In the future, the state in Elektra should be changed.

...
SensorsChange::Alarm(w) => {
    nextcloud_sender
    .send(NextcloudEvent::Chat(
        NextcloudChat::Default,
        gettext!("Fire Alarm {}", w),
    ))
    .await?;
    let mut state = state_mutex.lock().await;
    state.set("alarm/fire", &w.to_string());
    kill(nix::unistd::Pid::from_raw(pid as i32), Signal::SIGHUP)?;
    spawn(exec_ssh_command(format!(
        "kdb set user:/state/libelektra/opensesame/#0/current/alarm/fire \"{}\"",
        w
    )));
}
...

With that implementation, we get the following error:

pensesame: Kein Prozess gefunden
thread 'tokio-runtime-worker' panicked at 'Set config failed: Sorry, module  issued error :
: ', src/config.rs:31:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
opensesame: Kein Prozess gefunden

Maybe something in the config Module needs to be changed.