Skip to content

Commit 56539c4

Browse files
committed
feat: add configuration url
1 parent 0671389 commit 56539c4

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: "Intouch2-MQTT"
22
description: "A bridge between intouch2, used in spa systems, and MQTT 3.3"
3-
version: "0.1.252"
3+
version: "0.1.253"
44
slug: "intouch2-mqtt"
55
init: false
66
arch:

intouch2-mqtt/src/home_assistant.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ pub struct ConfigureDevice {
66
pub name: Arc<str>,
77
#[serde(skip_serializing_if = "Option::is_none")]
88
pub sw_version: Option<Arc<str>>,
9-
//#[serde(skip_serializing_if = "Option::is_none")]
10-
// pub configuration_url: Option<Arc<str>>,
9+
#[serde(skip_serializing_if = "Option::is_none")]
10+
pub configuration_url: Option<Arc<str>>,
1111
#[serde(flatten)]
1212
pub extra_args: HashMap<&'static str, serde_json::Value>,
1313
}

intouch2-mqtt/src/main.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use serde_json::json;
1414
use std::{
1515
borrow::Cow,
1616
collections::VecDeque,
17+
env,
1718
net::IpAddr,
1819
path::PathBuf,
1920
pin::pin,
@@ -561,10 +562,15 @@ async fn main() -> anyhow::Result<()> {
561562
name: spa_name.into(),
562563
sw_version: Some(spa_version.into()),
563564
extra_args: Default::default(),
564-
// configuration_url: env::var("HOSTNAME")
565-
// .map(|hostname| format!("homeassistant://hassio/addon/{hostname}/config"))
566-
// .ok()
567-
// .map(Into::into),
565+
configuration_url: env::var("HOSTNAME")
566+
.map(|hostname| {
567+
format!(
568+
"homeassistant://hassio/addon/{hostname}/config",
569+
hostname = hostname.replace("_", "-")
570+
)
571+
})
572+
.ok()
573+
.map(Into::into),
568574
})?;
569575
let spa = spa.clone();
570576
join_set.spawn(async move {

0 commit comments

Comments
 (0)