diff --git a/terrariumEngine.py b/terrariumEngine.py index 22758c138..904b2a213 100644 --- a/terrariumEngine.py +++ b/terrariumEngine.py @@ -382,13 +382,11 @@ def load_settings(self): if "weather_source" in self.settings: if "" != self.settings["weather_source"]: try: - start = time.time() self.weather = terrariumWeather(self.settings["weather_source"], self.units, self.active_language) except Exception as ex: weatherLogger.error(f"Failed loading weather data: {ex}") elif self.weather is not None: - start = time.time() self.weather.address = self.settings["weather_source"] # Force an update, due to maybe changing speed units or temperature.... lazy fix... :( self.weather.update() diff --git a/weather/__init__.py b/weather/__init__.py index db472d235..bc2380c54 100644 --- a/weather/__init__.py +++ b/weather/__init__.py @@ -47,7 +47,7 @@ def update(self): self._device["last_update"] is None or (datetime.now() - self._device["last_update"]).total_seconds() > self.__UPDATE_TIMEOUT ): - logger.debug(f"Loading online weather data from source: {self.address}") + logger.info(f"Loading online weather data from source: {self.address}") if self._load_data(): # Convert values to the right unit values @@ -71,6 +71,7 @@ def update(self): ) self._device["last_update"] = datetime.now() + else: logger.error(f"Error loading online weather data! Please check your source address: {self.address}.") @@ -109,7 +110,7 @@ def address(self, value): reload = self.address != str(value).strip(", ") self._device["address"] = str(value).strip(", ") if reload: - logger.debug(f"Reloading weather data due to changing weather source to: {self.address}") + logger.info(f"Reloading weather data due to changing weather source to: {self.address}") self._device["last_update"] = None self.update() diff --git a/weather/openweathermap_org_weather.py b/weather/openweathermap_org_weather.py index 2866e20e4..74f470ac2 100644 --- a/weather/openweathermap_org_weather.py +++ b/weather/openweathermap_org_weather.py @@ -23,9 +23,8 @@ def __init__(self, address, unit_values, language): super().__init__(address, unit_values, language) def __load_general_data(self): - address = self.address + "&units=metric&lang=" + self._device["language"][0:2] - logger.debug("Loading weather source {}".format(address)) start = time() + address = self.address + "&units=metric&lang=" + self._device["language"][0:2] data = terrariumUtils.get_remote_data(address) if data: self._data["city"] = data["name"] @@ -37,7 +36,7 @@ def __load_general_data(self): address = terrariumUtils.parse_url(self.address.lower()) self.__appid = address["query_params"]["appid"] - logger.info(f"Loaded basic weather data from source {address} in {time()-start:.2f} seconds.") + logger.info(f"Loaded basic weather data from source {self.address.lower()} in {time()-start:.2f} seconds.") return True