1786826782
This commit is contained in:
@@ -123,8 +123,14 @@ pub async fn hass(
|
||||
let s2c_tx = s2c_tx.clone();
|
||||
async move {
|
||||
loop {
|
||||
let ha_client = HaClient::from_environment().unwrap();
|
||||
let events = ha_client.fetch_calendar_events().unwrap();
|
||||
let Ok(ha_client) = HaClient::from_environment() else {
|
||||
sleep(Duration::from_secs(30)).await;
|
||||
continue;
|
||||
};
|
||||
let Ok(events) = ha_client.fetch_calendar_events() else {
|
||||
sleep(Duration::from_secs(30)).await;
|
||||
continue;
|
||||
};
|
||||
s2c_tx.send(EventMessage::CalendarUpdated(events)).ok();
|
||||
sleep(Duration::from_secs(30)).await;
|
||||
}
|
||||
|
||||
@@ -26,10 +26,9 @@ macro_rules! apply_model {
|
||||
let data = $app
|
||||
.[<get_ $name>]();
|
||||
|
||||
let model = data
|
||||
if let Some(model) = data
|
||||
.as_any()
|
||||
.downcast_ref::<VecModel<$ty>>()
|
||||
.unwrap();
|
||||
.downcast_ref::<VecModel<$ty>>() {
|
||||
|
||||
for entity in $entities.iter().filter($filter) {
|
||||
match model.iter().position(|item| item.id == entity.entity_id) {
|
||||
@@ -38,6 +37,7 @@ macro_rules! apply_model {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ impl Platform for Trekstor {
|
||||
position: LogicalPosition::new(input.x as f32, input.y as f32),
|
||||
button: slint::platform::PointerEventButton::Left,
|
||||
})
|
||||
.unwrap();
|
||||
.ok();
|
||||
}
|
||||
|
||||
if input.is_just_released(KeyCode::BTN_TOUCH) {
|
||||
@@ -108,7 +108,7 @@ impl Platform for Trekstor {
|
||||
position: LogicalPosition::new(input.x as f32, input.y as f32),
|
||||
button: slint::platform::PointerEventButton::Left,
|
||||
})
|
||||
.unwrap();
|
||||
.ok();
|
||||
}
|
||||
|
||||
if input.is_down(KeyCode::BTN_TOUCH) {
|
||||
@@ -116,7 +116,7 @@ impl Platform for Trekstor {
|
||||
.try_dispatch_event(WindowEvent::PointerMoved {
|
||||
position: LogicalPosition::new(input.x as f32, input.y as f32),
|
||||
})
|
||||
.unwrap();
|
||||
.ok();
|
||||
}
|
||||
|
||||
if self.quit_flag.load(Ordering::SeqCst) {
|
||||
|
||||
Reference in New Issue
Block a user