diff --git a/changelog.txt b/changelog.txt index 01219c9..0be4ee3 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ +Version 0.5.2 (2022-11-08) +- Bugfix: Fix page load with special characters in states (Issue #217) + Version 0.5.1 (2022-09-08) - Bugfix: Disable Ace-internal yaml-linting (Issue #226) - Disable internal check for new releases diff --git a/hass_configurator/configurator.py b/hass_configurator/configurator.py index 755ba4a..8cc95cb 100644 --- a/hass_configurator/configurator.py +++ b/hass_configurator/configurator.py @@ -110,7 +110,7 @@ SO.setFormatter( logging.Formatter('%(levelname)s:%(asctime)s:%(name)s:%(message)s')) LOG.addHandler(SO) -VERSION = "0.5.1" +VERSION = "0.5.2" BASEDIR = "." DEV = False LISTENPORT = None @@ -826,7 +826,17 @@ def do_GET(self): req = urllib.request.Request("%sstates" % HASS_API, headers=headers, method='GET') with urllib.request.urlopen(req) as response: - states = response.read().decode('utf-8') + states_clean = [] + for state in json.loads(response.read().decode('utf-8')): + states_clean.append( + { + "entity_id": state.get("entity_id", ""), + "attributes": + {"friendly_name": state.get("attributes", {}).get( + "friendly_name", state.get("entity_id", ""))} + } + ) + states = json.dumps(states_clean) except Exception as err: LOG.warning("Exception getting bootstrap") diff --git a/setup.py b/setup.py index 8f71fab..089587e 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ NAME = "hass-configurator" PACKAGE_NAME = "hass_configurator" -VERSION = "0.5.1" +VERSION = "0.5.2" setup(name=NAME, version=VERSION,