diff --git a/examples/full/key-pages/default.toml b/examples/full/key-pages/default.toml index e4e3cdd..5260e22 100644 --- a/examples/full/key-pages/default.toml +++ b/examples/full/key-pages/default.toml @@ -56,4 +56,6 @@ label = "Gaming PC" handler = "home_assistant" config.mode = "toggle" config.entity_id = "light.moritz_zimmer_stehlampe" -config.style.on.icon = "@ph/computer-tower[color=#58fc11]" \ No newline at end of file +config.style.on.icon = "@ph/computer-tower[color=#58fc11]" +config.style.disconnected.icon = "@ph/computer-tower[alpha=0.2]" +config.disconnected_state = "disconnected" \ No newline at end of file diff --git a/handlers/home_assistant/src/ha_client.rs b/handlers/home_assistant/src/ha_client.rs index b940fd7..20c6a2b 100644 --- a/handlers/home_assistant/src/ha_client.rs +++ b/handlers/home_assistant/src/ha_client.rs @@ -162,6 +162,8 @@ async fn do_work( match event { Err(error) => { log::error!("The WebSocket connection failed: {error}"); + state_updates_sender.send(StateUpdate::Disconnected).unwrap(); + break; } Ok(message) => match message { @@ -193,7 +195,7 @@ async fn do_work( } HaIncomingWsMessage::Result { id, success } => { if !success { - panic!("A command ({id}) failed."); + panic!("A command ({}) failed.", id); } for entity_id in state_timestamp_by_entity_id.read().await.keys() { diff --git a/handlers/pa_volume/src/handler.rs b/handlers/pa_volume/src/handler.rs index 359204c..9c628c5 100644 --- a/handlers/pa_volume/src/handler.rs +++ b/handlers/pa_volume/src/handler.rs @@ -1,6 +1,5 @@ use std::sync::Arc; -use log::warn; use parse_display::Display; use regex::Regex; use serde::Deserialize; @@ -273,7 +272,7 @@ pub struct Handler { } impl Handler { - pub fn new(data: InitialHandlerMessage<(), KnobConfig>) -> Result { + pub fn new(data: InitialHandlerMessage<(), (), KnobConfig>) -> Result { let (events_sender, _) = broadcast::channel::<(KnobPath, KnobEvent)>(5); let pa_volume_interface = Arc::new(PaVolumeInterface::spawn_thread("deckster handler".to_owned())); diff --git a/handlers/playerctl/src/handler.rs b/handlers/playerctl/src/handler.rs index c6e4289..3d1fb68 100644 --- a/handlers/playerctl/src/handler.rs +++ b/handlers/playerctl/src/handler.rs @@ -7,7 +7,6 @@ use std::thread; use std::thread::sleep; use std::time::Duration; -use log::{error, warn}; use once_cell::sync::Lazy; use serde::{Deserialize, Serialize}; use tokio::sync::broadcast; @@ -309,7 +308,7 @@ pub struct Handler { } impl Handler { - pub fn new(data: InitialHandlerMessage) -> Result { + pub fn new(data: InitialHandlerMessage<(), KeyConfig, ()>) -> Result { let (events_sender, _) = broadcast::channel::<(KeyPath, KeyEvent)>(5); let runtime = tokio::runtime::Builder::new_multi_thread().worker_threads(1).build().unwrap(); diff --git a/handlers/timer/src/handler.rs b/handlers/timer/src/handler.rs index 885e299..b77b8c9 100644 --- a/handlers/timer/src/handler.rs +++ b/handlers/timer/src/handler.rs @@ -43,7 +43,7 @@ pub struct Handler { } impl Handler { - pub fn new(data: InitialHandlerMessage) -> Result { + pub fn new(data: InitialHandlerMessage<(), KeyConfig, ()>) -> Result { let events_sender = broadcast::Sender::<(KeyPath, KeyEvent)>::new(5); thread::spawn({ diff --git a/handlers/timer/src/main.rs b/handlers/timer/src/main.rs index 7c537c0..796dbb8 100644 --- a/handlers/timer/src/main.rs +++ b/handlers/timer/src/main.rs @@ -14,6 +14,7 @@ enum CliCommand { } fn main() -> Result<()> { + env_logger::init(); let command = CliCommand::parse(); match command {