pyastroweatherio 0.43.1.dev3__tar.gz → 0.43.1.dev5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (16) hide show
  1. {pyastroweatherio-0.43.1.dev3 → pyastroweatherio-0.43.1.dev5}/PKG-INFO +1 -1
  2. {pyastroweatherio-0.43.1.dev3 → pyastroweatherio-0.43.1.dev5}/pyastroweatherio/client.py +20 -16
  3. {pyastroweatherio-0.43.1.dev3 → pyastroweatherio-0.43.1.dev5}/pyastroweatherio/const.py +1 -1
  4. {pyastroweatherio-0.43.1.dev3 → pyastroweatherio-0.43.1.dev5}/pyastroweatherio.egg-info/PKG-INFO +1 -1
  5. {pyastroweatherio-0.43.1.dev3 → pyastroweatherio-0.43.1.dev5}/setup.py +1 -1
  6. {pyastroweatherio-0.43.1.dev3 → pyastroweatherio-0.43.1.dev5}/LICENSE +0 -0
  7. {pyastroweatherio-0.43.1.dev3 → pyastroweatherio-0.43.1.dev5}/README.md +0 -0
  8. {pyastroweatherio-0.43.1.dev3 → pyastroweatherio-0.43.1.dev5}/pyastroweatherio/__init__.py +0 -0
  9. {pyastroweatherio-0.43.1.dev3 → pyastroweatherio-0.43.1.dev5}/pyastroweatherio/dataclasses.py +0 -0
  10. {pyastroweatherio-0.43.1.dev3 → pyastroweatherio-0.43.1.dev5}/pyastroweatherio/errors.py +0 -0
  11. {pyastroweatherio-0.43.1.dev3 → pyastroweatherio-0.43.1.dev5}/pyastroweatherio/helper_functions.py +0 -0
  12. {pyastroweatherio-0.43.1.dev3 → pyastroweatherio-0.43.1.dev5}/pyastroweatherio.egg-info/SOURCES.txt +0 -0
  13. {pyastroweatherio-0.43.1.dev3 → pyastroweatherio-0.43.1.dev5}/pyastroweatherio.egg-info/dependency_links.txt +0 -0
  14. {pyastroweatherio-0.43.1.dev3 → pyastroweatherio-0.43.1.dev5}/pyastroweatherio.egg-info/requires.txt +0 -0
  15. {pyastroweatherio-0.43.1.dev3 → pyastroweatherio-0.43.1.dev5}/pyastroweatherio.egg-info/top_level.txt +0 -0
  16. {pyastroweatherio-0.43.1.dev3 → pyastroweatherio-0.43.1.dev5}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyastroweatherio
3
- Version: 0.43.1.dev3
3
+ Version: 0.43.1.dev5
4
4
  Summary: Python Wrapper for 7Timer and Met.no REST API
5
5
  Home-page: https://github.com/mawinkler/pyastroweatherio
6
6
  Author: Markus Winkler
@@ -287,7 +287,7 @@ class AstroWeather:
287
287
 
288
288
  utc_to_local_diff = self._astro_routines.utc_to_local_diff()
289
289
  _LOGGER.debug("UTC to local diff: %s", str(utc_to_local_diff))
290
- _LOGGER.debug("Forecast length: %s", str(len(self._weather_data_seventimer)))
290
+ _LOGGER.debug("Forecast length 7timer: %s", str(len(self._weather_data_seventimer)))
291
291
 
292
292
  # Met.no
293
293
  metno_index = -1
@@ -429,6 +429,7 @@ class AstroWeather:
429
429
 
430
430
  start_indexes = []
431
431
  # Find start index for two nights and store the indexes
432
+ _LOGGER.debug("Forecast data length: %s", str(len(self._forecast_data)))
432
433
  for idx, row in enumerate(self._forecast_data):
433
434
  if row.forecast_time.hour % 24 == sun_next_rising.hour and len(start_indexes) == 0:
434
435
  start_indexes.append(0)
@@ -436,7 +437,7 @@ class AstroWeather:
436
437
  start_indexes.append(idx)
