diff --git a/README.md b/README.md index c67c0ff..3d41fb0 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ It allows you: 3) Add flights table to your [Home Assistant dashboard](https://www.home-assistant.io/dashboards/) by [Lovelace Card](#lovelace)) +

## Components ### Events @@ -47,7 +48,7 @@ Flightradar24 is configured via the GUI. See [the HA docs](https://www.home-assi The default data is preset already - +

1. Go to the Settings->Devices & services. 2. Click on `+ ADD INTEGRATION`, search for `Flightradar24`. @@ -86,7 +87,7 @@ All available fields in `trigger.event.data` you can check [here](#flight) ### Lovelace Card You can add flight table to your [Home Assistant dashboard](https://www.home-assistant.io/dashboards/) - +

1. Go to your [Home Assistant dashboard](https://www.home-assistant.io/dashboards/) 2. In the top right corner, select the three-dot menu, then select Edit dashboard @@ -121,6 +122,48 @@ cards: All available fields for flight you can check [here](#flight) +### Lovelace Card with Map +

+ +1. Open in a browser https://www.flightradar24.com +2. Move the map so that your area is in the middle of the screen. And scroll to select comfortable map zoom +3. Now you have URL of the map like https://www.flightradar24.com/50.03,8.49/12 Remember this URL +4. Go to your [Home Assistant dashboard](https://www.home-assistant.io/dashboards/) +5. In the top right corner, select the three-dot menu, then select Edit dashboard +6. Click on `+ ADD CARD`, search for `Manual`, click on `Manual`. +7. Add following code to the input window. Replace LATITUDE, LONGITUDE and ZOOM from URL from step 4. (Example - https://www.flightradar24.com/50.03,8.49/12 - LATITUDE is 50.03, LONGITUDE is 8.49, ZOOM is 12) +8. Click `SAVE` + +```markdown +type: vertical-stack +title: Flightradar24 +cards: + - type: entities + entities: + - entity: sensor.flightradar24_current_in_area + name: In area + - type: conditional + conditions: + - condition: numeric_state + entity: sensor.flightradar24_current_in_area + above: 0 + card: + type: markdown + content: >- + {% set data = state_attr('sensor.flightradar24_current_in_area', + 'flights') %} {% for flight in data %} + {{ flight.flight_number }}({{ flight.aircraft_registration }}) - {{ flight.airline_short }} - {{ flight.aircraft_model }} + {{ flight.airport_origin_city }}{%if flight.airport_origin_city %}{% endif %} -> {{ flight.airport_destination_city }}{% + if flight.airport_destination_country_code %}{% endif %} + {%if flight.time_scheduled_departure %}Departure - {{ flight.time_scheduled_departure | timestamp_custom('%H:%M') }}; {% endif %}{%if flight.time_scheduled_arrival%}Arrival - {{ flight.time_scheduled_arrival | timestamp_custom('%H:%M') }}{% endif %} + Altitude - {{ flight.altitude }} ft{%if flight.altitude > 0 %} ({{(flight.altitude * 0.3048)| round(0)}} m){% endif%}; Gr. speed - {{ flight.ground_speed }} kts{%if flight.ground_speed > 0 %} ({{(flight.ground_speed * 1.852)| round(0)}} km/h){% endif%} + {% endfor %} + - type: iframe + url: >- + https://www.flightradar24.com/simple?lat=LATITUDE&lon=LONGITUDE&z=ZOOM&label1=reg&size=small + aspect_ratio: 100% +``` + ## Database decrease To decrease data stored by [Recorder](https://www.home-assistant.io/integrations/recorder/) in database add following lines to your `configuration.yaml` file: ```yaml diff --git a/custom_components/flightradar24/manifest.json b/custom_components/flightradar24/manifest.json index 925cac9..d13a973 100644 --- a/custom_components/flightradar24/manifest.json +++ b/custom_components/flightradar24/manifest.json @@ -7,5 +7,5 @@ "iot_class": "cloud_polling", "issue_tracker": "https://github.com/AlexandrErohin/home-assistant-flightradar24/issues", "requirements": ["FlightRadarAPI==1.3.12", "pycountry==23.12.11"], - "version": "1.3.0" + "version": "1.4.0" } diff --git a/docs/media/map.png b/docs/media/map.png new file mode 100644 index 0000000..21905f1 Binary files /dev/null and b/docs/media/map.png differ