Building an ADS-B receiver using Docker containers, feeding to Flightradar24, and Monitoring from Home Assistant!

Any aviation enthusiasts out there? This one is for you!

I recently bought an ADS-B USB Dongle, and built some docker containers to receive data from nearby aircraft, feed it to Flightradar24 (they give you a busines subscription for free for uploading data!), and also get some key information displayed on a Home Assistant Lovelace Dashboard :slight_smile:



Here is the overall data flow:

Here are the docker containers that I used:
Readsb to read data from the ADS-B dongle
Flightradar24 uploader to upload data to FR24
tar1090 image for an improved WebUI as well as an enhanced aircraft.json output

Follow the instructions on their respective pages to get these containers up and running in your docker environment. (If you are new to docker - Home Automation Guy’s youtube video is a great way to get started with docker!) You don’t have to run home assistant in a Docker container, this will work just as well if you’re running HASSOS. You just need to run readsb, tar1090 and the FR24 feeder in a docker environment. Why not set up a simple docker environment on a spare Raspberry Pi?

Make sure you set the TAR1090_ENABLE_AC_DB environment variable to true in tar1090, so you get the enhanced aircraft.json output!

Once your readsb, tar1090 and fr24 containers are up and running, you should be seeing aircraft close by! Now it’s time to pull some data into Home Assistant to monitor how we’re doing.

First off, configure your REST sensors by adding the following code to your configuration.yaml:

sensor:
  - platform: rest
    name: FR24 Aircraft
    resource: http://192.168.1.4:8078/data/aircraft.json  #change to your ip address
    value_template: "{{ value_json.messages }}"
    method: GET
    scan_interval: 15
    json_attributes:
      - now
      - aircraft
  - platform: rest
    name: FR24 Status
    resource: http://192.168.1.4:8754/monitor.json  #change to your ip address
    value_template: "{{ value_json.messages }}"
    method: GET
    scan_interval: 15
    json_attributes:
      - feed_alias
      - feed_num_ac_tracked
      - feed_status
      - rx_connected

Now you should have two new sensors in your HA called sensor.fr24_aircraft and sensor.fr24_status.

You can then create a couple of Lovelace cards. I use custom button card and mini graph card, install those first if you dont have them.

type: custom:button-card
icon: mdi:airplane
entity: sensor.fr24_status
tap_action:
  action: url
  url_path: app://com.flightradar24free
name: |
  [[[ return states['sensor.fr24_status'].attributes.feed_alias ]]]
styles:
  card:
    - border-radius: 5%
    - padding: 4%
    - color: black
    - font-size: 14px
    - text-shadow: 0px 0px 0px black
    - text-transform: capitalize
  grid:
    - grid-template-areas: '"i num" "n n" "feed feed" "rx rx" "graph graph"'
    - grid-template-columns: 1fr 1fr
    - grid-template-rows: 1fr min-content min-content min-content min-content
  name:
    - font-weight: bold
    - font-size: 20px
    - color: black
    - align-self: middle
    - justify-self: start
    - padding-bottom: 4px
  img_cell:
    - justify-content: start
    - align-items: start
    - margin: none
  icon:
    - width: 30%
    - margin-top: 0%
    - margin-left: 5%
  custom_fields:
    num:
      - align-self: start
      - justify-self: end
      - margin-top: 10%
      - font-size: 20px
    feed:
      - padding-bottom: 2px
      - align-self: middle
      - justify-self: start
      - '--text-colour-sensor': >-
          [[[ if (entity.attributes.feed_status != 'Connected') return "red";
          ]]]
    rx:
      - padding-bottom: 2px
      - align-self: middle
      - justify-self: start
      - '--text-color-sensor': '[[[ if (entity.attributes.rx_connected != 1) return "red"; ]]]'
custom_fields:
  num: |
    [[[
      return`${states['sensor.fr24_aircraft'].attributes.aircraft.length} Aircraft Tracked`
    ]]]
  feed: |
    [[[
      return`FR24 Feed: <span style="color: var(--text-colour-sensor);">${entity.attributes.feed_status}`
    ]]]
  rx: |
    [[[
      if (entity.attributes.rx_connected == 1)
        return`Receiver Dongle: <span style="color: var(--text-color-sensor);">Connected`
      return`Receiver Dongle: <span style="color: var(--text-color-sensor);">Disconnected`
    ]]]
  graph:
    card:
      type: custom:mini-graph-card
      entities:
        - entity: sensor.fr24_status
          attribute: feed_num_ac_tracked
          show_state: false
      hours_to_show: 24
      points_per_hour: 60
      show:
        icon: false
        name: false
        state: false
        labels: true

And to monitor aircraft (using a markdown card, formatted into a table):

type: markdown
content: >-
  | Flight | Aircraft | Registration | Altitude | Airspeed |

  |:---:|:---:|:---:|:---:|:---:|

  |{% for aircraft in state_attr('sensor.fr24_aircraft', 'aircraft') %} 

  |  {% if (aircraft.flight) is undefined %} Unavailable {% else %}  {{
  aircraft.flight }} {% endif %}  |  {% if (aircraft.t) is undefined %}
  Unavailable {% else %}  {{ aircraft.t }} {% endif %}  |  {% if (aircraft.r) is
  undefined %} Unavailable {% else %}  {{ aircraft.r }} {% endif %}  |  {% if
  (aircraft.alt_baro) is undefined %} Unavailable {% else %} 
  {{aircraft.alt_baro }} ft {% endif %}  |  {% if (aircraft.tas) is undefined %}
  Unavailable {% else %}  {{aircraft.tas }} kts {% endif %}  | 

  |{% endfor %}

Happy monitoring!

12 Likes

Thank you very much, great guide. I live next to an aerodrome and now I know who is flying low over my house and making my dog go bonkers :slight_smile:

2 Likes

Thank you @tejasitraj it works amazingly well!

1 Like

Hi, this is kx1t from the sdr-enthusiasts GitHub group. Please note that we have updated our recommended set of containers for this; you can now combine the readsb and tar1090 container into a single new one called ‘ultrafeeder’.

See here for the repo, or here for a Gitbook with step by step explanation on what to do.

1 Like

Alternatively, https://adsb.im will provide you with an interactive web page that enables you to set up your receiver effortlessly, automating the setup process without having to know much about Docker and Docker Compose.

1 Like