Home Assistant - OpenSky Integration (Who's flying above your house)

Home Assistant - OpenSky Integration (Who's flying above your house)

Good evening all! This post will be a short one but it's all about how to figure out what pesky planes/helicopters/Superman is flying above your house! Why you may ask? God knows really, it's a bit of a fad 'sensor/integration' to add into Home Assistant but why the heck not? It's a relatively easy setup and uses the 'OpenSky' integration so let's get cracking ...

Simply create a new sensor in Home Assistant with the following:

  - platform: opensky
    name: OpenSky  # Optional
    radius: 10 # Radius of region to monitor (uses default HA location)

Easy as fuck. Once you've restarted Home Assistant you'll have a brand new sensor called sensor.opensky. That's all fine and dandy however the sensor by itself only outputs a simple count of aircraft in that radius and doesn't provide much else.

If you've had a look at the link above (here again if you missed it), you'll see the second part to this integration is how to setup a push notification to tell you exactly what aircraft is overhead. We'll get onto the push notification bit at the end but for now we're going to create another sensor in order to get the callsign of the aircraft and display it within an entities card. For this we'll need to use another integration called 'Event Sensor'. This will allow us to get the callsign data, initially only obtainable through the automation trigger event, and pipe this into a new sensor. Head over to this link or search for 'Event Sensor' in HACS to get this added/installed into Home Assistant. Once done, create a new sensor with the following:

platform: eventsensor
name: OpenSkyFlights
event: opensky_entry
state: callsign

Save that bitch and restart Home Assistant and then like magic, you'll have another new sensor called sensor.openskyflights. This new sensor will now provide you with the 'callsign' instead of just an amount ...

To create this fabulous looking card, setup an entities card like so ...

type: entities
  - entity: sensor.openskyflights
    type: 'custom:multiple-entity-row'
    name: Flights Overhead
    icon: 'mdi:airplane'
    secondary_info: last-changed

Finally, if you want to get a push notification on this shit, here is the magic you'll need ...

  - alias: 'Flight entry notification'
      platform: event
      event_type: opensky_entry
      service: notify.mobile_app_<device_name>
        message: 'Flight entry of {{ trigger.event.data.callsign }}'