homeassistant-addons icon indicating copy to clipboard operation
homeassistant-addons copied to clipboard

[adsb-multi-portal-feeder] Add Aircraft sensors

Open MaxWinterstein opened this issue 2 years ago • 34 comments

Created to continue the discussion that is slightly lost here: https://github.com/MaxWinterstein/homeassistant-addons/commit/5be38c6d740f4645bb49719c5497db1b6d72f36c

@plo53 It looks good, will try to get it integrated and tested! :)

MaxWinterstein avatar Jun 24 '23 10:06 MaxWinterstein

@plo53 first quick feedback - it works! ❤️

Currently drafting the release, maybe get it done before the toddler ends his nap 🤞

a) Can you add some uuid to the sensor? Maybe someone want's to e.g. overwrite the icon or stuff image

b) In the mood to add sensors to the other feeders as well? 😉

MaxWinterstein avatar Jun 24 '23 11:06 MaxWinterstein

Can be tested with just released version 1.27.0 🥳

MaxWinterstein avatar Jun 24 '23 11:06 MaxWinterstein

this sensor did have a unique id

sensor_ids

plo53 avatar Jun 24 '23 12:06 plo53

b) Why not. Need first to register feeding to them, and see what can be done depending on openness of their implementation

plo53 avatar Jun 24 '23 12:06 plo53

Just installed 1.27.0 Everything working fine

Didn't reproduce any unique_id missing issue

plo53 avatar Jun 24 '23 13:06 plo53

About additional sensors for other feeders:

  • fr24 : restfull api 8754 already there

  • radarbox : I got trapped into the rbfeeder "segmentation fault" issue within x86 platform. Can't investigate further

  • planefinder : it's impossible to create a new sharecode, port 30054 isn't exposed by Thom-x image

plo53 avatar Jun 25 '23 10:06 plo53

Good news:

  • finally reproduced the unique_id missing issue. It appears that the unique_id identifier I defined previously for sensor.adsdfi_status was somewhere confusing. Fixed it by changing it.
  • I managed to get a Planefinger sharecode key by installing the standalone native planefinder docker in an other machine. Thom-x docker missing port 30053 exposed doesn't allow a new user to register to Planefinder nor to get access to the stats page from HA. Will have a talk with him to access the point. Anyway I can implement 3 planefinder sensors : Mode-AC packets per seconde, Mode-S packets per seconde, Receiver bandwidth (Kb/s)

plo53 avatar Jun 26 '23 12:06 plo53

New sensors for Opensky and Planefinder in release hassio-sensors v1.1.0

plo53 avatar Jun 27 '23 19:06 plo53

Awesome ❤️

Updated along #174

MaxWinterstein avatar Jul 09 '23 12:07 MaxWinterstein

@plo53 if you could add a max range sensor too?

yousaf465 avatar Jul 12 '23 05:07 yousaf465

In local feeders, I may have (or not at all) limited history of aircraft postions.

So depends by what do you mean by max range.

For adsbexchange and adsb.fi, I can retrieved the outlines. From them I can compute the max distance from the receiver location.

For opensky and planefinder, I have at least the aircraft positions, I can compute the farthest over time.

plo53 avatar Jul 12 '23 08:07 plo53

for example flight radar gives it as max range

image

so max range will give us an idea about our antenna placement etc etc over time.

yousaf465 avatar Jul 12 '23 09:07 yousaf465

yes indeed, this is the max range for one day history

I prototyped a sensor to track the "farthest" aircraft over time:

2023-07-12 17_47_51-History – Home Assistant

Then using a Statistics Graph card like bellow, we should get the same Max Range per day as FR24:

2023-07-12 18_04_59-Overview – Home Assistant

Let us wait for some days to see ...

plo53 avatar Jul 12 '23 16:07 plo53

yes indeed, this is the max range for one day history

I prototyped a sensor to track the "farthest" aircraft over time:

2023-07-12 17_47_51-History – Home Assistant

Then using a Statistics Graph card like bellow, we should get the same Max Range per day as FR24:

2023-07-12 18_04_59-Overview – Home Assistant

Let us wait for some days to see ...

yes wanted this sensor, we can use it for any graph, per hour, per day or per week etc.

I am using this custom history graph, which creates bar graph on it's own

