diff --git a/custom_components/wemportal/number.py b/custom_components/wemportal/number.py index 9152511..61c5066 100644 --- a/custom_components/wemportal/number.py +++ b/custom_components/wemportal/number.py @@ -24,7 +24,6 @@ async def async_setup_platform( entities: list[WemPortalNumber] = [] for unique_id, values in coordinator.data.items(): if values["platform"] == "number": - _LOGGER.warning(unique_id) entities.append(WemPortalNumber(coordinator, unique_id, values)) async_add_entities(entities) diff --git a/custom_components/wemportal/wemportalapi.py b/custom_components/wemportal/wemportalapi.py index 74f538a..142f9ad 100644 --- a/custom_components/wemportal/wemportalapi.py +++ b/custom_components/wemportal/wemportalapi.py @@ -12,12 +12,10 @@ import requests as reqs import scrapyscript from fuzzywuzzy import fuzz -from homeassistant.const import (CONF_PASSWORD, CONF_SCAN_INTERVAL, - CONF_USERNAME) +from homeassistant.const import CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_USERNAME from scrapy import FormRequest, Spider -from .const import (_LOGGER, CONF_LANGUAGE, CONF_MODE, CONF_SCAN_INTERVAL_API, - START_URLS) +from .const import _LOGGER, CONF_LANGUAGE, CONF_MODE, CONF_SCAN_INTERVAL_API, START_URLS class WemPortalApi: @@ -49,13 +47,7 @@ def __init__(self, config): def fetch_data(self): if self.mode == "web": - if ( - self.last_scraping_update is None - or (datetime.now() - self.last_scraping_update + timedelta(seconds=5)) - > self.update_interval - ): - self.fetch_webscraping_data() - self.last_scraping_update = datetime.now() + self.fetch_webscraping_data() elif self.mode == "api": self.fetch_api_data() else: @@ -396,7 +388,7 @@ def get_data(self): data[key]["friendlyName"], scraped_entity.split("-")[1], ) - >= 85 + >= 90 ): try: self.scrapingMapper[key].append( @@ -419,7 +411,7 @@ def get_data(self): for scraped_entity in self.scrapingMapper[key]: try: self.data[scraped_entity] = { - "value": self.data[scraped_entity]["value"], + "value": data[key]["value"], "name": self.data[scraped_entity]["name"], "unit": self.data[scraped_entity]["unit"], "icon": self.data[scraped_entity]["icon"], @@ -476,6 +468,7 @@ def friendly_name_mapper(self, value): def translate(self, language, value): # TODO: Implement support for other languages. + value = value.lower() translationDict = { "en": { "außsentemperatur": "outside_temperature",