Skip to content

Commit

Permalink
Fixed Lovelace Card Bug for sensor.flightradar24_additional_tracked
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandrErohin committed Oct 9, 2024
1 parent 6f946e8 commit f8a916e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
18 changes: 7 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,9 @@ Configuration inputs fields allows to add or remove a flight to/from sensor - Ad

Have [HACS](https://hacs.xyz/) installed, this will allow you to update easily.

[![Install quickly via a HACS link](https://my.home-assistant.io/badges/hacs_repository.svg)](https://my.home-assistant.io/redirect/hacs_repository/?owner=AlexandrErohin&repository=home-assistant-flightradar24&category=integration)
<a href="https://my.home-assistant.io/redirect/hacs_repository/?owner=AlexandrErohin&repository=home-assistant-flightradar24&category=integration" target="_blank"><img src="https://my.home-assistant.io/badges/hacs_repository.svg" alt="Open your Home Assistant instance and open a repository inside the Home Assistant Community Store." /></a>

1. Go to the <b>Hacs</b>-><b>Integrations</b>.
2. Add this repository (https://github.com/AlexandrErohin/home-assistant-flightradar24) as a [custom repository](https://hacs.xyz/docs/faq/custom_repositories/)
3. Click on `+ Explore & Download Repositories`, search for `Flightradar24`.
4. Search for `Flightradar24`.
5. Navigate to `Flightradar24` integration
6. Press `DOWNLOAD` and in the next window also press `DOWNLOAD`.
7. After download, restart Home Assistant.
or go to <b>Hacs</b> and search for `Flightradar24`.

### Manual

Expand Down Expand Up @@ -207,16 +201,18 @@ cards:
type: markdown
content: >-
{% set data = state_attr('sensor.flightradar24_current_in_area',
'flights') %} {% for flight in data %}
'flights') %} {% for flight in data %}{% if (flight.tracked_type | default('live')) == 'live' %}
<ha-icon icon="mdi:airplane"></ha-icon>{{ flight.flight_number }} - {{ flight.airline_short }} - {{ flight.aircraft_model }}
{{ flight.airport_origin_city }}{%if flight.airport_origin_city %}<img src="https://flagsapi.com/{{ flight.airport_origin_country_code }}/shiny/16.png" title='{{ flight.airport_origin_country_name }}'/>{% endif %} -> {{ flight.airport_destination_city }}{%
if flight.airport_destination_country_code %}<img src="https://flagsapi.com/{{ flight.airport_destination_country_code }}/shiny/16.png" title='{{ flight.airport_destination_country_name }}'/>{% 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 %}
{% else%}
<ha-icon icon="mdi:airplane"></ha-icon>{{ flight.flight_number }} - {{ flight.callsign }} - {{ flight.tracked_type }}
{% endif%}{% endfor %}
```

This example for `sensor.flightradar24_current_in_area` which shows flights in your area, to show additional tracked flights replace sensor name to `sensor.flightradar24_tracked`
This example for `sensor.flightradar24_current_in_area` which shows flights in your area, to show additional tracked flights replace sensor name to `sensor.flightradar24_additional_tracked`

All available fields for flight you can check [here](#flight)

Expand Down
2 changes: 1 addition & 1 deletion custom_components/flightradar24/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/AlexandrErohin/home-assistant-flightradar24/issues",
"requirements": ["FlightRadarAPI==1.3.34", "pycountry==23.12.11"],
"version": "1.21.2"
"version": "1.21.3"
}

0 comments on commit f8a916e

Please sign in to comment.