Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Met Eireann weather provider #34

Merged
merged 17 commits into from
Apr 8, 2022

Conversation

jmason
Copy link
Contributor

@jmason jmason commented Mar 23, 2022

A new weather provider using Ireland's national weather service, Met Eireann. (also a tidier version of #33)

I think it should also achieve the license condition of supporting the alert API as well, which handily enough uses the same format as the Met Office one. I haven't seen what this looks like in reality yet though.... as there is no weather alert in progress right now :)

@jmason
Copy link
Contributor Author

jmason commented Mar 28, 2022

FYI, this displayed a severe weather warning this morning -- "small craft warning for all coasts", although it looks like this is not due to happen until Wednesday:

"Small Craft warning for all coasts of Ireland
Northeasterly winds will reach force 6 or higher on all Irish coasts.

Valid: 09:00 Wednesday 30/03/2022 to 00:00 Friday 01/04/2022

Issued: 06:32 Monday 28/03/2022"

So the alert support is working, albeit may need a little work to filter out distant events. For the record, this is what the RSS doc looks like:

<channel>
<atom:link rel="self" type="application/rss+xml" href="https://www.met.ie/warnings"/>
<title>Met Éireann Warnings</title>
<link>https://www.met.ie/warnings</link>
<description>Warnings issued by Met Éireann. This RSS feed displays valid warnings for land areas only. Sea area warnings will be added at a later date. Clicking the links, loads the CAP (Common Alerting Protocol) XML file. Note: Moderate means ‘Status Yellow’, Severe means ‘Status Orange’ and extreme means ‘Status Red’</description>
<copyright>Public Domain</copyright>
<language>en</language>
<item>
<title>Small Craft warning for all coasts of Ireland</title>
<link>https://cap.met.ie//2.49.0.1.372.0.220328053202.N_Norm016_SmallCraft.xml</link>
<description>Northeasterly winds will reach force 6 or higher on all Irish coasts.</description>
<author>forecasts@met.ie (Met Éireann)</author>
<category>Marine</category>
<guid>https://cap.met.ie//2.49.0.1.372.0.220328053202.N_Norm016_SmallCraft.xml</guid>
<pubDate>Mon, 28 Mar 2022 05:32:02 GMT</pubDate>
</item>
<atom:link href="https://www.met.ie/warningsxml/rss.xml" rel="self" type="application/rss+xml"/>
</channel>
</rss>```

Unfortunately the event duration and onset time are not visible here -- scraping into the cap.met.ie URL is required to find them.  On the upside this looks like a standardised XML format for this data -- the Common Alerting Protocol? so that code should be reusable....

```curl https://cap.met.ie//2.49.0.1.372.0.220328053202.N_Norm016_SmallCraft.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="https://cap.met.ie/cap-en-style.xsl"?>
<alert xmlns="urn:oasis:names:tc:emergency:cap:1.2">
  <identifier>2.49.0.1.372.0.220328053202.N_Norm016_SmallCraft</identifier>
  <sender>forecasts@met.ie</sender>
  <sent>2022-03-28T06:32:02+01:00</sent>
  <status>Actual</status>
  <msgType>Alert</msgType>
  <scope>Public</scope>
  <incidents></incidents>
  <info>
    <language>en-GB</language>
    <category>Met</category>
    <event>Small Craft</event>
    <responseType>Monitor</responseType>
    <urgency>Future</urgency>
    <severity>Moderate</severity>
    <certainty>Likely</certainty>
    <effective>2022-03-28T06:32:02+01:00</effective>
    <onset>2022-03-30T09:00:00+01:00</onset>
    <expires>2022-04-01T00:00:00+01:00</expires>
    <senderName>Met Éireann</senderName>
    <headline>Small Craft warning for all coasts of Ireland</headline>
    <description>Northeasterly winds will reach force 6 or higher on all Irish coasts.</description>
    <instruction></instruction>
    <parameter>
      <valueName>awareness_level</valueName>
      <value>2; yellow; Moderate</value>
    </parameter>
    <parameter>
      <valueName>awareness_type</valueName>
      <value>1; Wind</value>
    </parameter>
    <area>
      <areaDesc>for all coasts of Ireland</areaDesc>
      <geocode>
        <valueName>EMMA_ID</valueName>
        <value>EI807</value>
      </geocode>
      <geocode>
        <valueName>EMMA_ID</valueName>
        <value>EI822</value>
      </geocode>
      <geocode>
        <valueName>EMMA_ID</valueName>
        <value>EI809</value>
      </geocode>
      <geocode>
        <valueName>EMMA_ID</valueName>
        <value>EI812</value>
      </geocode>
      <geocode>
        <valueName>EMMA_ID</valueName>
        <value>EI814</value>
      </geocode>
      <geocode>
        <valueName>EMMA_ID</valueName>
        <value>EI820</value>
      </geocode>
      <geocode>
        <valueName>EMMA_ID</valueName>
        <value>EI806</value>
      </geocode>
      <geocode>
        <valueName>EMMA_ID</valueName>
        <value>EI813</value>
      </geocode>
      <geocode>
        <valueName>EMMA_ID</valueName>
        <value>EI810</value>
      </geocode>
      <geocode>
        <valueName>EMMA_ID</valueName>
        <value>EI818</value>
      </geocode>
      <geocode>
        <valueName>EMMA_ID</valueName>
        <value>EI805</value>
      </geocode>
      <geocode>
        <valueName>EMMA_ID</valueName>
        <value>EI816</value>
      </geocode>
      <geocode>
        <valueName>EMMA_ID</valueName>
        <value>EI815</value>
      </geocode>
      <geocode>
        <valueName>EMMA_ID</valueName>
        <value>EI821</value>
      </geocode>
      <geocode>
        <valueName>EMMA_ID</valueName>
        <value>EI819</value>
      </geocode>
      <geocode>
        <valueName>EMMA_ID</valueName>
        <value>EI808</value>
      </geocode>
      <geocode>
        <valueName>EMMA_ID</valueName>
        <value>EI817</value>
      </geocode>
      <geocode>
        <valueName>EMMA_ID</valueName>
        <value>EI811</value>
      </geocode>
    </area>
  </info>
