Ok so playing with APIs and the rest sensor is new to me. With that said, I was able to create a simple rest sensor with the following:
https://data.nj.gov/resource/nv37-s2zn.json
Now, using that I created the following sensor:
- platform: rest
resource: https://data.nj.gov/resource/nv37-s2zn.json
method: GET
name: "NJ Cannabis"
json_attributes:
- name
- town
value_template: '{{ value_json ["name"]["town"] }}'
scan_interval: 86400
This is great, but it obviously only pulls the first ‘name’ and ‘town’ in the json.
What I would like to do is create a sensor for each listed location, pulling the name, town and location so I can use the proximity sensor to update a card with the location I’m closest to (using my phone’s device tracker).
The main issue is I’m unsure how to specify which ‘name’, ‘town’ etc within the json each sensor should be pulling from. Hopefully that makes sense.