v0.5.0
This commit is contained in:
+8
-2
@@ -4,12 +4,13 @@ mod db;
|
||||
mod engine;
|
||||
mod error;
|
||||
mod home_assistant;
|
||||
mod influxdb;
|
||||
mod models;
|
||||
mod protocol;
|
||||
mod queries;
|
||||
mod state;
|
||||
|
||||
use std::{sync::Arc, time::{Duration, Instant}};
|
||||
use std::{sync::{Arc, atomic::AtomicBool}, time::{Duration, Instant}};
|
||||
use anyhow::{Context, Result};
|
||||
use config::Config;
|
||||
use db::Db;
|
||||
@@ -31,6 +32,7 @@ async fn main() -> Result<()> {
|
||||
if std::env::var_os("GREE_CONTROLLER_DISCOVERY_BROADCAST").is_some() {
|
||||
runtime_settings.discovery_broadcast = config.discovery_broadcast.clone();
|
||||
}
|
||||
config.apply_runtime_env_overrides(&mut runtime_settings);
|
||||
db.save_runtime_settings(&runtime_settings)?;
|
||||
|
||||
if config.simulate && config.auto_seed && db.count_devices()? == 0 {
|
||||
@@ -43,7 +45,8 @@ async fn main() -> Result<()> {
|
||||
)?;
|
||||
}
|
||||
|
||||
let (events, _) = broadcast::channel(256);
|
||||
let (events, _) = broadcast::channel(512);
|
||||
let debug_gree_frames = Arc::new(AtomicBool::new(runtime_settings.debug.gree_frames));
|
||||
let http = reqwest::Client::builder()
|
||||
.timeout(Duration::from_secs(10))
|
||||
.user_agent(concat!("gree-controller/", env!("CARGO_PKG_VERSION")))
|
||||
@@ -55,10 +58,13 @@ async fn main() -> Result<()> {
|
||||
gree: GreeClient::new(
|
||||
runtime_settings.controller_id.clone(),
|
||||
(!config.gree_interface.trim().is_empty()).then(|| config.gree_interface.trim().to_string()),
|
||||
Some(events.clone()),
|
||||
debug_gree_frames.clone(),
|
||||
),
|
||||
events,
|
||||
http,
|
||||
outdoor_temperature: Arc::new(RwLock::new(None)),
|
||||
debug_gree_frames,
|
||||
started: Instant::now(),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user