Thats my configuration to see the fuel prices for my often used petrol stations (Germany):
- Create an API-Key on creativecommons.tankerkoenig.de
- Get station ID’s from the finder: TankstellenFinder
- Create an json sensor in configuration to retrieve prices from Tankerkoenig and a template sensor per station/attribute (eg. Diesel)
- Some logos I stored in /config/www/fuel
sensor:
- platform: rest
name: Fuel
resource: "https://creativecommons.tankerkoenig.de/json/prices.php?apikey=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&ids=22301ffd-8110-47c6-a9d6-2bf873a10c72,c18cef16-99cc-4f8e-b959-e6ab6521d2be"
scan_interval: 900
verify_ssl: false
value_template: '{ value_json.prices.[] }'
json_attributes:
- prices
- platform: template
sensors:
bft_wolfhagen_diesel:
friendly_name: Wolfhagen
unit_of_measurement: €
entity_picture_template: /local/fuel/bft.png
value_template: '{{ states.sensor.fuel.attributes["prices"]["22301ffd-8110-47c6-a9d6-2bf873a10c72"]["diesel"]}}'
- For Lovelace sorting I used the custom auto-entiies card:
type: custom:auto-entities
card:
type: entities
show_header_toggle: false
state_color: false
title: Diesel-Preise
filter:
include:
- entity_id: sensor.*diesel
exclude: []
sort:
method: state
reverse: false
numeric: true
show_empty: false