california-midasapi
A Python wrapper for the California Energy Comission (CEC)'s Market Informed Demand Automation Server (MIDAS) energy price API.
This API lets you get info about energy prices in California from utilities regulated by the CEC, which is all the big ones (PG&E, SCE, SDG&E, SMUD, etc.) and some smaller municipal utilities. If you have a Rate Identification Number (RIN) QR Code on your electric bill you can use this API to get your electricity price in real time.
Usage
- Create a
Midasobject:
from california_midasapi import Midas
async with aiohttp.ClientSession() as session:
midas = Midas(session)
asyncio.run(main())
- Access the API methods using this object:
# Get basic info about all rates
from california_midasapi.ratelist import RINFilter
rates = midas.GetAvailableRates(RINFilter.TARIFF)
print(rates) # ~40k+ items at writing
# Get specific info about one rate
ratedata = midas.GetRateInfo('USCA-SMSM-AD00-0000')
print(ratedata)
# Get the currently applicable value from a rate (local filtering)
print(ratedata.GetCurrentTariffs())
Contributing
Contributions are welcome, please submit a PR!
More Information & Thanks
More info about MIDAS can be found at https://midasapi.energy.ca.gov/
Thank you to the CEC for providing example code at https://github.com/morganmshep/MIDAS-Python-Repository
Projects using this library
ha-midas: A Home Assistant integration to expose MIDAS rate data to your smart home
If you have a project using this library, we'd love to hear about it! Let us know and we'll add it to this list.
Metadata
Release files for california-midasapi 2.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| california_midasapi-2.1.1.tar.gz | 9.2 kB | With provenance | Details for california_midasapi-2.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| california_midasapi-2.1.1-py3-none-any.whl | Python 3 | none | any | Details for california_midasapi-2.1.1-py3-none-any.whl |
Total release size: 15.9 kB
Release files / california_midasapi-2.1.1.tar.gz
| Download URL | california_midasapi-2.1.1.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4dc80b479712bfd09d76f9c7b65e6cd2f68a66cf09890653df39fc9ccfacfd06
|
|
BLAKE2b-256 checksum How to use checksums |
3047f60c814f9b45e466c1eead51e94c60012fe4a4afb22a08e5661c27ce05a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 6, 2026.
Transparency logRelease files / california_midasapi-2.1.1-py3-none-any.whl
| Download URL | california_midasapi-2.1.1-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
163d45360bb801872d534d50a76391c0799aec2de0acd8713ffed9e385af3f4f
|
|
BLAKE2b-256 checksum How to use checksums |
4e7b59bfa3a2ea449cc99f00b1f8a63a4a9becca7b1a9790dc1569520e978d96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 6, 2026.
Transparency logSecurity for california-midasapi 2.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for california_midasapi-2.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 6, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.