JLindvig

Fuelfinder Restful Sensor

Nov 6th, 2021 (edited)
1,260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.04 KB | None | 0 0
  1. rest:
  2.   - resource: http://rest.apptoo.dk/fuelfinder.json
  3.     sensor:
  4.       - name: OK 95
  5.         device_class: monetary
  6.         force_update: true
  7.         unit_of_measurement: "kr."
  8.         value_template: >
  9.          {% set fuelcompany = value_json.fuelprices | selectattr('company_name', 'eq', 'OK') | list | first %}
  10.           {{ fuelcompany['gas_95'] | float }}
  11.         json_attributes_path: "$.fuelprices[?(@.company_name == 'OK')]"
  12.         json_attributes:
  13.          - company_logo
  14.           - gas_95
  15.           - diesel
  16.           - last_update
  17.  
  18.       - name: OK Diesel
  19.         device_class: monetary
  20.         force_update: true
  21.         unit_of_measurement: "kr."
  22.         value_template: >
  23.          {% set fuelcompany = value_json.fuelprices | selectattr('company_name', 'eq', 'OK') | list | first %}
  24.           {{ fuelcompany['diesel'] | float }}
  25.         json_attributes_path: "$.fuelprices[?(@.company_name == 'OK')]"
  26.         json_attributes:
  27.          - company_logo
  28.           - gas_95
  29.           - diesel
  30.           - last_update
Add Comment
Please, Sign In to add comment