Tracking an aircraft

Here’s how to track an aircraft N number and send notifications

configuration.yaml

#
## Let's watch a jet (NJET)
#
rest:
  scan_interval: 1200
  resource: https://api.adsb.lol/v2/reg/NJET
  sensor:
    - name: njet_adsb
      value_template: '{% if value_json.total != 0 %}Online{% else %}Offline{% endif %}'
    - name: njet_flight
      value_template: '{{ value_json.ac[0].flight }}'
    - name: njet_squawk
      value_template: '{{ value_json.ac[0].squawk }}'
    - name: njet_emergency
      value_template: '{{ value_json.ac[0].emergency }}'
    - name: njet_lat
      value_template: '{{ value_json.ac[0].lat }}'
    - name: njet_lon
      value_template: '{{ value_json.ac[0].lon }}'
    - name: njet_alt
      value_template: '{{ value_json.ac[0].alt_baro }}'
    - name: njet_track
      value_template: '{{ value_json.ac[0].track }}'
    - name: njet_gs
      value_template: '{{ value_json.ac[0].gs }}'

Then add some automatons

Change from offline to online

alias: NJET
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.njet_adsb
    to: Online
condition: []
action:
  - service: notify.notify
    data:
      title: NJET {{ states('sensor.njet_flight') }}
      message: >-
        Sqwk:{{ states('sensor.njet_squawk') }} Emrg:{{
        states('sensor.njet_emergency') }} Lat:{{ states('sensor.njet_lat') }}
        Lon:{{ states('sensor.njet_lon') }} Trk: {{
        states('sensor.njet_track') }} {{ states('sensor.njet_alt') }}ft {{
        states('sensor.njet_gs') }}kts
mode: single

Aircraft movement

alias: NJET Moving
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.njet_lat
condition: []
action:
  - service: notify.notify
    data:
      title: NJET {{ states('sensor.njet_flight') }}
      message: >-
        Sqwk:{{ states('sensor.njet_squawk') }} Emrg:{{
        states('sensor.njet_emergency') }} Lat:{{ states('sensor.njet_lat') }}
        Lon:{{ states('sensor.njet_lon') }} Trk: {{
        states('sensor.njet_track') }} {{ states('sensor.njet_alt') }}ft {{
        states('sensor.njet_gs') }}kts
mode: single
2 Likes

That’s awesome, thanks for posting! I may try this on my wall tablet, I like following a medflight helicopter that flies over my house from a local airport.

1 Like

Very nice, I have something that combines me manually typing in the callsign, then opensky finds the icao24 based on that with which opensky (othe endpoint) can track in realtime, showing it on a map…but the whole is unreliable as opensky is … an dhaving to go multiple steps to find a plane is less nice too

Few months ago I searched a lot for another solution…and now I seem to have one…thanks!

Any thoughts on best way to set this up to track a specific flight on a specific day and then stop until asked to do that again?

Use case is someone is coming to visit and I need to pick up at the airport, so I could put their flight in and get updates.

I am making progress replacing the opensky one, this adsb is soo much more repsonsive…really like it.
However… as most the providers in the area are limiting api calls, is there any foreseeable risk this becomes restricted/paid?
@UngluedChalice I am using a command_line sensor that loads data based on the callsign that I manually type in (input-text helper). You can automate a refresh of that sensor based on a date…I would base it on a calendar entry

Wanted to add my current (not very fancy looking) trickeries with this solution
In fact, I created a few command_line sensors and with ‘jq’ I get the data out in a format that allows me to use it further in HA. The refresh button makes it easy to refersh if I cannto wait for the 10mins refresh cycle

1 Like

If I want use the tracking nothing seems to work…

2024-03-09 08:24:43.511 ERROR (MainThread) [custom_components.flightradar24] FlightRadar24: No flight found by number - F-HXKI

2024-03-09 08:25:36.055 ERROR (MainThread) [custom_components.flightradar24] FlightRadar24: No flight found by number - 39dd48

2024-03-09 08:25:59.908 ERROR (MainThread) [custom_components.flightradar24] FlightRadar24: No flight found by number - MICKY

2024-03-09 08:26:38.040 ERROR (MainThread) [custom_components.flightradar24] FlightRadar24: No flight found by number - OE-LKK

This post has nothing with flightradar24, this is a REST integration with api.adsb.lol

I made a first stab at a custom integration

Appreciate suggestions/issues in the git issues

Issues · vingerha/ha_adsb_lol (github.com)

1 Like

And I have now improved the flights around a self-chosen person/zone. The removal of old flights was not working fine… and it tracks the flights now along the refresh frequency

image

EDIT:

Looks nice… I added my location as interest (Near Schiphol Airport)
I see now many “services” without entities already.

Does is make sense to create just one entity that will update all the time and put all aircrafts into attributes?

Will add this as feedback on github as well.

Yeah…noticed this too but am not the expert in this dev area.
The code removes old entities

I found the culprit of having multiple services and will fix it today. Also rethinking the naming a bit :slight_smile:

1 Like

btw…if someone has ideas on what could be added… I am preparing to make this part of HACS

1 Like