Skip to content

Commit

Permalink
Cards containing nearby planes
Browse files Browse the repository at this point in the history
  • Loading branch information
golles committed Jan 18, 2024
1 parent d6745bb commit b786961
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lovelace/views/buurt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,5 @@ cards:

- type: custom:mushroom-entity-card
entity: sensor.leeghwaterbad_abonnement_verloopdatum

- !include cards/planes.yaml
41 changes: 41 additions & 0 deletions lovelace/views/cards/planes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
type: custom:auto-entities
show_empty: false
card:
type: grid
columns: 2
square: false
title: Vliegtuigen
card_param: cards
filter:
template: >-
{%- set data = namespace(entities=[]) -%}
{% set flights = state_attr("sensor.flightradar24_current_in_area", "flights") %}
{% if flights | length %}
{% for flight in flights %}
{%- set data.entities = data.entities + [{
"type": "custom:mushroom-template-card",
"primary": flight.aircraft_model,
"secondary": flight.airline_short ~ "\n" ~ flight.airport_origin_city ~ " (" ~ flight.airport_origin_country_code ~ ") -> " ~ flight.airport_destination_city ~ " (" ~ flight.airport_destination_country_code ~ ")",
"multiline_secondary": true,
"picture": flight.aircraft_photo_small,
"badge_icon": "mdi:airplane",
"tap_action": {
"action": "url",
"url_path": "https://www.flightradar24.com/" ~ flight.id
}
}] -%}
{% endfor %}
{% endif %}
{% if data.entities | length > 0 %}
{{ data.entities }}
{% endif %}
include:
- entity_id: sensor.flightradar24_current_in_area
options:
type: tile
name: Aantal
sort:
method: name

0 comments on commit b786961

Please sign in to comment.