Skip to content

Commit

Permalink
Add missing encoding to unquote
Browse files Browse the repository at this point in the history
  • Loading branch information
SukramJ committed Dec 14, 2024
1 parent 348925b commit 475c435
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Version 2024.12.4 (2024-12-14)

- Add missing encoding to unquote

# Version 2024.12.3 (2024-12-14)

- Add method cleanup_text_from_html_tags
Expand Down
7 changes: 3 additions & 4 deletions hahomematic/client/json_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from hahomematic.const import (
DESCRIPTIONS_ERROR_MESSAGE,
EXTENDED_SYSVAR_MARKER,
ISO88591,
PATH_JSON_RPC,
REGA_SCRIPT_PATH,
UTF8,
Expand Down Expand Up @@ -594,9 +595,8 @@ async def _get_program_descriptions(self) -> dict[str, str]:
_LOGGER.debug("GET_PROGRAM_DESCRIPTIONS: Getting program descriptions")
if json_result := response[_JsonKey.RESULT]:
for data in json_result:
decoded_text = unquote(string=data[_JsonKey.DESCRIPTION])
descriptions[data[_JsonKey.ID]] = cleanup_text_from_html_tags(
text=decoded_text
text=unquote(string=data[_JsonKey.DESCRIPTION], encoding=ISO88591)
)
except JSONDecodeError as err:
_LOGGER.error(
Expand All @@ -617,9 +617,8 @@ async def _get_system_variable_descriptions(self) -> dict[str, str]:
_LOGGER.debug("GET_SYSTEM_VARIABLE_DESCRIPTIONS: Getting system variable descriptions")
if json_result := response[_JsonKey.RESULT]:
for data in json_result:
decoded_text = unquote(string=data[_JsonKey.DESCRIPTION])
descriptions[data[_JsonKey.ID]] = cleanup_text_from_html_tags(
text=decoded_text
text=unquote(string=data[_JsonKey.DESCRIPTION], encoding=ISO88591)
)
except JSONDecodeError as err:
_LOGGER.error(
Expand Down
3 changes: 2 additions & 1 deletion hahomematic/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import re
from typing import Any, Final, Required, TypedDict

VERSION: Final = "2024.12.3"
VERSION: Final = "2024.12.4"

DEFAULT_CONNECTION_CHECKER_INTERVAL: Final = 15 # check if connection is available via rpc ping
DEFAULT_CUSTOM_ID: Final = "custom_id"
Expand All @@ -33,6 +33,7 @@
DEFAULT_WAIT_FOR_CALLBACK: Final[int | None] = None

UTF8: Final = "utf-8"
ISO88591: Final = "iso-8859-1"

MAX_WAIT_FOR_CALLBACK: Final = 60
MAX_CACHE_AGE: Final = 10
Expand Down

0 comments on commit 475c435

Please sign in to comment.