I wonder if someone can help me with this problem.
As an update to my aircraft data table I wanted to add in other calculations using Node Red and I had sort of solved the issue in getting the data to Home Assistant as separate entities for each aircraft, but it leaves outdated info in the table.
So I have attempted a different solution and generated a json file with Node Red, which is stored in the /share/ folder of home assistant.
{"airplanes":[{"hex":"40717c","flight":"EXS36PN","height":37000,"speed":"424","dir":187,"lat":"50.66","lon":"-3.35","alt":37000,"km":63,"nm":34,"azimuth":35,"elev_angle":35,"state":"6","ts":0,"last_updated":"2023-11-01T16:43:11.000593+00:00"},{"hex":"40690a","flight":"EZY70FE","height":39025,"speed":"437","dir":185,"lat":"50.18","lon":"-3.34","alt":39025,"km":51,"nm":28,"azimuth":109,"elev_angle":50,"state":"6","ts":0,"last_updated":"2023-11-01T16:43:11.000593+00:00"},{"hex":"4d2155","flight":"VJT993","height":40000,"speed":"482","dir":353,"lat":"51.27","lon":"-6.47","alt":40000,"km":224,"nm":121,"azimuth":301,"elev_angle":9,"state":"6","ts":0,"last_updated":"2023-11-01T16:43:11.000593+00:00"}]}
I now want to use this in the config as a rest entry as follows
- platform: rest
name: planes
resource: http://192.168.1.130/share/airdata.json
value_template: >
{{ value_json.airplanes | length }}
method: GET
scan_interval: 60
json_attributes:
- "airplanes"
- "flight"
- "height"
- "speed"
- "dir"
- "lat"
- "lon"
- "alt"
- "km"
- "nm"
- "azimuth"
- "elev_angle"
- "state"
- "ts"
- "last_updated"
To test my json file I have uploaded it to my personal webspace and set the resource to my website URL and that works perfectly, but this does not work with the resource file as referenced above. I assume this is because it is not formed properly as an http file. Using the resource as a file:// doesn’t work as that has different criteria.
Can someone give me some help to get this working, I have spent countless hours trying, but lack of knowledge has beaten me.