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.
https://mobile.twitter.com/nicktheguitar/status/1315933472742150144
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'
json_attributes:
- lockdownstatus
- nonessentialshops
- twohouseholds
- gymsandfitness
- meetoutdoors
- pubsandrestuarants
value_template: 'OK'
scan_interval:
minutes: 61
- platform: template
sensors:
lockdown_status:
friendly_name: Lockdown status is
value_template: '{{ states.sensor.lockdown_update.attributes["lockdownstatus"] }}'
nonessential_shops_open:
friendly_name: Non-Essential Shops are open?
value_template: '{{ states.sensor.lockdown_update.attributes["nonessentialshops"] }}'
two_households_meet:
friendly_name: Two Households can meet?
value_template: '{{ states.sensor.lockdown_update.attributes["twohouseholds"] }}'
gyms_and_fitness_open:
friendly_name: Gyms Are Open?
value_template: '{{ states.sensor.lockdown_update.attributes["gymsandfitness"] }}'
meet_outdoors:
friendly_name: Can We Meet Outdoors?
value_template: '{{ states.sensor.lockdown_update.attributes["meetoutdoors"] }}'
pubs_and_restuarants_open:
friendly_name: Pub Are Open?
value_template: '{{ states.sensor.lockdown_update.attributes["pubsandrestuarants"] }}'
@nicktheguitar is the man that created and posted on twitter