Skip to content

ChrJohansen/ForecastAlert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ForecastAlert

A TimeTrigger Azure function which lets the user monitor different weather conditions and notify if these exceed a specified threshold value. It can also be triggered manually with the /manual endpoint

Setup

Azure

Blob Storage

This function needs an AlarmConfig.json file stored in a blob storage in the Azure portal. An example of the AlarmConfig.json can be found below.

Environment Variables

This function requires some environment variables to work which will differ from user to user:

  • SLACK_KEY - URL to Slack workflow. Should be setup as a secret
  • MET_USER_AGENT - See MET API Terms of Service
  • BLOB_URI - See Blog Storage section
  • BLOB_CONTAINER - See Blog Storage section
  • BLOB_NAME - See Blog Storage section

App Setting

  • ForecastSchedule - TimeTrigger Cron tab

Slack

You need to setup a workflow with a webhook containing a data variable named my_message.

Alert notification channels

The function currently only support ONE notification channel, which is Slack.

Alarm Config

The AlarmConfig.json is where you setup the alarms for the different locations you want to monitor.

Alarm types

The function currently supports two alarm types: Wind and Tidal.

Wind

Notify when the forecast exceeds the MaxWindSpeed threshold value. It can be further specified with one or more wind directions.

Tidal

Notify when the forecast exceeds the MaxWaterLevels threshold value

Example

{
  "Locations": [
    {
      "Latitude": "59.9139",
      "Longitude": "10.7522",
      "LocationName": "Oslo",
      "Alarms": [
        {
          "AlarmClass": "TidalClass",
          "AlarmType": "Tidal",
          "Name": "Oslo - High sea level",
          "MaxWaterLevels": 300
        },
        {
          "AlarmClass": "WindClass",
          "AlarmType": "Wind",
          "Name": "Oslo - Strong wind",
          "MaxWindSpeed": 25
        }
      ]
    },
    {
      "Latitude": "60.3913",
      "Longitude": "5.3221",
      "LocationName": "Bergen",
      "Alarms": [
        {
          "AlarmClass": "WindClass",
          "AlarmType": "Wind",
          "Name": "Bergen - String wind (S, W, SW)",
          "MaxWindSpeed": 25,
          "Directions": [
            "South",
            "West",
            "SouthWest"
          ]
        }
      ]
    }
  ]
}

Attribution

License

MIT License

Copyright

Copyright © 2025 - Christian Johansen

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages