Gas up or down web scrape

Hey folks. Here in Nova Scotia, our gas price minimum gets set every Thursday around 4pm. I’m looking to use Home Assistant to notify me around that time whether or not I should go get gas (if going up) … or hold off getting gas (if going down). I’m new to scraping in Home Assistant. I tried scraping from [gaswizard.ca] using this code, but I’m not able to get a value in the sensor. Anybody have an suggestions?

Here is the code in my configuration.yaml:

sensor:
  - platform: scrape
    name: Gas Price Halifax
    resource: https://gaswizard.ca/gas-prices/halifax/
    select: "div.fuelprice"
    value_template: "{{ value | regex_findall('([0-9]+\\.[0-9]+)') | first }}"
    unit_of_measurement: "¢/L"

  - platform: scrape
    name: Gas Price Change
    resource: https://gaswizard.ca/gas-prices/halifax/
    select: "span.price-direction"
    value_template: "{{ value | regex_findall('([-+]?[0-9]+\\.?[0-9]*¢)') | first }}"

Thanks for any help/suggestions!

I’m not sure which gas price you are trying to scrape, but I do think your select value may be incorrect. I just scraped the Sat Feb 1 Regular price and its select value is

#post-26155 > div > div > ul > li:nth-child(1) > div:nth-child(3) > div.fuelprice

Two points to make here

  1. Im using MultiScrape. It looks like you’re using the HA Scrape integration, so I may be wrong in my assessment of the select value.
  2. Google Chrome is much better at actually getting the sector values than some other browsers (in my opinion)

You may want to give MultiScrape a try.