Met Office UK weather warnings

It’s been windy in the UK over the last few days!

The Met Office issues Weather Warnings (Yellow, Amber, Red) for events which are likely to cause disruption. I had assumed that I could get this data using the new Weather DataHub, but not so.

Instead, it’s trusty RSS feeds linked from this page.

To get this data into OpenHAB:

  1. Install the Feed Binding
  2. Create a new Feed Thing, with the URL pointing to the relevant regional feed that you’re interested in.
  3. Link Items to the Thing Channels

You will now have Items which contain the last issued Weather Warning.


I am subscribed to the North East feed.


UID: feed:feed:MetOfficeWeatherWarning
label: Met Office Weather Warning
thingTypeUID: feed:feed
  refresh: 20

Channels are automatically created by this binding. You can create linked Items quickly by using the Add Equipment To Model from the Channel tab of the above Thing.

I then trigger a rule if the LatestDescription Item changes, sending the description and link URL to a Matrix room, and the colour of the weather warning (or BLACK if there is none) to an Item called MetOfficeWeatherWarning_Colour:


configuration: {}
  - id: "1"
      itemName: MetOfficeWeatherWarning_LatestDescription
    type: core.ItemStateChangeTrigger
conditions: []
  - inputs: {}
    id: "2"
      type: application/javascript
      script: >
        var colour, description, link, i;

        var logger = Java.type('org.slf4j.LoggerFactory').getLogger('org.openhab.rule.' + ctx.ruleUID);

        colour = 'BLACK';

        description = itemRegistry.getItem('MetOfficeWeatherWarning_LatestDescription').getState();

        link = itemRegistry.getItem('MetOfficeWeatherWarning_LatestLink').getState();

        description += '';

        var i_list = ['YELLOW', 'AMBER', 'RED'];

        for (var i_index in i_list) {
          i = i_list[i_index];
          if (description.toUpperCase().indexOf(i) + 1 != 0) {
            colour = i;


        events.sendCommand('MetOfficeWeatherWarning_Colour', colour);

        if (description != 'UNDEF') {
          events.sendCommand('strMatrixMessageHomeRoom', description);
        } else {
          events.sendCommand('strMatrixMessageHomeRoom', 'Weather warning cleared.');

        if (link != 'UNDEF') {
          events.sendCommand('strMatrixMessageHomeRoom', link);
    type: script.ScriptAction