Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MaxWinterstein opened this issue Jun 24, 2023 · 34 comments
Open

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

MaxWinterstein opened this issue Jun 24, 2023 · 34 comments

Comments

@MaxWinterstein
Copy link
Owner

Created to continue the discussion that is slightly lost here: 5be38c6

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

@MaxWinterstein
Copy link
Owner Author

@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
Copy link
Owner Author

Can be tested with just released version 1.27.0 🥳

@plo53
Copy link

plo53 commented Jun 24, 2023

this sensor did have a unique id

sensor_ids

@plo53
Copy link

plo53 commented Jun 24, 2023

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

@plo53
Copy link

plo53 commented Jun 24, 2023

Just installed 1.27.0
Everything working fine

Didn't reproduce any unique_id missing issue

@plo53
Copy link

plo53 commented Jun 25, 2023

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
Copy link

plo53 commented Jun 26, 2023

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
Copy link

plo53 commented Jun 27, 2023

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

@MaxWinterstein
Copy link
Owner Author

Awesome ❤️

Updated along #174

@yousaf465
Copy link

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

@plo53
Copy link

plo53 commented Jul 12, 2023

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.

@yousaf465
Copy link

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.

@plo53
Copy link

plo53 commented Jul 12, 2023

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 ...

@yousaf465
Copy link

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

@plo53
Copy link

plo53 commented Jul 12, 2023

Which feeder are you using ?

PS: Alex's History explorer card is awesome !

@yousaf465
Copy link

yousaf465 commented Jul 12, 2023

Which feeder are you using ?

PS: Alex's History explorer card is awesome !

All feeders all mentioned in this screenshot and radarbox.

image

@plo53
Copy link

plo53 commented Jul 13, 2023

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

@yousaf465
Copy link

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

it is already added.
image

@plo53
Copy link

plo53 commented Jul 16, 2023

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

@MaxWinterstein
Copy link
Owner Author

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

@yousaf465
Copy link

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.

@plo53
Copy link

plo53 commented Jul 17, 2023

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
Copy link

plo53 commented Jul 17, 2023

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

@yousaf465
Copy link

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

does this point to in any right direction?

@plo53
Copy link

plo53 commented Jul 17, 2023

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.

@MaxWinterstein
Copy link
Owner Author

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?

@plo53
Copy link

plo53 commented Jul 18, 2023

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

@MaxWinterstein
Copy link
Owner Author

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:

if [[ $line == *"HOMEASSISTANT_LATITUDE" ]] || [[ $line == *"HOMEASSISTANT_LONGITUDE" ]] || [[ $line == *"HOMEASSISTANT_ELEVATION" ]]; then

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

@plo53
Copy link

plo53 commented Jul 18, 2023

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

@MaxWinterstein
Copy link
Owner Author

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

@plo53
Copy link

plo53 commented Jul 18, 2023

Initialy I selected to use EXACT_LAT/LON (MLAT) to enable more precise range computing, guessing the site HOMEASSISTANT_LAT/LON may be more approximative.
Anyway, I can update my script to retrieve the values from your env variables.
At the moment, to get rid of the traceback, define EXACT_LAT/LON in the addon config.

@plo53
Copy link

plo53 commented Jul 18, 2023

PS: I noted it in the Readme. But your are right, especially for feeder that doesn't enable MLAT, this can trouble users.

2023-07-18 10_43_41-plo53_adsb-hassio-sensors_ Home assistant _ Aircraft sensors for MaxWinterstein_

@plo53
Copy link

plo53 commented Jul 19, 2023

SURVEY : I have implemented in my local dev version a one day tracking of aircrafts seen by my receiver.
Let me know if it brings interest ?
Home Assistant ADS-B Aircraft Tracked

@plo53
Copy link

plo53 commented Aug 2, 2023

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?
that will simplify it a lot. just click Add to Dashboard and you are done. instead of finding each and every sensor.

I am progressing reworking the adsb sensors from hassio to mqtt with device discovery.

adsb-mqtt

adsb-mqtt-sensors

Question : how to manage backward compatibility ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants