Ciao,
I’m trying to create a REST sensor to get petrol price from a specific petrol station. The CURL request is as follows:
curl --request GET "https://sedeaplicaciones.minetur.gob.es/ServiciosRESTCarburantes/PreciosCarburantes/EstacionesTerrestres/FiltroProvincia/28" | jq -r '.ListaEESSPrecio[] | select(.IDEESS=="4654") | ."Precio Gasolina 95 E5"'
I’ve tried the following config without success:
- platform: rest
resource: https://sedeaplicaciones.minetur.gob.es/ServiciosRESTCarburantes/PreciosCarburantes/EstacionesTerrestres/FiltroProvincia/28
name: gasolinera
method: GET
scan_interval: 86400
json_attributes_path: "$.ListaEESSPrecio"
value_template: >
{% set items = value_json | selectattr('IDEESS','eq','4654') | list | first %}
{{ items['Precio Gasolina 95 E5'] }}
Can anyone guess what I’m doing wrong?
Thanks!!