Skip to content

Commit

Permalink
Fixed comma problem for german locale. Fixes #20
Browse files Browse the repository at this point in the history
  • Loading branch information
erikkastelec committed Apr 1, 2022
1 parent aa3d004 commit 5471aed
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions custom_components/wemportal/wemportalapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def parse(self, response):
def navigate_to_expert_page(self, response):
# sleep for 1 seconds to get proper language and updated data
time.sleep(1)
#_LOGGER.debug("Print user page HTML: %s", response.text)
# _LOGGER.debug("Print user page HTML: %s", response.text)
if (
response.url
== "https://www.wemportal.com/Web/login.aspx?AspxAutoDetectCookieSupport=1"
Expand Down Expand Up @@ -480,7 +480,7 @@ def generate_form_data(self, response):
def scrape_pages(self, response):
# sleep for 1 seconds to get proper language and updated data
time.sleep(1)
#_LOGGER.debug("Print expert page HTML: %s", response.text)
# _LOGGER.debug("Print expert page HTML: %s", response.text)
if self.authErrorFlag:
yield {"authErrorFlag": True}
_LOGGER.debug("Scraping page")
Expand Down Expand Up @@ -527,7 +527,8 @@ def scrape_pages(self, response):
else:
value = split_value[0]
try:
value = int(value)
value = ".".join(value.split(","))
value = float(value)
except ValueError:
if value == "--" or value == "off":
value = 0.0
Expand All @@ -539,4 +540,4 @@ def scrape_pages(self, response):
except IndexError:
continue

yield output
yield output

0 comments on commit 5471aed

Please sign in to comment.