Ich hab die Card nun noch um die Anzeige der Tankstellen Symbole ergänzt.
Jene Tankstellen, die mir zu weit weg sind, hab ich gezielt ausgeblendet, daher lasse ich mir auch die Id anzeigen.
Die Preise runde ich bereits beim holen von der Rest-API auf round(2), hier in der Anzeige stelle ich mit “%.2f” sicher, dass immer 2 Nachkomma-Stellen angezeigt werden, also z.B. 1.60
type: custom:auto-entities
card:
type: entities
title: Gänserndorf & Strasshof
card_mod:
style: |
ha-card .card-header {
font-size: 150%;
}
filter:
include:
- entity_id: /^sensor.spritpreisrechner_diesel_gndf_preis_[1-5]$/
options:
type: custom:template-entity-row
icon: mdi:gas-station-outline
image: >
{% set name = state_attr(config.entity, 'name').lower() %}
{% if name.startswith('jet') %}
/local/images/gas_stations/jet.png
{% elif name.startswith('avanti') %}
/local/images/gas_stations/avanti.png
{% elif name.startswith('eni') %}
/local/images/gas_stations/eni.png
{% elif name.startswith('diskont') %}
/local/images/gas_stations/diskont.png
{% elif name.startswith('turmöl') %}
/local/images/gas_stations/turmoel.png
{% endif %}
state: >
{% set state = states(config.entity) %}
{% set formatted_state = "%.2f" % state | float %}
{% if state != 'unknown' %}
{% set state = formatted_state + " " + state_attr(config.entity, 'unit_of_measurement') %}
{% endif %}
{{state}}
name: >-
{{state_attr(config.entity, 'distance') | float | round(1) }} km
({{state_attr(config.entity, 'id')}})
{{state_attr(config.entity, 'name')|title}}
secondary: >-
{{state_attr(config.entity, 'location')['postalCode']}}
{{state_attr(config.entity, 'location')['city']|title}},
{{state_attr(config.entity, 'location')['address']|title}}
exclude:
- attributes:
id: 6693
sort:
method: state