Aurorawatch UK Integration

Anyone got Aurorawatch UK integrated with home assistant? I know there are other aurora integrations but I live in Shetland and specifically want data from their Shetland project.

There’s an api of sorts (xml not rest) here: API v0.2 · AuroraWatch UK

I was hoping I could work out how to fetch status and activity from here but I’m not a developer and cant even work out how to view the xml for the Shetland site let alone extract the relevant data from it.

I also found this Python project from one of the Aurorawatch team which feels like it could be modified into a HA custom component but I dont have the skills!

I’m totally open to workarounds too. Anyone got any ideas or advice??

You could use a rest sensor to extract the information you want. It converts xml to json for easy use in value_templates.

There is also the Scrape integration

I added the following to my Sensor config and it seemed to give me what I wanted, you may want to tweak it to suit you.

  - platform: scrape
    name: Aurorawatch
    select: "status > description"


Scrape really is a bad choice. Use restful to access the API.

This part of the api is no use. It’s literally just a list of the descriptions of what each alert level means. Nothing to do with live data.

Restful approach is what I had in mind, but the problem is I can’t work out what the relevant URL would be for the XML. It’s the ‘Site activity’ section from the docs that’s of interest, but docs give no example url for this.

I was hoping it would be something like but nothing I’ve tried works. Assumed someone here may have worked it out.

Paste the example xml from the activity API into this and convert to json:

Copy the output of that and paste it into the left hand column of this:

Drill down on the right hand side to the data you want.

The path to the json data is at the top of the right hand coloumn. Replace x with value_json and you have the value template information for the restful sensor state.

This definitely put me on the right track. Still took a fair bit of time for me to suss out the rest of it, but learning stuff along the way is part of the joy.

Main point is, I got it working how I want :+1:t3:

For anyone trying to do the same thing in future:

  - scan_interval: 180
      - name: "Aurora Activity"
        json_attributes_path: "$.site_activity.activity[23]"
          - '@status_id'
          - value
          - datetime
        value_template: 'OK'

Then for some individual sensors…

  - sensor:
      - name: Aurora Value
        unique_id: "aurora_value"
        state: "{{ state_attr('sensor.aurora_activity', 'value') }}"
        unit_of_measurement: 'nT'
      - name: Aurora Status
        unique_id: "aurora_status"
        state: "{{ state_attr('sensor.aurora_activity', '@status_id') }}"

I’m using data from the Shetland site at Sumburgh, but you can find XML links for the others at

Thanks for the pointers folks!!

Not bad for a first effort. However there is a better way that does not require the use of template sensors. You can create all the sensors in the rest integration:

  - scan_interval: 180
      - name: "Aurora Value"
        value_template: "{{ value_json.site_activity.activity[23]['value'] }}"
      - name: "Aurora Status"
        value_template: "{{ value_json.site_activity.activity[23]['@status_id'] }}"
      - name: "Aurora Date"
        value_template: "{{ value_json.site_activity.activity[23]['datetime'] }}"

The example for the rest sensor documentation really needs updating. This is at least the third time I’ve seen someone do this. I’ll create a PR to add some better examples later.

Thanks @tom_l - i did see this in the docs and tried it. I was constantly switching between the RESTful doc pages to try and work it out but couldn’t get the right syntax. I think some more XML examples in the docs would help too so folk like me can more easily work out the right code for their situation.

Or this way to have value as the sensor value and the datetime and @status_id as attributes:

  - platform: rest
    scan_interval: 180
    name: "Aurora Activity"
    value_template: "{{ value_json.site_activity.activity[23]['value']}}"
    json_attributes_path: "$['site_activity']['activity'][23]"
      - datetime
      - '@status_id' 
1 Like

I’m struggling to get this to work. The data shown is always midnight and the new values later on in the day are not picked up. Any idea how to make the request take the newest data and not always midnight from the xml?

The value i keep getting with both versions of the code above is 919.2 :

<activity status_id="red">




Any help greatly appreciated, first timer posting here.

I have set this up, super easy with your instructions thanks! However I can see that you are using sum-activity.xml this is the data from the Shetland site. From browsing here Index of /0.2.5/project/awn/ ( I can see there is a cwx.xml which is from a Cumbernauld station which is closer to where I live than Shetland. If I try to replace sum-activity.xml with cwx-activity.xml I get a 404 error. Do you know how I can switch from the Shetland site to the Cumbernauld one?


Hi All,
Im sorry to be a pain here Im super new to HA and Im in the middle of setting up a load of sensors.

I am interested in add this to my UI but I have no idea as to where I would be adding this code?

I don’t think there is actually any activity data in the Cumberbauld xml file - just details on the available graphics. I think the only available data (activity) feeds are here: Index of /0.2.5/status/project/awn/

You would add this to your configuration.yaml file, but if you are unsure I would suggest making sure you thoroughly read the documentation on manually adding sensors - in this case the RESTful sensor integration: RESTful Sensor - Home Assistant

1 Like

Thanks @fenty17