Skip to content

Commit e79af41

Browse files
committed
+ Added configuration url for WebAPI client
1 parent 9c97449 commit e79af41

File tree

5 files changed

+26
-9
lines changed

5 files changed

+26
-9
lines changed

custom_components/systemair/api.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,11 @@ def __init__(
543543
self._session = session
544544
self._lock = asyncio.Lock()
545545

546+
@property
547+
def address(self) -> str:
548+
"""Return the device address."""
549+
return self._address
550+
546551
async def async_test_connection(self) -> Any:
547552
"""Test connection to API (legacy method for compatibility)."""
548553
return await self.test_connection()

custom_components/systemair/coordinator.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ async def async_setup_webapi(self) -> None:
144144
self.config_entry.runtime_data.mb_sw_version = unit_version["MB SW version"]
145145
self.config_entry.runtime_data.iam_sw_version = unit_version["IAM SW version"]
146146

147+
# Set configuration URL for web interface access
148+
if hasattr(self.client, "address"):
149+
self.config_entry.runtime_data.configuration_url = f"http://{self.client.address}"
150+
147151
# Required for setup of climate entity
148152
self.register_modbus_parameters(parameter_map["REG_FUNCTION_ACTIVE_HEATER"])
149153
self.register_modbus_parameters(parameter_map["REG_FUNCTION_ACTIVE_COOLER"])

custom_components/systemair/data.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ class SystemairData:
3232
mb_sw_version: str | None = None
3333
serial_number: str | None = None
3434
mac_address: str | None = None
35+
configuration_url: str | None = None

custom_components/systemair/entity.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,23 @@ def __init__(self, coordinator: SystemairDataUpdateCoordinator) -> None:
1818
"""Initialize."""
1919
super().__init__(coordinator)
2020
self._attr_unique_id = coordinator.config_entry.entry_id
21-
self._attr_device_info = DeviceInfo(
22-
manufacturer="Systemair",
23-
model=coordinator.config_entry.runtime_data.mb_model,
24-
hw_version=coordinator.config_entry.runtime_data.mb_hw_version,
25-
sw_version=coordinator.config_entry.runtime_data.mb_sw_version,
26-
serial_number=coordinator.config_entry.runtime_data.serial_number,
27-
identifiers={
21+
22+
device_info_dict = {
23+
"manufacturer": "Systemair",
24+
"model": coordinator.config_entry.runtime_data.mb_model,
25+
"hw_version": coordinator.config_entry.runtime_data.mb_hw_version,
26+
"sw_version": coordinator.config_entry.runtime_data.mb_sw_version,
27+
"serial_number": coordinator.config_entry.runtime_data.serial_number,
28+
"identifiers": {
2829
(
2930
coordinator.config_entry.domain,
3031
coordinator.config_entry.entry_id,
3132
),
3233
},
33-
)
34+
}
35+
36+
# Add configuration URL for WebAPI devices
37+
if coordinator.config_entry.runtime_data.configuration_url:
38+
device_info_dict["configuration_url"] = coordinator.config_entry.runtime_data.configuration_url
39+
40+
self._attr_device_info = DeviceInfo(**device_info_dict)

custom_components/systemair/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
"aiohttp",
1616
"async-timeout"
1717
],
18-
"version": "1.0.6"
18+
"version": "1.0.7"
1919
}

0 commit comments

Comments
 (0)