mendhak / waveshare-epaper-display

At-a-glance dashboard for Raspberry Pi with a Waveshare ePaper 7.5 Inch HAT. Date/Time, Weather, Alerts, Google/Outlook Calendar
https://code.mendhak.com/raspberrypi-epaper-dashboard/
438 stars 65 forks source link

Met Eireann weather provider #34

Closed jmason closed 2 years ago

jmason commented 2 years ago

A new weather provider using Ireland's national weather service, Met Eireann. (also a tidier version of https://github.com/mendhak/waveshare-epaper-display/pull/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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

mendhak commented 2 years ago

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

mendhak commented 2 years ago

@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. :+1:

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 commented 2 years ago

@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?

mendhak commented 2 years ago

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!