commit
This commit is contained in:
parent
db0cc13267
commit
2fce4312eb
6 changed files with 10 additions and 7 deletions
|
@ -56,4 +56,6 @@ label = "Gaming PC"
|
||||||
handler = "home_assistant"
|
handler = "home_assistant"
|
||||||
config.mode = "toggle"
|
config.mode = "toggle"
|
||||||
config.entity_id = "light.moritz_zimmer_stehlampe"
|
config.entity_id = "light.moritz_zimmer_stehlampe"
|
||||||
config.style.on.icon = "@ph/computer-tower[color=#58fc11]"
|
config.style.on.icon = "@ph/computer-tower[color=#58fc11]"
|
||||||
|
config.style.disconnected.icon = "@ph/computer-tower[alpha=0.2]"
|
||||||
|
config.disconnected_state = "disconnected"
|
|
@ -162,6 +162,8 @@ async fn do_work(
|
||||||
match event {
|
match event {
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
log::error!("The WebSocket connection failed: {error}");
|
log::error!("The WebSocket connection failed: {error}");
|
||||||
|
state_updates_sender.send(StateUpdate::Disconnected).unwrap();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Ok(message) => match message {
|
Ok(message) => match message {
|
||||||
|
@ -193,7 +195,7 @@ async fn do_work(
|
||||||
}
|
}
|
||||||
HaIncomingWsMessage::Result { id, success } => {
|
HaIncomingWsMessage::Result { id, success } => {
|
||||||
if !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() {
|
for entity_id in state_timestamp_by_entity_id.read().await.keys() {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use log::warn;
|
|
||||||
use parse_display::Display;
|
use parse_display::Display;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
@ -273,7 +272,7 @@ pub struct Handler {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Handler {
|
impl Handler {
|
||||||
pub fn new(data: InitialHandlerMessage<(), KnobConfig>) -> Result<Self, HandlerInitializationError> {
|
pub fn new(data: InitialHandlerMessage<(), (), KnobConfig>) -> Result<Self, HandlerInitializationError> {
|
||||||
let (events_sender, _) = broadcast::channel::<(KnobPath, KnobEvent)>(5);
|
let (events_sender, _) = broadcast::channel::<(KnobPath, KnobEvent)>(5);
|
||||||
let pa_volume_interface = Arc::new(PaVolumeInterface::spawn_thread("deckster handler".to_owned()));
|
let pa_volume_interface = Arc::new(PaVolumeInterface::spawn_thread("deckster handler".to_owned()));
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ use std::thread;
|
||||||
use std::thread::sleep;
|
use std::thread::sleep;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use log::{error, warn};
|
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use tokio::sync::broadcast;
|
use tokio::sync::broadcast;
|
||||||
|
@ -309,7 +308,7 @@ pub struct Handler {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Handler {
|
impl Handler {
|
||||||
pub fn new(data: InitialHandlerMessage<KeyConfig, ()>) -> Result<Self, HandlerInitializationError> {
|
pub fn new(data: InitialHandlerMessage<(), KeyConfig, ()>) -> Result<Self, HandlerInitializationError> {
|
||||||
let (events_sender, _) = broadcast::channel::<(KeyPath, KeyEvent)>(5);
|
let (events_sender, _) = broadcast::channel::<(KeyPath, KeyEvent)>(5);
|
||||||
|
|
||||||
let runtime = tokio::runtime::Builder::new_multi_thread().worker_threads(1).build().unwrap();
|
let runtime = tokio::runtime::Builder::new_multi_thread().worker_threads(1).build().unwrap();
|
||||||
|
|
|
@ -43,7 +43,7 @@ pub struct Handler {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Handler {
|
impl Handler {
|
||||||
pub fn new(data: InitialHandlerMessage<KeyConfig, ()>) -> Result<Self, HandlerInitializationError> {
|
pub fn new(data: InitialHandlerMessage<(), KeyConfig, ()>) -> Result<Self, HandlerInitializationError> {
|
||||||
let events_sender = broadcast::Sender::<(KeyPath, KeyEvent)>::new(5);
|
let events_sender = broadcast::Sender::<(KeyPath, KeyEvent)>::new(5);
|
||||||
|
|
||||||
thread::spawn({
|
thread::spawn({
|
||||||
|
|
|
@ -14,6 +14,7 @@ enum CliCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
|
env_logger::init();
|
||||||
let command = CliCommand::parse();
|
let command = CliCommand::parse();
|
||||||
|
|
||||||
match command {
|
match command {
|
||||||
|
|
Loading…
Add table
Reference in a new issue