PlaneCatcher script for tracking "interesting" aircraft that your station picks up

After this year’s UN Week, I wanted to see if my ADS-B receiver had picked up any of the cool aircraft that came to NYC but obviously wasn’t able to stare at the screen 24/7. I searched around but couldn’t find anything that did exactly what I wanted, which was to save and notify me of any aircraft from my receiver that met my criteria, so I decided to write my own script, which I called PlaneCatcher.

PlaneCatcher Features:
-Daily reports of aircraft of note, saved on Raspberry Pi
-Live notification on iOS, Android, or browser via Pushover with link to view on FlightAware
-Shows time first received, Flight ID, aircraft registration (or Mode-S hex if not available), and country
-Filter by exact registration (not all countries supported)
-Filter by registration country (again, not all supported)
-Filter by Mode-S hex
-Filter by Flight ID
-Works by querying aircraft.json at two second intervals

Example of Android notifications:

Example of daily report:
41%20PM

The code is available at: PlaneCatcherv1 - Pastebin.com

Setup:
-For notifications to work on Pushover, you need to have the requests Python module installed or rewrite the code to send HTTP POST requests without the module. You’ll also need a Pushover account.

  1. Copy python file onto Raspberry Pi.
  2. Fill out all the parts in the code marked with “////”
  3. Fill out the arrays in the code listed below:
    -“filteredairlines”: airlines you don’t want to be notified about, this takes the first three letters from the flight ID [e.g. “SWA”]
    -“filteredcountries”: aircraft from countries aircraft you don’t want to be notified about, use the country’s two letter code [e.g. “US”]
    -“desiredregs”: registrations you want to be notified about, this overrides the filteredairlines and filteredcountries list [e.g. “N123AB”]
    -“desiredairlines”: airlines you want to be notified about, this also overrides filteredairlines and filteredcountries
    -“desiredhexcodes”: any hexcodes for aircraft that don’t have registration support [e.g. “c060a6”]
  4. Start the daemon by running python NameOfSavedCodeFile.py start

Side notes:
-In the notification and in the daily summary if the registration can be calculated from the Mode-S hex it will be included. If not, the hex will take its place.
-If the country of origin can be calculated from the hex the two letter country code will be included. For the list of countries supported, see the first chunk of code. Also, I haven’t verified the countries other than the US and Canada.
-US Military hex codes are not included in the US filter. If you would like to filter military aircraft as well, find 0xA00000 and replace it with 0xAFFFFF.
-Countries that have registration calculation support are: United States, Canada, South Africa, France, Germany, Belgium, Denmark, Finland, Greece, Portugal, Romania, Turkey, Jordan, Pakistan, Singapore, Syria, Australia, Argentina, Russia, Cuba, South Korea, and Japan.
-The -flights.dat file shows each unique notified flight (no duplicates)
-The -raw.dat file shows all of the raw input from aircraft.json from notified flights
-My Raspberry Pi does not run the PiAware image so I can’t attest to its compatibility there, but I don’t see why there would be any issues.

Hope someone is able to find some utility from this! :grinning:

2 Likes

Good work. Looks good and useful.

I wanted to try it, but realized it requires me to install Pushover App on my phone, which I dont want as

  • My phone is already over-crowded with Apps
  • I dont want to pay US $4.99 (Canadian $6.43) for it.

Is there a way to get the notifications without installing any App? Like just by normal email?

Email is a good idea as well. I cobbled up something quick, so I’ve only tested it briefly, and with Yahoo Mail. Also at least with Yahoo Mail, you need to enable the “Allow apps that use less secure sign in” setting in Security for external SMTP to work.

Additional things you’ll need to fill out for the email version:
-“From” address
-“To” address
-Subject if you want to change it
-SMTP server address
-SMTP port
-SMTP login/password

I’ve left the SMTP settings for Yahoo Mail, but you’ll have to find the information for your email provider if you don’t use Yahoo.

SMTP Version

1 Like


Hi just came across this software .
Unfortunately i am getting an error (see screen capture enclosed)
Wonder if you have an idea what the error is ???

Maybe you made a copy error ?
When looking at the code it goes to line 320 and your error is listed on line 343 ?

The script looks like it’s using python 2 syntax; you’re trying to run it under python 3.

PHP & Python are pain in neck.

With each change in version, the command sysntax is also changed.

Also, installation command is not unified, i.e. not like apt install python or apt install php, letting apt to choose the latest version. One has to give version number also like apt install python3 or apt install php5.

Not really true for Python; backwards-incompatible syntax changes like this are very rare (it’s happened essentially once in the last 20 years). Think of Python 2 (released in 2000, officially discontinued in 2020) and Python 3 (released in 2008) as different languages.

I was not aware of the dates of python versions. Thanks for the nformation.

I formed bad idea about python when last year I tried to use gain optimization script of BartJr which was written in year 2016 using python2. It failed.

I then updated it to python3 and dump1090-fa ver 6.1 and above. It was only then when I realized that there is difference in the syntax of python2 and python3.