Hi Gregology I’ve done a similar thing for my brothers pool - see here Rest Sensor receiving JSON - Astralpool - connectmypool.com.au - #5 by smck83 where i use the rest sensor to update and then use sensor templates to update to a specific value. The only thing here, is I don’t have an enormous amount of data in the json blob. Also it looks like that dataset might change on incremental updates only.
This may work if you only want <10 flights, but if you added 100s or 1000s it could mean 100s or 1000s of individual sensors - ideally the resource would support passing a flight number or pagination to reduce the size of the response but I’m not familiar with what is storing that data. You could for example host a custom aircraft.php file that loads the large json file and only responds with the queries data - nodered might help here too and then have HA query /aircraft.php?flight=BCS954 or using pagination e.g. /aircraft.php?limit=50&page=1 - i think the former makes more sense though depending on what your goal is.
- platform: rest
name: SkyAware
resource: http://192.168.8.182:8123/local/test/aircraft.json
method: GET
scan_interval: 60
value_template: 'OK'
json_attributes:
- now
- messages
- aircraft
and then use a template sensor for a particular result
- platform: template
sensors:
skyaware_first_result:
friendly_name: Skyaware First Result
value_template: '{{ states.sensor.skyaware.attributes["aircraft"][0] }}'
skyaware_second_result:
friendly_name: Skyaware Second Result
value_template: '{{ states.sensor.skyaware.attributes["aircraft"][1] }}'
Using the small dataset you provided - the above produces two sensors with attributes that could be used.
If the aircraft.json data isnt all flights but only the incremental updates i also wonder whether it might be more efficient to push it into MQTT (maybe with nodered?).
PS> Looking forward to our next hacking session