Using the UK Government COVID19 Lockdown API

Table of Contents

Metadata #

  • Title: Using the UK Government COVID19 Lockdown API
  • Applies to: Home Assistant
  • Last Updated: 16 November 2020

Overview #

To use the official API, add the following to sensor.yaml:

- 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"] }}'

Resources #

Powered by BetterDocs

Leave a Reply