Skip to content

Commit e03d6a2

Browse files
authored
Merge branch 'main' into feat/disable_cert_validation
2 parents 735b76d + 57376cf commit e03d6a2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+190
-182
lines changed

.idea/runConfigurations/All_Tests.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/Run_intg_home_assistant___mdns_sd_.xml

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/Run_intg_home_assistant___zeroconf_.xml

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[package]
22
name = "uc-intg-hass"
33
version = "0.12.0"
4-
edition = "2021"
4+
edition = "2024"
55
authors = ["Markus Zehnder <markus.z@unfoldedcircle.com>"]
66
license = "MPL-2.0"
7-
description = "Unfolded Circle Home-Assistant integration for Remote Two"
7+
description = "Unfolded Circle Home-Assistant integration for Remote Two/3"
88
repository = "https://github.com/unfoldedcircle/integration-home-assistant"
99
default-run = "uc-intg-hass"
1010

src/bin/ha_test.rs

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ use std::env;
1111
use std::str::FromStr;
1212
use std::time::Duration;
1313
use uc_api::intg::ws::{R2Event, R2Request};
14-
use uc_intg_hass::configuration::{get_configuration, Settings, ENV_HASS_MSG_TRACING};
14+
use uc_intg_hass::configuration::{ENV_HASS_MSG_TRACING, Settings, get_configuration};
1515
use uc_intg_hass::{
16-
configuration, Controller, NewR2Session, R2EventMsg, R2RequestMsg, SendWsMessage, APP_VERSION,
16+
APP_VERSION, Controller, NewR2Session, R2EventMsg, R2RequestMsg, SendWsMessage, configuration,
1717
};
1818
use url::Url;
1919

@@ -102,7 +102,9 @@ fn parse_args_load_cfg() -> anyhow::Result<Settings> {
102102

103103
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("debug")).init();
104104
if let Some(msg_trace) = args.get_one::<String>("trace_level") {
105-
env::set_var(ENV_HASS_MSG_TRACING, msg_trace);
105+
unsafe {
106+
env::set_var(ENV_HASS_MSG_TRACING, msg_trace);
107+
}
106108
}
107109
let cfg_file = None;
108110
let mut cfg = get_configuration(cfg_file).expect("Failed to read configuration");
@@ -154,22 +156,22 @@ impl Handler<SendWsMessage> for ServerMock {
154156

155157
fn handle(&mut self, msg: SendWsMessage, _ctx: &mut Self::Context) {
156158
let msg_name = msg.0.msg.clone().unwrap_or_default();
157-
if msg_name == "device_state" {
158-
if let Some(msg_data) = msg.0.msg_data.as_ref() {
159-
self.connected = msg_data
160-
.as_object()
161-
.and_then(|o| o.get("state"))
162-
.and_then(|s| s.as_str())
163-
== Some("CONNECTED");
164-
165-
if self.connected {
166-
self.controller_addr.do_send(R2RequestMsg {
167-
ws_id: self.id.clone(),
168-
req_id: 0,
169-
request: R2Request::GetEntityStates,
170-
msg_data: None,
171-
});
172-
}
159+
if msg_name == "device_state"
160+
&& let Some(msg_data) = msg.0.msg_data.as_ref()
161+
{
162+
self.connected = msg_data
163+
.as_object()
164+
.and_then(|o| o.get("state"))
165+
.and_then(|s| s.as_str())
166+
== Some("CONNECTED");
167+
168+
if self.connected {
169+
self.controller_addr.do_send(R2RequestMsg {
170+
ws_id: self.id.clone(),
171+
req_id: 0,
172+
request: R2Request::GetEntityStates,
173+
msg_data: None,
174+
});
173175
}
174176
}
175177

src/client/actor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
use actix::{Actor, Context};
77
use log::debug;
88

9-
use crate::client::messages::{ConnectionEvent, ConnectionState};
109
use crate::client::HomeAssistantClient;
10+
use crate::client::messages::{ConnectionEvent, ConnectionState};
1111

1212
impl Actor for HomeAssistantClient {
1313
type Context = Context<Self>;

src/client/close_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use actix_web_actors::ws;
1010
use awc::ws::CloseReason;
1111
use log::info;
1212

13-
use crate::client::messages::Close;
1413
use crate::client::HomeAssistantClient;
14+
use crate::client::messages::Close;
1515

1616
impl Handler<Close> for HomeAssistantClient {
1717
type Result = ();

src/client/entity/button.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
use crate::errors::ServiceError;
77
use serde_json::{Map, Value};
88
use std::collections::HashMap;
9-
use uc_api::intg::AvailableIntgEntity;
109
use uc_api::EntityType;
10+
use uc_api::intg::AvailableIntgEntity;
1111

1212
pub(crate) fn convert_button_entity(
1313
entity_id: String,

src/client/entity/climate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ pub(crate) fn convert_climate_entity(
166166
mod tests {
167167
use crate::client::entity::climate_event_to_entity_change;
168168
use crate::client::model::EventData;
169-
use serde_json::{json, Value};
170-
use uc_api::intg::EntityChange;
169+
use serde_json::{Value, json};
171170
use uc_api::EntityType;
171+
use uc_api::intg::EntityChange;
172172

173173
#[test]
174174
fn climate_event_heat() {

src/client/entity/light.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use log::warn;
1111
use serde_json::{Map, Value};
1212
use std::collections::HashMap;
1313
use uc_api::intg::AvailableIntgEntity;
14-
use uc_api::{intg::EntityChange, EntityType, LightFeature};
14+
use uc_api::{EntityType, LightFeature, intg::EntityChange};
1515

1616
pub(crate) fn map_light_attributes(
1717
entity_id: &str,

0 commit comments

Comments
 (0)