MIDAS - California Energy Prices, right from the regulator

If you live in California, you might have noticed a QR code appearing on your electricity bill since April 2024, claiming to be a “Rate Identification Number” or RIN. It turns out that the energy regulator in California requires all large electric companies to publish their electricity rates to an API called MIDAS: the Market Informed Demand Automation Server. The API is available to the public and with the help of that RIN on your electric bill I’ve created an integration that provides your current and near-future electricity price and can also be used in the Energy dashboard for price tracking.

You can get the integration by clicking this My button:
Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.
More information and images are available at the GitHub page:

I am in the process of submitting brand images and getting the integration added to the default HACS list but I wanted to share this since it’s functional right now.

If you can’t find the RIN on your electric bill or just want to test it out, some of the ones I’ve found during creating this integration are:

Rate RID
SCE’s TOU-D-4-9PM USCA-SCSC-0400-0000
SCE’s TOU-D-5-8PM USCA-SCSC-0500-0000

This is my first custom integration and I am excited to hear your feedback!

Installed, thanks! Nice job incorporating the account creation, setup went smoothly. I did have to edit customize.yaml to set the unit_of_measurement (USD/kWh) for the current price entity in order to use it in the energy dashboard. Will report back once some data are collected.

Edit: hmmm. It just jumped to “weekend peak” even though it’s 12:15am Monday. Maybe a timezone issue… My system clock is PDT (UTC-7) and weekend peak actually started 7 hours ago (5pm). I’ll take a closer look in the morning.

I’ve just released version 0.1.1 that might fix this. Please take a look and let me know if it’s showing the rates at the wrong time anymore

The energy dash requires unit of measurement to be “USD/kWh” (assuming all Californians have set their local currency in General settings to “US Dollar ($)”). Sensors are failing to create with error:

Error adding entity None for domain sensor with platform midas
...
ValueError: Entity <class 'custom_components.midas.sensor.MidasPriceSensor'> 
suggest an incorrect unit of measurement: USD.

I wanted to make sure I have sensors at 5pm so I manually modified the code but “USD/kWh” also fails — it seems “suggested_unit_of_measurement” only works on convertible units(?), of which money is not in the list. I tried using “native_unit_of_measurement” (but I have no idea if that’s correct or not), and got my sensors back so I should at least be able to test the 5pm rate switch, e.g. _attr_native_unit_of_measurement = "USD/kWh"

If you want to fix another minor bug, my sensors do not have default icons — I believe the mdi icon should be meter-electric not electric_meter. If you prefer a GitHub issue/PR please let me know!

1 Like

Thank you very much for the feedback! I’ve published version 0.1.2 with the fixes for the measurement unit and the icons.

Posted an issue with setup failing in the github repo, @MattDahEpic , but unfortunately it looks like a spammer replied with a very suspicious link. Only posting here to ensure nobody reading this clicks the link to what is likely malware.

1 Like

Thanks for clearing the spam link!
I bumped my Energy Dashboard FR here: Resolve/combine multiple energy sources in Energy Dashboard - #5 by Participant
As this great integration is exposing another tension between trying to keep/use historical data (such as Opower, or some other entity that was supplying energy cost data) and either replacing it with a new device/entity, or supplementing the dashboard data with real-time information.
It’s unfortunate that subbing in a new entity breaks the ability to maintain legacy data for the energy dash!

Can confirm my sensors are now updating at the correct times and with the correct rates for off-peak, weekend peak, and weekday peak.

After adding the cost entity in the energy dashboard I’m still seeing a cost of $0.00; may be unrelated to this integration. I will continue investigating.

1 Like

I’m on a TOU plan with SDGE (USCA-SDSD-0007-0000) and am not seeing any change in pricing; it stays set to the on-peak price 24/7. Is there any way to check the API responses directly to see if the data coming back from MIDAS is incorrect?

I also wasn’t sure how frequently the integration polled for changes, so I also did a few manual updates but the rate was still set to the on-peak value.

I’m thinking this is likely an issue with MIDAS/SDGE but wanted to double-check to see if there’s anything else I can do to troubleshoot.

There’s not currently a feature to view the API response directly, though I’ll likely add a custom service action for it since a few people have had a need for it.

I took a look at USCA-SDSD-0007-0000 (name TOUDR1) and it does stay constant at 0.70206 USD/kWh all day. They specify a rate details url that is invalid (https://tariff.sdge.com/tm2/ssi/tariffs/inc_elec_rates_res) so that makes me think they are not putting the correct price details into the MIDAS database.

So far as I can tell, this integration is the first end-consumer use of the MIDAS API so if you’re willing I would recommend reaching out to SDG&E to tell them the data behind the QR code on your bill is incorrect. I will also reach out to the California Energy Commission to let them know, though I suspect all they’ll be able to do is send a letter requesting them to update the data, not actually force any action.

1 Like

I figured it might be bad data :laughing: I will reach out to SDGE directly and advise them of the data issue with their RINs. Thanks for investigating!