Rename emgauwa-lib to emgauwa-common

This commit is contained in:
Tobias Reisinger 2024-04-30 08:44:33 +02:00
parent 6340cfd5c7
commit 9bc75b9627
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
58 changed files with 135 additions and 100 deletions
emgauwa-controller/src

View file

@ -2,11 +2,11 @@ use std::time::{Duration, Instant};
use actix::Addr;
use chrono::{Local, Timelike};
use emgauwa_lib::constants::RELAYS_RETRY_TIMEOUT;
use emgauwa_lib::errors::EmgauwaError;
use emgauwa_lib::models::Controller;
use emgauwa_lib::types::{RelayStates, Weekday};
use emgauwa_lib::utils::printable_relay_states;
use emgauwa_common::constants::RELAYS_RETRY_TIMEOUT;
use emgauwa_common::errors::EmgauwaError;
use emgauwa_common::models::Controller;
use emgauwa_common::types::{RelayStates, Weekday};
use emgauwa_common::utils::printable_relay_states;
use futures::pin_mut;
use tokio::time;
use tokio::time::timeout;
@ -29,7 +29,7 @@ pub async fn run_relays_loop(app_state: Addr<AppState>) {
async fn run_relays(app_state: &Addr<AppState>) -> Result<(), EmgauwaError> {
let notifier = &*app_state_get_controller_notifier(app_state).await?;
let mut last_weekday = emgauwa_lib::utils::get_weekday();
let mut last_weekday = emgauwa_common::utils::get_weekday();
let mut this = utils::app_state_get_this(app_state).await?;
let mut relay_states: RelayStates = Vec::new();
init_relay_states(&mut relay_states, &this);
@ -138,7 +138,7 @@ async fn check_weekday(
last_weekday: &mut Weekday,
changed: &mut bool,
) -> Result<(), EmgauwaError> {
let current_weekday = emgauwa_lib::utils::get_weekday();
let current_weekday = emgauwa_common::utils::get_weekday();
if current_weekday.ne(last_weekday) {
log::debug!("Weekday changed");
*last_weekday = current_weekday;