Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sensor:
- - platform: rest
- name: OK 95 Single
- resource: http://rest.apptoo.dk/fuelfinder.json
- value_template: >
- {# NAME OF THE FUEL COMPANY TO EXTRACT FROM #}
- {% set company_name = "OK" %}
- {# FUEL TYPE TO EXTRACT, "gas_95" OR "diesel" #}
- {% set type = "gas_95" %}
- {# DO NOT TOUCH BELOW #}
- {% set fuelcompany = value_json.fuelprices | selectattr('company_name', 'eq', company_name) | list | first %}
- {{ fuelcompany[type] }}
- json_attributes_path: "$.fuelprices[?(@.company_name == 'OK')]"
- json_attributes:
- - company_logo
- - gas_95
- - diesel
- - last_update
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement