From 1e904f937b555479bb0fd043f1502a1fe6a284ac Mon Sep 17 00:00:00 2001 From: Ludy87 Date: Sun, 1 Oct 2023 19:04:48 +0200 Subject: [PATCH] Refactor constants, helper functions, and switch name formatting in `xplora_watch` component. Signed-off-by: Ludy87 --- custom_components/xplora_watch/const.py | 2 +- custom_components/xplora_watch/helper.py | 1 + custom_components/xplora_watch/manifest.json | 2 +- custom_components/xplora_watch/switch.py | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/custom_components/xplora_watch/const.py b/custom_components/xplora_watch/const.py index 68d894e6..b991726c 100644 --- a/custom_components/xplora_watch/const.py +++ b/custom_components/xplora_watch/const.py @@ -337,5 +337,5 @@ select: options: - all -""", +""", # noqa: E501 } diff --git a/custom_components/xplora_watch/helper.py b/custom_components/xplora_watch/helper.py index 480bb215..4f643797 100644 --- a/custom_components/xplora_watch/helper.py +++ b/custom_components/xplora_watch/helper.py @@ -79,6 +79,7 @@ def encoded_base64_string_to_mp3_file(hass: HomeAssistant, base64_string: str, f async def create_www_directory(hass: HomeAssistant): """Create www directory.""" paths = [ + hass.config.path("www"), # http://homeassistant.local:8123/local hass.config.path("www/image"), # http://homeassistant.local:8123/local/image/.jpeg hass.config.path("www/video"), # http://homeassistant.local:8123/local/video/.mp4 hass.config.path("www/video/thumb"), # http://homeassistant.local:8123/local/video/thumb/.jpeg diff --git a/custom_components/xplora_watch/manifest.json b/custom_components/xplora_watch/manifest.json index 50625c0f..3a66b875 100644 --- a/custom_components/xplora_watch/manifest.json +++ b/custom_components/xplora_watch/manifest.json @@ -15,5 +15,5 @@ "pydub", "marshmallow-enum" ], - "version": "v2.10.2" + "version": "v2.10.3" } diff --git a/custom_components/xplora_watch/switch.py b/custom_components/xplora_watch/switch.py index de783090..076774ea 100644 --- a/custom_components/xplora_watch/switch.py +++ b/custom_components/xplora_watch/switch.py @@ -203,7 +203,7 @@ 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( + self._attr_name: str = f'{ward.get(CONF_NAME)} {ATTR_WATCH} {description.key} {silent["start"]}-{silent["end"]} ({coordinator.username})'.replace( # noqa: E501 "_", " " ).title()