Forgive me if the formatting is not correct here, I am copying it from my phone.
This code in your configuration.yaml will parse all of the data from your local ADSB into attributes of a sensor. The initial value of the sensor will be a large number (messages) but the attributes have all the info.
I used an earlier post in this thread, but I pulled more attributes from it. If it detects multiple aircraft it will show further information which I believe you can obtain by changing the number in the square brackets. However, I’m still rather new to API’s.
Note: replace with your IP to your host.
- platform: rest
name: FR24 Flight Details
resource: http://192.168.2.12:8080/data/aircraft.json
value_template: "{{ value_json.messages }}"
json_attributes_path: "$.aircraft[:1]"
method: GET
scan_interval: 60
json_attributes:
- hex
- flight
- alt_baro
- alt_geom
- gs
- emergency
- category
- nav_modes
- lat
- lon
- messages
- seen
- alert
- seen-pos
You can remove the fields as necessary. ‘Flight’ is the flight number, Hex is your Mode S hex number.
Then, you can add a sensor showing the recent call sign:
- platform: template
sensors:
fr24_callsign:
friendly_name: FR24 Callsign
value_template: >
{{ state_attr('sensor.fr24_flight_details','flight') }}
You could then create an automation using the sensor ‘fr24_callsign’
If the formatting is all messed up I’ll do a better job of it on the computer tomorrow.
Also, I’m far from an expert. I know there’s further information to be pulled from the JSON but I’m not quite there yet. Perhaps someone a little more clued up can expand/correct me on this.
Either way, I hope it gives you a bump in the right direction for what you’re looking to achieve. Good luck!
Edit: sorry for the triple post. I haven’t really posted anything on here before. I haven’t used a forum for years, and I’m showing it.