Skip to content

Commit 1cafc96

Browse files
authored
Merge pull request #31 from my-PV/dev
Backport HA Core changes
2 parents 50eed1d + 9935bf2 commit 1cafc96

3 files changed

Lines changed: 12 additions & 13 deletions

File tree

custom_components/my_pv/coordinator.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
_LOGGER = logging.getLogger(__name__)
2525

26+
UPDATE_INTERVAL = timedelta(seconds=5)
27+
2628

2729
def _my_pv_connection[T](
2830
func: Callable[..., Coroutine[Any, Any, T]],
@@ -77,15 +79,12 @@ def __init__(
7779
_LOGGER,
7880
name=DOMAIN,
7981
config_entry=config_entry,
80-
update_interval=timedelta(seconds=5),
82+
update_interval=UPDATE_INTERVAL,
8183
always_update=True,
8284
)
8385

8486
self.device: Final[MyPVDevice] = device
8587

86-
identifiers = {
87-
(DOMAIN, device.serial_number),
88-
}
8988
connections = set()
9089

9190
if device.mac_address:
@@ -96,7 +95,7 @@ def __init__(
9695
self.device_info: Final[DeviceInfo] = DeviceInfo(
9796
configuration_url=device.setup_uri,
9897
connections=connections,
99-
identifiers=identifiers,
98+
identifiers={(DOMAIN, device.serial_number)},
10099
manufacturer="my-PV",
101100
model=device.model,
102101
name=name,
@@ -129,10 +128,7 @@ def command_configurations(self) -> ItemsView[str, Any]:
129128
return self._command_configurations
130129

131130
async def async_disconnect(self) -> bool:
132-
"""Disconnect from my-PV.
133-
134-
To be called when coordinator is unloaded, e.g. when device is removed or HA is shut down.
135-
"""
131+
"""Disconnect from my-PV."""
136132
return await self.device.disconnect()
137133

138134
@override

custom_components/my_pv/manifest.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
},
1010
{
1111
"macaddress": "986D35C*"
12-
},
13-
{
14-
"macaddress": "6869C4*"
1512
}
1613
],
1714
"documentation": "https://github.com/my-PV/home-assistant-integration",

custom_components/my_pv/strings.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,20 @@
5858
}
5959
},
6060
"exceptions": {
61+
"auth_error": {
62+
"message": "Authentication failed, please reauthenticate."
63+
},
6164
"cannot_connect": {
6265
"message": "[%key:common::config_flow::error::cannot_connect%]"
6366
},
6467
"device_unavailable": {
6568
"message": "Device on {uri} is unavailable"
6669
},
70+
"fetch_failed": {
71+
"message": "Failed to fetch data."
72+
},
6773
"unknown_error": {
68-
"message": "Unknown error."
74+
"message": "The device could not complete the requested action."
6975
}
7076
}
7177
}

0 commit comments

Comments
 (0)