Filtered min/max gas price sensors

This commit is contained in:
2023-05-12 14:22:17 -04:00
parent e30f1646c7
commit aebd7bda51

View File

@ -96,32 +96,18 @@ scrape:
value_template: '{{ value | replace("$", "") | float }}' value_template: '{{ value | replace("$", "") | float }}'
icon: mdi:gas-station icon: mdi:gas-station
# Possible alternate way to do things, may revisit later, keeping for reference sensor:
- platform: statistics
# rest: unique_id: fcf4e80e-8459-4e23-a94f-5f127b628c20
# - scan_interval: 3600 name: Local Maximum Gas Price Filtered
# resource: https://www.gasbuddy.com/graphql entity_id: sensor.local_maximum_gas_price
# method: POST state_characteristic: mean
# headers: max_age:
# Content-Type: application/json hours: 24
# payload: | - platform: statistics
# { unique_id: 6a8c9dd1-980c-45b2-bbc1-c5f1777d434a
# "operationName": "LocationBySearchTerm", name: Local Minimum Gas Price Filtered
# "variables": { entity_id: sensor.local_minimum_gas_price
# "fuel": 1, state_characteristic: mean
# "maxAge": 0, max_age:
# "search": "43512" hours: 24
# },
# "query": "query LocationBySearchTerm($search: String) { locationBySearchTerm(search: $search) { trends { areaName country today todayLow } } }"
# }
# sensor:
# - unique_id: gasbuddy_lowest_gas_price
# name: Gasbuddy Lowest Gas Price
# icon: mdi:gas-station
# unit_of_measurement: USD
# value_template: "{{ value_json.data.locationBySearchTerm.trends.0.todayLow | float }}"
# - unique_id: gasbuddy_average_gas_price
# name: Gasbuddy Average Gas Price
# icon: mdi:gas-station
# unit_of_measurement: USD
# value_template: "{{ value_json.data.locationBySearchTerm.trends.0.today | float }}"