AlexandrErohin / home-assistant-flightradar24

Flightradar24 integration for Home Assistant
https://community.home-assistant.io/t/custom-component-flightradar24
MIT License
169 stars 16 forks source link

Lovelace Card Bug #71

Closed cataseven closed 1 month ago

cataseven commented 1 month ago

If any of flights under sensor.flightradar24_additional_tracked returns no data then lovelace card show nothing including the other tracked flights with enough info.

Ex:

Add 4 flights. Lovelace card shows all. If 1 of the flights returns no info (not enough attributes) then also the other 3 flights is not shown on the card.

AlexandrErohin commented 1 month ago

@cataseven Hi I have fixed the markdown. Please try it

cataseven commented 1 month ago

Thank you so mueh. Tested and done.

cataseven commented 1 month ago

Reopen after below issue. Please see the 4th flight below

  - callsign: NSZ5529
    flight_number: D85529
    aircraft_registration: null
    tracked_type: schedule

state_class: total flights:

AlexandrErohin commented 1 month ago

@cataseven Yes, the markdown works for this also see this part

...
{% else%}
          <ha-icon icon="mdi:airplane"></ha-icon>{{ flight.flight_number }} - {{ flight.callsign }} - {{ flight.tracked_type }}
          {% endif%}{% endfor %}
cataseven commented 1 month ago

I wrote my own markdown card so I get the bug I think. However for a common solution I wrote this automation.

Maybe you can update your code as "If tracked_type changes from "live" to "schedule" then remove the flight from FlightRadar24 Additional tracked sensor"

alias: Action (Delete Flight Number)
description: ""
triggers:
  - event_type: state_changed
    trigger: event
conditions:
  - condition: template
    value_template: >-
      {{ trigger.event.data.new_state.domain == 'device_tracker' and
      trigger.event.data.new_state.attributes.tracked_type == 'schedule' and
      trigger.event.data.old_state.attributes.tracked_type == 'live'}}
actions:
  - action: text.set_value
    metadata: {}
    data:
      value: "{{ trigger.event.data.old_state.attributes.flight_number }}"
    target:
      entity_id: text.flightradar24_remove_from_track
AlexandrErohin commented 1 month ago

it was requested to add live and schedule flights to track