Lock Down API for the UK using HA REST

Let me strat by saying that i didn’t create this, i have copied this from a twitter post, which i have linked to,

Original twitter post with screenshots of the code in the follow up.

I just thought that it would easier for people to copy & pasta ( before some clever sod makes an Integration for UK GOV API https://coronavirus.data.gov.uk/developers-guide )

This uses the awesome API from https://www.lockdownapi.com/

Replace XXX with the first part of your postcode

- platform: rest
  name: Lockdown Update
  resource: 'https://www.lockdownapi.com/XXX'
  - lockdownstatus
  - nonessentialshops
  - twohouseholds
  - gymsandfitness
  - meetoutdoors
  - pubsandrestuarants
  value_template: 'OK'
    minutes: 61

- platform: template
      friendly_name: Lockdown status is
      value_template: '{{ states.sensor.lockdown_update.attributes["lockdownstatus"] }}'
      friendly_name: Non-Essential Shops are open?
      value_template: '{{ states.sensor.lockdown_update.attributes["nonessentialshops"] }}'
      friendly_name: Two Households can meet?
      value_template: '{{ states.sensor.lockdown_update.attributes["twohouseholds"] }}'
      friendly_name: Gyms Are Open?
      value_template: '{{ states.sensor.lockdown_update.attributes["gymsandfitness"] }}'
      friendly_name: Can We Meet Outdoors?
      value_template: '{{ states.sensor.lockdown_update.attributes["meetoutdoors"] }}'
      friendly_name: Pub Are Open?
      value_template: '{{ states.sensor.lockdown_update.attributes["pubsandrestuarants"] }}'

@nicktheguitar is the man that created and posted on twitter


should line 2 read :

name: lockdown_update


Seems to work with out it for me, I think that it’s like the friendly name so doesn’t need the underscore.

Pretty cool.
I have no use of it since I’m not from UK, but that is clever.
I would probably add an automation to trigger a notification when something changes.
But do you really need 61 minutes scan interval?
Isn’t once a day enough?

The automation you describe is exactly what I setup once I got it working.

I’ve got it running every 30 minutes I think, but that was a guess as I didn’t really know how often it would be changed.