Skip to content

Commit

Permalink
Merge pull request #47 from Tvalley71/dev
Browse files Browse the repository at this point in the history
Fix for multiple integration instances
  • Loading branch information
Tvalley71 authored Jul 3, 2024
2 parents e70f54b + fc4bbec commit c17586b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ Known supported units:

- HCV300 ALU
- HCV400 P2
- RCV320
- RCV320 P1/P2

> [!NOTE]
> The listed units are known to have been tested with the integration. There may be other Dantherm units that are also supported. If you know of any not included in the list, please feel free to contact me [here](https://github.com/Tvalley71/dantherm/discussions/new?category=general).
> The listed units are known to have been tested with the integration. Basicly all unit that use the _Dantherm Residential_ app ought to work with the integration.
> ([Google Play](https://play.google.com/store/apps/details?id=com.dantherm.ventilation) or [Apple Store](https://apps.apple.com/dk/app/dantherm-residential/id1368468353)).
> If you know of any not included in the list, please feel free to contact me [here](https://github.com/Tvalley71/dantherm/discussions/new?category=general).
### Controls and sensors

Expand Down
3 changes: 2 additions & 1 deletion custom_components/dantherm/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
10: "HCV400 E1",
11: "HCV400 P1",
12: "HCC 2 E1",
26: "RCV320",
21: "RCV320 P2",
26: "RCV320 P1",
}


Expand Down
9 changes: 5 additions & 4 deletions custom_components/dantherm/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ async def async_will_remove_from_hass(self) -> None:

def suspend_refresh(self, seconds: int):
"""Suspend entity refresh for specified number of seconds."""

self.attr_suspend_refresh = datetime.now() + timedelta(seconds=seconds)

@property
Expand All @@ -63,7 +62,7 @@ def key(self) -> str:
@property
def unique_id(self) -> str | None:
"""Return the unique id."""
return f"dantherm_{self.key}"
return f"{self._device.get_device_name}_{self.key}"

@property
def translation_key(self) -> str:
Expand All @@ -81,7 +80,7 @@ def available(self) -> bool:
@property
def device_info(self):
"""Device Info."""
unique_id = self._device.get_device_name + " " + self._device.get_device_type
unique_id = self._device.get_device_name

return {
"identifiers": {
Expand Down Expand Up @@ -118,7 +117,7 @@ def __init__(
self._port = port
self._unit_id = int(unit_id)
self._client_config = {
"name": self._device_name,
"name": name,
"type": "tcp",
"method": "rtu",
"delay": 0,
Expand Down Expand Up @@ -568,6 +567,7 @@ async def write_holding_registers(
@property
def get_device_name(self) -> str:
"""Device name."""

return self._device_name

@property
Expand All @@ -582,6 +582,7 @@ def get_device_type(self) -> str:
@property
def get_device_fw_version(self) -> str:
"""Device firmware version."""

minor = (self._device_fw_version >> 8) & 0xFF
major = self._device_fw_version & 0xFF
return f"({major}.{minor:02})"
Expand Down

0 comments on commit c17586b

Please sign in to comment.