Transport for NSW parking sensor

Hi all,

This may be of interest to any one who uses one of the NSW transport parking stations. I built a sensor using the parking API to get the information on how many spots are available. It uses the same API key required to get the official transport NSW integration working.

  - platform: rest
    resource: "https://api.transport.nsw.gov.au/v1/carpark?facility=(car park ID)"
    method: GET
    name: "Name of parking"
    scan_interval: 60
    headers:
      accept: "application/json"
      Authorization: "apikey (your key here remove bracket)"
    value_template: "{{ (number of spots) - (int(value_json.occupancy.total)) }}"
    unit_of_measurement: car spaces

(Car Park ID) replace with number from link below and remove brackets
(Number of Spots) replace with number of spots from link below and remove brackets

Maybe someone can make this better but I found it useful so thought i’d share it.