</alert>

@mendhak
Copy link
Owner

mendhak commented Apr 1, 2022

Thanks will start looking at this soon. I'll try to push directly to your branch to resolve some conflicts (I just added weather.gov so there were bound to be some)

@jmason
Copy link
Contributor Author

jmason commented Apr 1, 2022

I think I've fixed the conflicts there....

@mendhak
Copy link
Owner

mendhak commented Apr 1, 2022

Ah OK I also did, good thing I didn't push or it'd make things worse! I'll have a look again.

Just tried your branch for Cork and I got this, looks good so far!

image

screen-weather-get.py Outdated Show resolved Hide resolved
@mendhak
Copy link
Owner

mendhak commented Apr 1, 2022

@jmason it was a real pleasure going through this PR. You took the time to follow the structure, comment patterns, debug logging, naming conventions, documentation, samples, and I appreciated your efforts here. 👍

I've also got a few question, I noticed in your branch, you've got a 3 color screen. I am curious to know how long does the screen refresh take?

What are the '20 km' and '143 km' values in the bottom right?

I also liked the 'today' and 'tomorrow' instead of today/tomorrow's date, it's a nice friendly idea, I will look to add this too.

@jmason
Copy link
Contributor Author

jmason commented Apr 4, 2022

@jmason it was a real pleasure going through this PR. You took the time to follow the structure, comment patterns, debug logging, naming conventions, documentation, samples, and I appreciated your efforts here. 👍

Cheers! :)

I've also got a few question, I noticed in your branch, you've got a 3 color screen. I am curious to know how long does the screen refresh take?

It's very slow -- 50-60 seconds or thereabouts to do a full screen refresh. As a result, I only update it once per hour, so that has a big impact on the pieces of data to display. For example, I don't include the minutes or seconds in the time display -- just the date and the hour. The 3-color output looks great though :)

What are the '20 km' and '143 km' values in the bottom right?

Those are the battery charge levels for our 2 electric cars; they're scraped from my local HomeAssistant instance.

I also liked the 'today' and 'tomorrow' instead of today/tomorrow's date, it's a nice friendly idea, I will look to add this too.

Cool, that'd be great :) I can provide diffs if that'd help?

jmason and others added 5 commits April 8, 2022 09:49
@mendhak
Copy link
Owner

mendhak commented Apr 8, 2022

Nice thanks for those answers, I'm always curious to see how this project is used

Cool, that'd be great :) I can provide diffs if that'd help?

It's fine, I've found it already, no worries!

@mendhak mendhak merged commit 1fb6c94 into mendhak:master Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants