Trigger event from Brisbane weather warnings (BASH scripted solution?)

Discussion in 'Programming & Software Development' started by davo-cc, Dec 17, 2020.

  1. davo-cc

    davo-cc Member

    Joined:
    Jan 29, 2006
    Messages:
    81
    I’m trying to find a solution which will allow me to shut down systems (located in a house in Brisbane) is a thunderstorm is headed towards the area based on warning data online.

    The process would be running RaspberryPi-OS on a Pi-3b+ as the primary controlling machine (it will remain on) and I’d like to run a script to check a source for alerts and warnings in the Brisbane area; presuming I’d source this from either the BOM or perhaps one of the state power authorities.

    I was hoping to run a BASH script in the cron scheduler (say, every 5 minutes) to check for elevated risk or a warning and then issue shutdowns accordingly. I can handle the shutdowns and so forth; it’s the data source I’m not as sure about.

    The systems are running on surge/spike protected boards (nothing too elaborate, it’s just a domestic setup) but I’d ideally like to shut down the systems in a civilised fashion if it’s getting rumbly outside. I’m not in the area myself (I’m in the UK so 10 hours behind), hence the desire for some automation.

    Has anyone seen a method for this that’s already been built for such a purpose? I was assuming I’d end up curling a site and looking for set keywords but I was wondering if there was a more precise method that someone could suggest.

    Thanks!
     
  2. Tinian

    Tinian Member

    Joined:
    Jan 3, 2009
    Messages:
    19,823
    Location:
    15.0° N, 145.63° E
  3. RnR

    RnR Member

    Joined:
    Oct 9, 2002
    Messages:
    16,532
    Location:
    Brisbane
    Hmm... could you consume BOM_Qld twitter feed and scan for "thunderstorm warning" and then maybe your local area? See an example tweet below...

    https://twitter.com/BOM_Qld/status/1338287881769652226

    Not sure what area's they have, or even if the tweets are automated and if so have a mostly standard format.
     
  4. Arctic_Silver08

    Arctic_Silver08 Member

    Joined:
    Aug 11, 2012
    Messages:
    1,389
    I'd personally just grab a UPS if it's nothing too intensive. Pretty easy to gracefully shutdown IF you lose power, rather than jumping on "weather warnings"

    - Just read you're in the UK, anyone that can plug it in for you?
     
  5. RnR

    RnR Member

    Joined:
    Oct 9, 2002
    Messages:
    16,532
    Location:
    Brisbane
    Sounds to me from the description that he wants to protect his gear from electrical strikes rather than power loss.
     
  6. Arctic_Silver08

    Arctic_Silver08 Member

    Joined:
    Aug 11, 2012
    Messages:
    1,389
    Possibly, he said he's running surge/spike protection though - my interpretation was he wanted to be able to shut things down properly to prevent data loss
     
  7. OP
    OP
    davo-cc

    davo-cc Member

    Joined:
    Jan 29, 2006
    Messages:
    81
    Woah thanks guys - appreciate the responses so quickly.

    Yep he's got a basic surge protection layer but nothing terribly fancy. I'm a little iffy on the protection value the lower end UPS's offer this type of setup, I've had mixed experience with them; the cost of a "proper" one would outweigh the value of the systems generally speaking.
    The guy who owns the kit works shifts and I'm trying to cater for running conversion jobs when he's at work (it's converting video with FFMPEG, converting a collection of videos to a more practical format but we have to use software for quality reasons so conversions take horrendous amounts of time).
    My thinking was to either stop the job or issue a hibernation order to the compressing machine (it's just running Debian 10.7 on an i7-4770). I was even thinking of a way of having a relay physically disconnecting a power chain (physical disconnection of the power boards), I think there's a device out there that could do this with a couple of wires from the Pi's GPIO pins.

    I've been curious about this method for some time actually, for example an automated method to "batten down the hatches" ahead of an incoming storm (doing things like retracting shade cloth sails, raising roller-shields on vulnerable windows, etc.). I heard of one which was set up to adjust the configuration of a greenhouse based on sun levels and storms, etc. which was quite clever; methods to do this are becoming cheaper now with ESP32 chipsets and off-the-shelf IoT devices becoming a little more mainstream.

    I'll look at that BOM feed and the Twitter feed too - I wondered if there was an IFTTT trigger or something out there, I think this would be quite a valuable service to provide for homes and industrial applications potentially. I've heard there are some here in Blighty which can do that for coastal areas but I've never looked into it.
     
  8. Tinian

    Tinian Member

    Joined:
    Jan 3, 2009
    Messages:
    19,823
    Location:
    15.0° N, 145.63° E
    I'll be interested in what you develop as I'd like much the same capability to automatically close a skylight rather than relying on a rain sensor.
     
  9. RnR

    RnR Member

    Joined:
    Oct 9, 2002
    Messages:
    16,532
    Location:
    Brisbane
  10. neRok

    neRok Member

    Joined:
    Aug 19, 2006
    Messages:
    4,002
    Location:
    Perth NOR
  11. RnR

    RnR Member

    Joined:
    Oct 9, 2002
    Messages:
    16,532
    Location:
    Brisbane
    Their notifications are mobile app notifications as they mention via the Weatherzone app. Email notifications could be useful from a serverside point of view. A bit more mucking about than just polling an api endpoint though.
     
  12. neRok

    neRok Member

    Joined:
    Aug 19, 2006
    Messages:
    4,002
    Location:
    Perth NOR
    Nah. If they had an SSE enabled endpoint, it's like 4 lines of code in python.

    I found an undocumented api being used by some apps on github.
    Code:
    # You can do a search for a location with;
    https://api.weather.bom.gov.au/v1/locations?search=Per
    
    # Then say I want Perth Airport ID=qd66qf4, see it's info with ;
    https://api.weather.bom.gov.au/v1/locations/qd66qf4
    
    # And it's current "observations" with;
    https://api.weather.bom.gov.au/v1/locations/qd66qf4/observations
    
    # And warnings probably come through;
    https://api.weather.bom.gov.au/v1/locations/qd66qf4/warnings
    
    Alternatively, they do have warnings RSS feed on the BOM that might be helpful: http://www.bom.gov.au/rss/?ref=ftr

    But looking at weatherzone, they do have a business orientated feature called Total Lightning Network that might be above and beyond any basic/free resources.
     
    Last edited: Dec 18, 2020
  13. RnR

    RnR Member

    Joined:
    Oct 9, 2002
    Messages:
    16,532
    Location:
    Brisbane
    I meant the email endpoint being more mucking about than a std api endpoint :)
     
    neRok likes this.
  14. OP
    OP
    davo-cc

    davo-cc Member

    Joined:
    Jan 29, 2006
    Messages:
    81
    Wow thanks everyone (sorry have been ill the past few days, my health is shocking). I'm going to look at those APIs and the feed, I'm not yet skilled in python (usually try to mush things together in BASH scripting but it's probably out of scope for that).
     

Share This Page

Advertisement: