Duke Energy Logo Duke Energy Gateway

GitHub Release GitHub Build GitHub Activity

License pre-commit Black

hacs Project Maintenance BuyMeCoffee

This is a custom integration for Home Assistant. It pulls near-real-time energy usage from Duke Energy via the Duke Energy Gateway pilot program.

This component will set up the following entities.

Platform Description
sensor.duke_energy_usage_today_kwh Represents today’s energy consumption (from 0:00 local time to 23:59 local time, then resetting). Additional attributes are available containing the meter ID, gateway ID, and the timestamp of the last measurement.

This integration leverages the pyduke-energy library, also written by me, to pull data. This API is very unofficial and may stop working at any time (see Disclaimer). Also, you are required to have a Duke Energy Gateway connected to your smartmeter for this to work. This integration does not support any other method of retrieving data (see Gateway Requirement).

Energy usage will be provided as daily data, resetting at midnight local time. At the moment, the API appears to be limited to providing new records every 15 minutes, meaning readings could be delayed up to 15 minutes. For more information, see limitations in the pyduke-energy repo.


HACS Installation

  1. Add as a Custom Repository under Settings in HACS: mjmeli/ha-duke-energy-gateway and choose Integration as the Category.
  2. Restart Home Assistant
  3. In the HA UI go to “Configuration” -> “Integrations” click “+” and search for “Duke Energy Gateway”

Manual Installation

  1. Using the tool of choice open the directory (folder) for your HA configuration (where you find configuration.yaml).
  2. If you do not have a custom_components directory (folder) there, you need to create it.
  3. In the custom_components directory (folder) create a new folder called duke_energy_gateway.
  4. Download all the files from the custom_components/duke_energy_gateway/ directory (folder) in this repository.
  5. Place the files you downloaded in the new directory (folder) you created.
  6. Restart Home Assistant
  7. In the HA UI go to “Configuration” -> “Integrations” click “+” and search for “Duke Energy Gateway”

Configuration is done in the UI

Configuration will be done in the UI. You will need to provide the following data:

Data Description
email Your login email to Duke Energy.
password Your login password to Duke Energy.

Meter Selection

The configuration flow will automatically attempt to identify your gateway and smartmeter. Right now, only one is supported per account. The first one identified will be used. If one cannot be found, the configuration process should fail.


I suggest using the dev container for development by opening in Visual Studio Code with code . and clicking on the option to re-open with dev container. In VS Code, you can run the task “Run Home Assistant on the port 9123” and then access it via http://localhost:9123.

If you want to install manually, you can install dev dependencies with pip install -r requirements_dev.txt.

Before commiting, run pre-commit run --all-files.

Contributions are welcome!

If you want to contribute to this please read the Contribution guidelines


This project was generated from @oncleben31‘s Home Assistant Custom Component Cookiecutter template.

Code template was mainly taken from @Ludeeus‘s integration_blueprint template