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

Filter (e.g., distance < X, altitude < Y) #12

Open
mikeage opened this issue Jul 11, 2022 · 3 comments
Open

Filter (e.g., distance < X, altitude < Y) #12

mikeage opened this issue Jul 11, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@mikeage
Copy link

mikeage commented Jul 11, 2022

It would be very useful if we could add filters to the aircraft displayed. E.g., I'd like to only show planes within 10 NM, under 10k altitude.

I'm not sure what the best syntax would be; there is an existing hide: empty option, but I'm not sure what the cleanest way to be would be represent the filters that need a value, and whether it should default to and or or (and how to specify the opposite behavior), which is one reason I'm not submitting a PR. (the other two are poor JS skills and extreme laziness!)

@mikeage mikeage added the enhancement New feature or request label Jul 11, 2022
@fratsloos
Copy link
Owner

I'm not sure yet how to implement it, but I'm thinking about something like this for the config:

type: custom:fr24-card
entity: sensor.fr24_aircraft
filter:
    type: or # and, or
    rules:
        - distance: <10
        - altitude: >=5

This will work with both options for units configuration parameter (default and metric) and can be applied after the units are converted (if metric is used).

The syntax for the rules should support the operators >, <, >=, <= and =. It should work on columns that have a number as their value. But not all; based on the above syntax, filtering on track would not be of any value. Therefore I am thinking of supporting the following columns in the filter: altitude, distance, speed.

Maybe in the future also a filter on columns with a text value. For example country.

@robsymax
Copy link

I've been looking for a solution to logging aircraft noise and being able to count aircraft within a set distance and below a set height would be great. It could also be refined further by aircraft type, speed/acceleration/etc. Is this possible?

@fratsloos
Copy link
Owner

@robsymax I think that's beyond the scope of this card. This card is for showing the current tracked aircrafts. It won't store any data. Theoretically this is possible by calling HA's API and updating an entity, but I won't develop that. You can always fork this repo and open a PR if you have developed such functionality.

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

No branches or pull requests

3 participants