Austrian fuel prices from Spritpreisrechner

Gefäll mir :grinning:
Könntest du deinen Code zur Verfügung stellen?

Bitte

type: custom:vertical-stack-in-card
cards:
  - type: custom:auto-entities
    card:
      type: entities
    filter:
      include:
        - 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('speed') %}
                /local/images/gas_stations/speed.png
              {% elif name.startswith('turmöl') %}
                /local/images/gas_stations/turmoel.png
              {% elif name.startswith('shell') %}
                /local/images/gas_stations/shell.png
              {% elif name.startswith('avia') %}
                /local/images/gas_stations/avia.png
              {% elif name.startswith('omv') %}
                /local/images/gas_stations/omv.png
              {% elif name.startswith('bp') %}
                /local/images/gas_stations/bp.png
              {% endif %}
            state: |
              {% set state = states(config.entity) %} {% set formatted_state =
               state | float %} {% if state != 'unknown' %}
                {{ formatted_state }} {{ state_attr(config.entity, 'unit_of_measurement') }}
              {% else %}
                {{ state }}
              {% endif %}
            name: "{{ state_attr(config.entity, 'name') }}"
            secondary: >-
              {% set distance = state_attr(config.entity, 'distance') | float %}
              {% set symbol = "🟢" if distance < 2 else "🟠" %} {{
              state_attr(config.entity, 'location')['address'] | title }} — {{
              distance | round(1) }} km {{ symbol }}
          entity_id: /fuel_price_linz_die_[1-5]$/
      exclude:
        - options: {}
          attributes:
            id: 6693
    sort:
      method: state
  - type: custom:template-entity-row
    name: ""
    state: ""
    secondary: 🟢 Entfernung < 2 km  🟠 Entfernung > 2 km
  - type: custom:template-entity-row
    icon: mdi:clock-outline
    entity: sensor.fuel_price_linz_die_1
    name: ""
    state: ""
    secondary: >
      {{ as_timestamp(states.sensor.fuel_price_linz_die_1.last_updated) |      
      timestamp_custom('%d.%m.%Y %H:%M') }}```

Vielen Dank, werde ich mir nächste Woche gleich anschauen.

Hallo bin am verzweifeln… kann mir jemand sagen was ich hier falsch mache ?
bei mir kommt immer unavailable oder unknown …

There is a well known bug on this API page, and since this bug is still not fixed, you have to manually change the path from /api/ to /sprit/1.0/

like this:

- resource: https://api.e-control.at/sprit/1.0/search/gas-stations/by-address?fuelType=...

Since this bug is really old, every AI would have answered this question in the same way.

Ist es möglich, longitude und latitude in der resource URL als Variable zu definieren? Ich würde dann nämlich die GPS-Koordinaten meines Smartphones angeben, sodass ich immer die günstigste Tanke in meiner Nähe sehe.

You can set in REST resource_template instead of resource. You can build the URL using the data from your phone’s device tracker.

Cool.
Would this be a correct string for the resource_template?
https://api.e-control.at/sprit/1.0/search/gas-stations/by-address?latitude={{state_attr('sensor.alex','current_latitude')}}&longitude={{state_attr('sensor.alex','current_longitude')}}&fuelType=SUP&includeClosed=false

Just tried: Yes, it works. :grinning: