From 12056b221801e8485f9d61ac1df70a9b77a9da89 Mon Sep 17 00:00:00 2001 From: Erik Kastelec Date: Tue, 23 Feb 2021 20:58:35 +0100 Subject: [PATCH] Fix for unusual entity names #2 --- custom_components/wemportal/manifest.json | 2 +- custom_components/wemportal/wemportalapi.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/custom_components/wemportal/manifest.json b/custom_components/wemportal/manifest.json index 9c90da5..6278925 100644 --- a/custom_components/wemportal/manifest.json +++ b/custom_components/wemportal/manifest.json @@ -4,7 +4,7 @@ "documentation": "https://github.com/erikkastelec/hass-WEM-Portal", "issue_tracker": "https://github.com/erikkastelec/hass-WEM-Portal/issues", "dependencies": [], - "version": "1.1.1", + "version": "1.1.2", "codeowners": [ "@erikkastelec" ], diff --git a/custom_components/wemportal/wemportalapi.py b/custom_components/wemportal/wemportalapi.py index 486022e..8a5dd3b 100644 --- a/custom_components/wemportal/wemportalapi.py +++ b/custom_components/wemportal/wemportalapi.py @@ -120,7 +120,8 @@ def scrape_pages(self, response): # Catch heading not starting at 0 try: header = div.xpath(header_query).extract()[0] - header = header.replace(" ", "").replace(" ", "_").lower() + header = header.replace("/#", "").replace(" ", "").replace(" - ", "_").replace("/*+/*", "_").replace( + " ", "_").lower() except IndexError: header = "unknown" continue