Skip to main content

Python wrapper for California's energy price API MIDAS.

Project description

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

  1. Start by registering an account with MIDAS. There is no webpage for this so I have provided a helper. You only have to register an account once.
from california_midasapi import Midas
response = Midas.register("username", "password", "email@email.email", "Full Name")
print(response)

You should see User account for username was successfully created. A verification email has been sent to email@email.email. Please click the link in the email in order to start using the API..
Click the link in the email, then you can use the rest of the API as described below.

  1. Create a Midas object:
from california_midasapi import Midas
midas = Midas("username", "password")
  1. 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

california_midasapi-1.0.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

california_midasapi-1.0.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file california_midasapi-1.0.0.tar.gz.

File metadata

  • Download URL: california_midasapi-1.0.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for california_midasapi-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c191b3641945b9002845631d08e09f46adaf3b7dc8dbe20c8f50cb877f4a4740
MD5 804c21688658cbb42fa712916abda11f
BLAKE2b-256 c5239aa5e6e474526a61e8b1127bb457e5f5a7cf7ca5d5759b3fe4df5d656160

See more details on using hashes here.

Provenance

The following attestation bundles were made for california_midasapi-1.0.0.tar.gz:

Publisher: python-publish.yml on MattDahEpic/california-midasapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file california_midasapi-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for california_midasapi-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 23c3185eeb65bc650cf4722ce5397adb2cc02854cac3172a549217ca2b1d9d7e
MD5 53a9bc071fc979e8aaeff21ebfe5bf8b
BLAKE2b-256 b5e2261d751f9c5917fc29643291290b3c7cbd031f1be12be0d8d743b0582d4c

See more details on using hashes here.

Provenance

The following attestation bundles were made for california_midasapi-1.0.0-py3-none-any.whl:

Publisher: python-publish.yml on MattDahEpic/california-midasapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page