Illinois Gas & Electric Cost Scrapers For All Major Utilities

These scrapers will pull the most current rates from the Citizens Utility Board website. There are various municipal providers throughout the state that I have not covered.

Copy them to your configuration.yaml as sensors:

sensor:
  - platform: scrape
    etc

Ameren Gas:

  - platform: scrape
    resource: https://www.citizensutilityboard.org/gas/
    name: ameren gas cost
    select: "p"
    index: 1
    value_template: '.{{ value.split(" ")[2] | replace (".", "") | replace ("¢","")}}'
    unit_of_measurement: "USD/therm"

Nicor Gas:

  - platform: scrape
    resource: https://www.citizensutilityboard.org/gas/
    name: nicor gas cost
    select: "p"
    index: 2
    value_template: '.{{ value.split(" ")[2] | replace (".", "") | replace ("¢","")}}'
    unit_of_measurement: "USD/therm"

North Shore Gas:

  - platform: scrape
    resource: https://www.citizensutilityboard.org/gas/
    name: north shore gas cost
    select: "p"
    index: 3
    value_template: '.{{ value.split(" ")[4] | replace (".", "") | replace ("¢","")}}'
    unit_of_measurement: "USD/therm"

People’s Gas

  - platform: scrape
    resource: https://www.citizensutilityboard.org/gas/
    name: peoples gas cost
    select: "p"
    index: 4
    value_template: '.{{ value.split(" ")[3] | replace (".", "") | replace ("¢","")}}'
    unit_of_measurement: "USD/therm"

ComEd Electric:

  - platform: scrape
    resource: https://www.citizensutilityboard.org/electric/
    name: Current Electric Cost
    select: "p"
    index: 2
    value_template: '.0{{ value.split(" ")[0] | replace (".", "") }}'
    unit_of_measurement: "USD/kWh"

Ameren Electric (summer):

  - platform: scrape
    resource: https://www.citizensutilityboard.org/electric/
    name: ameren electric cost summer
    select: "p"
    index: 4
    value_template: '.0{{ value.split(" ")[0] | replace (".", "") }}'
    unit_of_measurement: "USD/kWh"

Ameren Electric 0-800 kWh (winter):

  - platform: scrape
    resource: https://www.citizensutilityboard.org/electric/
    name: ameren electric cost winter less 800
    select: "p"
    index: 4
    value_template: '.0{{ value.split(" ")[0] | replace (".", "") }}'
    unit_of_measurement: "USD/kWh"

Ameren Electric Over 800 kWh (winter):

  - platform: scrape
    resource: https://www.citizensutilityboard.org/electric/
    name: ameren electric cost winter over 800
    select: "p"
    index: 5
    value_template: '.0{{ value.split(" ")[0] | replace (".", "") }}'
    unit_of_measurement: "USD/kWh"
2 Likes

Nice. Ameren user here. Are you also pulling in your meter data, and if so, how? I looked into it a while back but it looked like it might require a SDR.

Using multiscrape would save you a lot of requests.

@danieldotnl it doesn’t look like multiscrape supports the “index” function, but maybe handles it another way?

You can just make that part of your CSS selector. See this for example.

1 Like

I’m using a Shelly 3EM in my electrical panel to directly read the power. I have compared my readings to my monthly bills, and its very close.

1 Like

I use multiscrape in my own config, although I only need 2 of these. These are just the individual ones so anyone can copy what they need and use multiscrape as well.

1 Like

Just for reference, Comed Hourly pricing is available via API. Thanks for sharing the People’s Gas however.

Edit: answered my own questions

Couple questions,

  1. is this still working for anyone?
    A: probably not as originally scripted

  2. has anyone successfully moved this to the scrape integration?
    I’ve set everything up for nicor using the yaml code above, but I don’t get any data for the sensor
    A: I just did. The process is simple if you have a working yaml. My problem was assuming the yaml code in the OP still worked.

I’ll give future people the info that worked for me for Nicor pricing from CUB

  - platform: scrape
    resource: https://www.citizensutilityboard.org/gas/
    name: nicor gas cost #whatever name you want
    select: "p"
    index: 2
    value_template: '.{{ value.split(" ")[67] | replace ("Gas–","") | replace (".","")}}'
    unit_of_measurement: "USD/therm"

Notice the value template now has a 67 instead of 2. This is likely to break in the near future which is why I also added a scrape from nicor’s own site, that hopefully lasts longer

  - platform: scrape
    resource: https://www.nicorgas.com/residential/pricing-rate-plans.html
    name: nicor gas cost #whatever name you want
    select: "p"
    index: 9
    value_template: '.{{ value.split(" ")[3] | replace (".", "") | replace ("¢","")}}'
    unit_of_measurement: "USD/therm"

I also set the device class to ‘monetary’ for these

I’m hoping this scrtape is more durable