Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: DylanGore/PyMetEireann
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.3
Choose a base ref
...
head repository: DylanGore/PyMetEireann
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 5 commits
  • 2 files changed
  • 3 contributors

Commits on Aug 16, 2021

  1. Fix missing temperature issue - Fixes #2 (#3)

    * Add time parameter to API URL
    
    * Bump version
    
    * include the current hour in calculations
    
    * Fix mistake in timestamp comparison
    DylanGore authored Aug 16, 2021
    Copy the full SHA
    d0d5e1e View commit details
  2. Copy the full SHA
    8608134 View commit details

Commits on Nov 23, 2024

  1. For get_current_weather, use hourly data (#7)

    This will return current-conditions weather as opposed to "aggregate for
    rest of day" weather.
    
    Fixes home-assistant/core#101653
    lutzky authored Nov 23, 2024
    Copy the full SHA
    5546400 View commit details
  2. Copy the full SHA
    b0a4af0 View commit details
  3. Bump version number

    DylanGore committed Nov 23, 2024
    Copy the full SHA
    ac8f268 View commit details
Showing with 11 additions and 6 deletions.
  1. +6 −4 meteireann/__init__.py
  2. +5 −2 setup.py
10 changes: 6 additions & 4 deletions meteireann/__init__.py
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
import pytz
import xmltodict

API_URL = 'http://metwdb-openaccess.ichec.ie/metno-wdb2ts/locationforecast'
API_URL = 'http://openaccess.pf.api.met.ie/metno-wdb2ts/locationforecast'
WARNING_API_URL = 'https://www.met.ie/Open_Data/json/warning_'

# Map each region code to a region name
@@ -164,8 +164,11 @@ def __init__(self, websession=None, api_url=API_URL, latitude=54.7210798611, lon
'''Initialize the weather object.'''
# pylint: disable=too-many-arguments

# Get the current UTC time
now = datetime.datetime.utcnow()

# Store the forecast parameters
self._api_url = f'{api_url}?lat={latitude};long={longitude};alt={altitude}'
self._api_url = f'{api_url}?lat={latitude};long={longitude};alt={altitude};from={now.date()}T{now.hour}:00'

# Create a new session if one isn't passed in
if websession is None:
@@ -202,7 +205,7 @@ async def fetching_data(self, *_):

def get_current_weather(self):
'''Get the current weather data from Met Éireann.'''
return self.get_weather(datetime.datetime.now(pytz.utc))
return self.get_weather(datetime.datetime.now(pytz.utc).replace(minute=0, second=0, microsecond=0), hourly=True)

def get_forecast(self, time_zone, hourly=False):
'''Get the forecast weather data from Met Éireann.'''
@@ -226,7 +229,6 @@ def get_weather(self, time, max_hour=6, hourly=False):
# pylint: disable=too-many-locals
if self.data is None:
return {}

day = time.date()
daily_temperatures = []
daily_precipitation = []
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
name='PyMetEireann',
packages=['meteireann'],
install_requires=['xmltodict', 'aiohttp', 'async_timeout', 'pytz'],
version='0.3',
version='2024.11.0',
description='A library to communicate with the Met Éireann Public Weather Forecast and Weather Warning APIs',
long_description=long_description,
long_description_content_type='text/markdown',
@@ -19,9 +19,12 @@
license='MIT',
url='https://github.com/DylanGore/PyMetEireann/',
classifiers=[
'Development Status :: 3 - Alpha',
'Development Status :: 4 - Beta',
'Environment :: Console',
'Environment :: Other Environment',
'Framework :: aiohttp',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Topic :: Home Automation',