437
438
 
438
439
  forecast_data_len = len(self._forecast_data)
439
- for day in range(0, 2):
440
+ for day in range(0, len(start_indexes)):
440
441
  start_forecast_hour = 0
441
442
  start_weather = ""
442
443
  interval_points = []
@@ -543,16 +544,7 @@ class AstroWeather:
543
544
  - self._calm_weight
544
545
  )
545
546
  )
546
- # _LOGGER.debug(
547
- # "Calc condition cloudcover: %d(%d), seeing %d(%d), transparency: %d(%d), condition %d",
548
- # cloudcover,
549
- # self._cloudcover_weight,
550
- # seeing,
551
- # self._seeing_weight,
552
- # transparency,
553
- # self._transparency_weight,
554
- # condition,
555
- # )
547
+
556
548
  return condition
557
549
 
558
550
  async def calc_dewpoint2m(self, rh2m, temp2m):
@@ -624,8 +616,16 @@ class AstroWeather:
624
616
  json_data_astro = await self.async_request_seventimer("astro", "get")
625
617
  astro_dataseries = json_data_astro.get("dataseries", {})
626
618
 
627
- self._weather_data_seventimer = astro_dataseries
628
- self._weather_data_seventimer_init = json_data_astro.get("init")
619
+ if astro_dataseries != {}:
620
+ self._weather_data_seventimer = astro_dataseries
621
+ self._weather_data_seventimer_init = json_data_astro.get("init")
622
+ else:
623
+ # Fake 7timer weather data if service is broken
624
+ # This eliminates consideration of seeing, transparency, and lifted_index
625
+ self._weather_data_seventimer = []
626
+ for index in range(0, 20):
627
+ self._weather_data_seventimer.append({"timepoint": index * 3, "seeing": 0, "transparency": 0, "lifted_index": 0})
628
+ self._weather_data_seventimer_init = datetime.now().strftime("%Y%m%d%H")
629
629
  else:
630
630
  _LOGGER.debug("Using cached data for 7Timer")
631
631
 
@@ -668,9 +668,13 @@ class AstroWeather:
668
668
 
669
669
  return data
670
670
  except asyncio.TimeoutError as tex:
671
- raise RequestError(f"Request to endpoint timed out: {tex}") from None
671
+ _LOGGER.error(f"Request to endpoint timed out: {tex}")
672
+ return {}
673
+ # raise RequestError(f"Request to endpoint timed out: {tex}") from None
672
674
  except ClientError as err:
673
- raise RequestError(f"Error requesting data: {err}") from None
675
+ _LOGGER.error(f"Error requesting data: {err}")
676
+ return {}
677
+ # raise RequestError(f"Error requesting data: {err}") from None
674
678
 
675
679
  finally:
676
680
  if not use_running_session:
@@ -1,6 +1,6 @@
1
1
  """Constant Definitions for AstroWeather."""
2
2
 
3
- BASE_URL_SEVENTIMER = "https://www.7timer.info/bin/api.pl"
3
+ BASE_URL_SEVENTIMER = "https://www.7timer.info2/bin/api.pl"
4
4
  BASE_URL_MET = "https://api.met.no/weatherapi/locationforecast/2.0/complete"
5
5
  HEADERS = {"User-Agent": "AstroWeather github.com/mawinkler/astroweather"}
6
6
  STIMER_OUTPUT = "json"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyastroweatherio
3
- Version: 0.43.1.dev3
3
+ Version: 0.43.1.dev5
4
4
  Summary: Python Wrapper for 7Timer and Met.no REST API
5
5
  Home-page: https://github.com/mawinkler/pyastroweatherio
6
6
  Author: Markus Winkler
@@ -3,7 +3,7 @@ from setuptools import setup
3
3
  setup(
4
4
  name="pyastroweatherio",
5
5
  packages=["pyastroweatherio"],
6
- version="0.43.1.dev3",
6
+ version="0.43.1.dev5",
7
7
  license="MIT",
8
8
  description="Python Wrapper for 7Timer and Met.no REST API",
9
9
  long_description=" ".join(