From 45060855a4b23c268e0aca08e670ccf61173fc9e Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Thu, 29 Dec 2022 18:18:37 -0500 Subject: [PATCH] Comment with possible alternate way to do things later on, close #31 --- packages/gas.yaml | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/packages/gas.yaml b/packages/gas.yaml index e483ca3..aded87f 100644 --- a/packages/gas.yaml +++ b/packages/gas.yaml @@ -82,4 +82,34 @@ scrape: select: "#root > div > div.Page-module__content___196kn.Page-module__padded___3hQ0U > div > div > div:nth-child(2) > div.grid__column___nhz7X.grid__desktop10___2T18R > div:nth-child(1) > div.grid__column___nhz7X.grid__desktop8___38Y4U > div:nth-child(3) > div > div.GasPriceCollection-module__collectionContainer___29Ngz > div:nth-child(2) > div:nth-child(1) > span" unit_of_measurement: USD value_template: '{{ value | replace("$", "") | float }}' - icon: mdi:gas-station \ No newline at end of file + icon: mdi:gas-station + +# Possible alternate way to do things, may revisit later, keeping for reference + +# rest: +# - scan_interval: 3600 +# resource: https://www.gasbuddy.com/graphql +# method: POST +# headers: +# Content-Type: application/json +# payload: | +# { +# "operationName": "LocationBySearchTerm", +# "variables": { +# "fuel": 1, +# "maxAge": 0, +# "search": "43512" +# }, +# "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 }}" \ No newline at end of file