Address late review on adding an error sensor to Husqvarna Automower (#113242)

This commit is contained in:
Thomas55555 2024-03-15 12:04:33 +01:00 committed by GitHub
parent 45195d2ea9
commit 309f554336
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 1 additions and 9 deletions

View File

@ -21,8 +21,6 @@ MAX_WS_RECONNECT_TIME = 600
class AutomowerDataUpdateCoordinator(DataUpdateCoordinator[dict[str, MowerAttributes]]): class AutomowerDataUpdateCoordinator(DataUpdateCoordinator[dict[str, MowerAttributes]]):
"""Class to manage fetching Husqvarna data.""" """Class to manage fetching Husqvarna data."""
config_entry: ConfigEntry
def __init__( def __init__(
self, hass: HomeAssistant, api: AutomowerSession, entry: ConfigEntry self, hass: HomeAssistant, api: AutomowerSession, entry: ConfigEntry
) -> None: ) -> None:

View File

@ -3,7 +3,6 @@
import logging import logging
from aioautomower.model import MowerAttributes from aioautomower.model import MowerAttributes
from aioautomower.utils import structure_token
from homeassistant.helpers.device_registry import DeviceInfo from homeassistant.helpers.device_registry import DeviceInfo
from homeassistant.helpers.update_coordinator import CoordinatorEntity from homeassistant.helpers.update_coordinator import CoordinatorEntity
@ -13,8 +12,6 @@ from .const import DOMAIN
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
HUSQVARNA_URL = "https://developer.husqvarnagroup.cloud"
class AutomowerBaseEntity(CoordinatorEntity[AutomowerDataUpdateCoordinator]): class AutomowerBaseEntity(CoordinatorEntity[AutomowerDataUpdateCoordinator]):
"""Defining the Automower base Entity.""" """Defining the Automower base Entity."""
@ -29,10 +26,7 @@ class AutomowerBaseEntity(CoordinatorEntity[AutomowerDataUpdateCoordinator]):
"""Initialize AutomowerEntity.""" """Initialize AutomowerEntity."""
super().__init__(coordinator) super().__init__(coordinator)
self.mower_id = mower_id self.mower_id = mower_id
entry = coordinator.config_entry
structured_token = structure_token(entry.data["token"]["access_token"])
self._attr_device_info = DeviceInfo( self._attr_device_info = DeviceInfo(
configuration_url=f"{HUSQVARNA_URL}/applications/{structured_token.client_id}",
identifiers={(DOMAIN, mower_id)}, identifiers={(DOMAIN, mower_id)},
manufacturer="Husqvarna", manufacturer="Husqvarna",
model=self.mower_attributes.system.model, model=self.mower_attributes.system.model,

View File

@ -3,7 +3,7 @@
DeviceRegistryEntrySnapshot({ DeviceRegistryEntrySnapshot({
'area_id': 'garden', 'area_id': 'garden',
'config_entries': <ANY>, 'config_entries': <ANY>,
'configuration_url': 'https://developer.husqvarnagroup.cloud/applications/433e5fdf-5129-452c-xxxx-fadce3213042', 'configuration_url': None,
'connections': set({ 'connections': set({
}), }),
'disabled_by': None, 'disabled_by': None,