From 32741c699a3882d4e59685335f284b0bf4fa2b25 Mon Sep 17 00:00:00 2001 From: Ludy Date: Fri, 17 Jan 2025 16:42:49 +0100 Subject: [PATCH] fixes #456 (#464) * fixes #456 Signed-off-by: Ludy87 * files reformatted Signed-off-by: Ludy87 --------- Signed-off-by: Ludy87 --- custom_components/xplora_watch/__init__.py | 5 +---- custom_components/xplora_watch/coordinator.py | 2 +- custom_components/xplora_watch/device_tracker.py | 2 +- custom_components/xplora_watch/manifest.json | 2 +- custom_components/xplora_watch/switch.py | 8 ++++---- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/custom_components/xplora_watch/__init__.py b/custom_components/xplora_watch/__init__.py index ce313a9..058d087 100644 --- a/custom_components/xplora_watch/__init__.py +++ b/custom_components/xplora_watch/__init__.py @@ -62,10 +62,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: await move_emojis_directory(hass) await create_service_yaml_file(hass, entry, watches) - # Create a copy and remove Platform.NOTIFY - PLATFORMS_COPY = [platform for platform in PLATFORMS if platform != Platform.NOTIFY] - - await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS_COPY) + await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) hass.async_create_task( discovery.async_load_platform( diff --git a/custom_components/xplora_watch/coordinator.py b/custom_components/xplora_watch/coordinator.py index b9a43be..24b33d3 100644 --- a/custom_components/xplora_watch/coordinator.py +++ b/custom_components/xplora_watch/coordinator.py @@ -101,7 +101,7 @@ def __init__(self, hass: HomeAssistant, entry: ConfigEntry) -> None: super().__init__( hass, _LOGGER, - name=f'{DOMAIN}-{entry.data[CONF_PHONENUMBER][5:] if CONF_EMAIL not in entry.data else ""}', + name=f"{DOMAIN}-{entry.data[CONF_PHONENUMBER][5:] if CONF_EMAIL not in entry.data else ''}", update_method=self.async_update_xplora_data, update_interval=_update_interval, ) diff --git a/custom_components/xplora_watch/device_tracker.py b/custom_components/xplora_watch/device_tracker.py index 9140d5a..26fdc75 100644 --- a/custom_components/xplora_watch/device_tracker.py +++ b/custom_components/xplora_watch/device_tracker.py @@ -109,7 +109,7 @@ def __init__( ) self._attr_unique_id = ( - f'{ward.get(CONF_NAME)}_{ATTR_WATCH}_safezone_{safezone["vendorId"]}_{wuid}_{coordinator.user_id}'.replace( + f"{ward.get(CONF_NAME)}_{ATTR_WATCH}_safezone_{safezone['vendorId']}_{wuid}_{coordinator.user_id}".replace( " ", "_" ) .replace("-", "_") diff --git a/custom_components/xplora_watch/manifest.json b/custom_components/xplora_watch/manifest.json index 3165767..9118e4e 100644 --- a/custom_components/xplora_watch/manifest.json +++ b/custom_components/xplora_watch/manifest.json @@ -20,5 +20,5 @@ "marshmallow-enum", "security>=1.2" ], - "version": "v2.14.1" + "version": "v2.14.2" } diff --git a/custom_components/xplora_watch/switch.py b/custom_components/xplora_watch/switch.py index 13711cd..13f2806 100644 --- a/custom_components/xplora_watch/switch.py +++ b/custom_components/xplora_watch/switch.py @@ -105,13 +105,13 @@ def __init__( self._alarm = alarm self._attr_name: str = ( - f'{ward.get(CONF_NAME)} {ATTR_WATCH} {description.key} {alarm["start"]} ({coordinator.username})'.replace( + f"{ward.get(CONF_NAME)} {ATTR_WATCH} {description.key} {alarm['start']} ({coordinator.username})".replace( "_", " " ).title() ) self._attr_unique_id = ( - f'{ward.get(CONF_NAME)}_{ATTR_WATCH}_{description.key}_{alarm["vendorId"]}_{wuid}_{coordinator.user_id}'.replace( + f"{ward.get(CONF_NAME)}_{ATTR_WATCH}_{description.key}_{alarm['vendorId']}_{wuid}_{coordinator.user_id}".replace( " ", "_" ) .replace("-", "_") @@ -201,12 +201,12 @@ def __init__( self._silent = silent - self._attr_name: str = f'{ward.get(CONF_NAME)} {ATTR_WATCH} {description.key} {silent["start"]}-{silent["end"]} ({coordinator.username})'.replace( # noqa: E501 + self._attr_name: str = f"{ward.get(CONF_NAME)} {ATTR_WATCH} {description.key} {silent['start']}-{silent['end']} ({coordinator.username})".replace( # noqa: E501 "_", " " ).title() self._attr_unique_id = ( - f'{ward.get(CONF_NAME)}_{ATTR_WATCH}_{description.key}_{silent["vendorId"]}_{wuid}_{coordinator.user_id}'.replace( + f"{ward.get(CONF_NAME)}_{ATTR_WATCH}_{description.key}_{silent['vendorId']}_{wuid}_{coordinator.user_id}".replace( " ", "_" ) .replace("-", "_")