OzGav / opensky

Opensky custom component
GNU General Public License v3.0
3 stars 2 forks source link

Not working as expected or ? #1

Open vingerha opened 1 year ago

vingerha commented 1 year ago

Hi, I reworked it a bit to be able to install it as opensky2 via hacs, with the same name as the core integration it would not start, not sure how you got this to work It does load but then I receive this...

/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host 'opensky-network.org'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
  warnings.warn(

My config


  - platform: opensky2
    name: Nice Airport2
    radius: 40
    latitude: 43.6595
    longitude: 7.2127
    username: user
    password: pwd
    altitude: 9000
vingerha commented 1 year ago

On my ideas. I am trying to get a notification with details on flights entering a certain airport. I would like to have data on the flight but with the icao that opensky is using for the 1st detection, you need a second call to SO to get flightdetails. As this is all free I am of course OK...flightaware has massive data but this comes at a price too.

  1. use opensky core or this one to get the icao
  2. use a command line curl to get the details
  3. depending on iata details, send the notification I am aiming to use a input helper to provide the iata and this allows me to get notified when the flight in focus To be tested is if I can use one for exit and another for entry with different hight and/or range
OzGav commented 1 year ago

Yeah I saw those errors when I upgraded but I haven’t had time to look at it yet. There is work going on with the official integration to get that up to speed so keep an eye out for that as well.

I have this automation at the moment that is currently hard coded but I was thinking of trying to use an input helper to identify a specific flight

- alias: "Flight entry notification"
  trigger:
    platform: event
    event_type: opensky_entry
  condition:
    condition: template
    value_template: "{{ 'ABC' in trigger.event.data.callsign }}"
  action:
    service: notify.mobile_app_gavin_pixel_4a
    data:
      message: "Flight entry of {{ trigger.event.data.callsign }}"
OzGav commented 1 year ago

I think the warning is fixed. Please pull down the latest sensor.py and let me know.

vingerha commented 1 year ago

Yep...thanks In the meantime I progressed in a simple way I use a input_text to enter the iata If the integr. iata is equal then populate another input_text with icao Then use the api/states to get me the lat/lon and other values of that plane via a command line curl. The lat/lon I then use to display the plane in a map card, it updates avery 60 sec. Still, it is not doing what I expect it to do, the altitude is not taken correctly, I use 7 or 9 km but when I receive the message, the plane is already below 4km and well within the range

OzGav commented 1 year ago

If you are pulling data from two different sites you are likely seeing the lag in their data?

vingerha commented 1 year ago

nono...I am just using opensky but it detects the plane very late as to what I see, or maybe I donot understand when it gets detected. When not using altitude the update is masisve, so I wanted to only have planes below (say) 7km and withon 40km range My expectation is that if a plane is AND within 40km range AND below 7km, it should trigger. I however have a number of planes now that enter 40km well below 7km and when I receive the notificaton it is below 4km altitude....this is confusing. My guess is that the sensorlogic is not working or my expectations are off :)

vingerha commented 1 year ago

btw, have you tested multiple sensors/points? I want to have a setup for the 4 airports we 'normally' use.

vingerha commented 1 year ago

This is what I have right now...the icao is populated by a automation and I use the iata for filtering out only those that I am intersted with. It would be nice to have a dropdown-list but they change too often image

vingerha commented 1 year ago

The most annoying issue is that the ID are different this flight is known at the airport as U21825 but also as EJU1825, the latter shows on the boardinginformation I cannot find any mapping between that and either the iata or icao...not from opensky that is. With flightaware...yes but repeating, at a price

OzGav commented 1 year ago

I however have a number of planes now that enter 40km well below 7km and when I receive the notificaton it is below 4km altitude....this is confusing. My guess is that the sensorlogic is not working or my expectations are off :)

Yeah expectations are off! :-) A jet aircraft at 40km will be around 6000ft or 1.8km. A small aircraft may be crusing lower than that and enter your 40km point from the side.

OzGav commented 1 year ago

have you tested multiple sensors/points? I want to have a setup for the 4 airports we 'normally' use.

No sorry I haven't

OzGav commented 1 year ago

The most annoying issue is that the ID are different this flight is known at the airport as U21825 but also as EJU1825, the latter shows on the boardinginformation I cannot find any mapping between that and either the iata or icao...

EJU1825 will be the callsign and I expect is what you get from opensky. Where did you find that U21825 code?

vingerha commented 1 year ago

U21825 is what the airport website displays on 'arrivals' In short the challenge is not immediately for me but for my family, they should not need to worry which one to pick and certainly not need to search for the icao. Flightaware does its ID via the iata btw (if you did not already know this)

The target is to be able to indicate orig/dest airport, HA to search for the flights and load them in to a input_select of sorts, e.g. "icao - iata - times". After selecting, I can then run opensky to track the flight. I will try to see if I can use aviationstack for mapping missing information too, they are free-ish but some supposedly 'free' services aren't.

vingerha commented 1 year ago

Yeah expectations are off! :-) A jet aircraft at 40km will be around 6000ft or 1.8km. A small aircraft may be crusing lower than that and enter your 40km point from the side.

Exactly, so when setting 7km and 40km I would expect to see both of them when they enter the 40km range, or?

OzGav commented 1 year ago

Exactly, so when setting 7km and 40km I would expect to see both of them when they enter the 40km range, or?

Correct. It is the 40km range that opensky is filtering on so as soon as an aircraft appears within that range you will see them but they will be way lower than 7km

vingerha commented 1 year ago

So why does the large flight only appear below 4km, well into the 40km range then? i.e. none of these 2 conditions/thresholds seems to be kept. Will investigate a bit more ove time, not really important right now until my mentioned target is reached :)

OzGav commented 1 year ago

OK I didn't understand from your posts above that the aircraft was appearing inside 40km I thought it was appearing at 40km but well below 7km as you wrote:

I however have a number of planes now that enter 40km well below 7km and when I receive the notificaton it is below 4km altitude.

How far inside 40km is it? The aircraft are doing around 460 km/h at that point so covering roughly 4km every 30 secs. The update rate of the integration is 25 seconds so at BEST the aircraft will jump 3.5km each update. Then you have to factor in the unknown of how often the provider to opensky updates and how often opensky itself updates...

OzGav commented 1 year ago

U21825 is what the airport website displays on 'arrivals'

I'm guessing but it might just be some airport specifc code. It doesn't look familar to me. I think you generally want the ICAO code as the callsign. That is what is shown on the various tracking websites map displays and what the integration returns from opensky https://en.wikipedia.org/wiki/Airline_codes