https://github.com/alexarch21/history-explorer-card

yousaf465 avatar Jul 12 '23 17:07 yousaf465

Which feeder are you using ?

PS: Alex's History explorer card is awesome !

plo53 avatar Jul 12 '23 19:07 plo53

Which feeder are you using ?

PS: Alex's History explorer card is awesome !

All feeders all mentioned in this screenshot and radarbox.

image

yousaf465 avatar Jul 12 '23 20:07 yousaf465

You may add adsb.fi , launched by some adsbexchange main developpers fired or leave after sold out

plo53 avatar Jul 13 '23 09:07 plo53

You may add adsb.fi , launched by some adsbexchange main developpers fired or leave after sold out

it is already added. image

yousaf465 avatar Jul 13 '23 09:07 yousaf465

hassio-sensors v1.1.2-1 released, to be reviewed by Max

plo53 avatar Jul 16 '23 21:07 plo53

Update released - works fine. Thanks @plo53 !

Would it be possible to add the sensors to the Home Assistand Addon? Not sure how that via supervisor works, only know it from mqtt site. Rel https://github.com/MaxWinterstein/toogoodtogo-ha-mqtt-bridge/issues/21

So the sensors will be listed at the addon page?

image

MaxWinterstein avatar Jul 17 '23 08:07 MaxWinterstein

Update released - works fine. Thanks @plo53 !

Would it be possible to add the sensors to the Home Assistand Addon? Not sure how that via supervisor works, only know it from mqtt site. Rel MaxWinterstein/toogoodtogo-ha-mqtt-bridge#21

So the sensors will be listed at the addon page?

image

that will simplify it a lot. just click Add to Dashboard and you are done. instead of finding each and every sensor.

yousaf465 avatar Jul 17 '23 08:07 yousaf465

Yeah sure. Need to figure out how to integrate the sensors list in the addon page

@MaxWinterstein : can you explain how you integrated your sensors into the device ?

plo53 avatar Jul 17 '23 09:07 plo53

I presume the sensor list in the device is a predifined list by HA, that needs to be handle by the addon.

Here ie the version is not found:

2023-07-17 11_27_49-Settings – Home Assistant

plo53 avatar Jul 17 '23 09:07 plo53

https://developers.home-assistant.io/docs/creating_component_index/

does this point to in any right direction?

yousaf465 avatar Jul 17 '23 09:07 yousaf465

Yes this is right direction. This is developping a custom integration defining a device and its sensors logic.

This is outside of the addon itself.

plo53 avatar Jul 17 '23 10:07 plo53

Wouldn't it be possible to just add device info to the payload, so it will be created and all sensors will be assigned to this device?

MaxWinterstein avatar Jul 18 '23 07:07 MaxWinterstein

The hassio REST API doesn't provide any device settings method.

The "ideal" solution would be an associated custom integration, but I am not in favor because then your add-on would no longer be independent.

I will investigate if replacing REST API communication by MQTT can provide much device control

plo53 avatar Jul 18 '23 07:07 plo53

At least device autodiscovery would work in that case 🤔

Btw, I saw this error while fiddling around:

Traceback (most recent call last):
  File "/usr/local/share/planefinder/planefinder_max-range.py", line 28, in <module>
    ulat=radians(float( options['MLAT_EXACT_LAT'] ))
ValueError: could not convert string to float: 'HOMEASSISTANT_LATITUDE'

I named this a 'magic variable', as it will be replaced by some script:

https://github.com/MaxWinterstein/homeassistant-addons/blob/052e8c35f89071e9c056f504b657dc7b07a4ca09/adsb-multi-portal-feeder/export-env-from-config.sh#L24

No deeper search here as just on coffee break, but i guess sourcing my bash script on top of the sensors might do the job: https://github.com/MaxWinterstein/homeassistant-addons/blob/main/adsb-multi-portal-feeder/Dockerfile#L25

MaxWinterstein avatar Jul 18 '23 08:07 MaxWinterstein

In fact my script is directly reading /data/options.json and I am expecting exact lat/lon float values configured in the addon

plo53 avatar Jul 18 '23 08:07 plo53

If you want, I can inject this via my dockerfile, just like the others.

MaxWinterstein avatar Jul 18 '23 08:07 MaxWinterstein