Duke Energy shut down the Gateway pilot program at the end of June 2023. This integration has stopped functioning and is deprecated.
This is a custom integration for Home Assistant. It pulls real-time energy usage from Duke Energy via the Duke Energy Gateway pilot program.
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).
You are required to have a Duke Energy Gateway connected to your smartmeter for this to work. This is a separate device than your Smart Meter and is provided by an invitation only program at the moment. If you don't know what this is, then you probably don't have it. This integration does not support any other method of retrieving data (see Gateway Requirement).
This component will set up the following entities:
- Represents the real-time power usage in watts.
- This data is pushed from the gateway device every 1-3 seconds. NOTE: This produces a lot of data. If this update interval is too frequent for you, you can configure a throttling interval in seconds (see Configuration below).
- Note that since this is power usage, it cannot be used as-is for the Home Assistant energy dashboard. Instead, you can use the
sensor.duke_energy_usage_today_kwh
sensor, or you need to feed this real-time sensor through the Riemann sum integral integration. - Additional attributes are available containing the meter ID and gateway ID.
- Represents today's energy consumption in kilowatt-hours (from 0:00 local time to 23:59 local time, then resetting).
- This data is polled every 60 seconds, but data may be delayed up to 15 minutes due to delays in Duke Energy reporting it (see Limitations in the
pyduke-energy
repo.). - This can be used as-is for the Home Assistant energy consumption dashboard.
- Additional attributes are available containing the meter ID, gateway ID, and the timestamp of the last measurement.
- Add as a Custom Repository under Settings in HACS:
mjmeli/ha-duke-energy-gateway
and chooseIntegration
as the Category. - Search for "Duke Energy Gateway" in HACS and the integration should now be returned as a search result. Click on it, click the "Download" button, and walk through the prompts to download.
- Restart Home Assistant
- In the HA UI go to "Settings" -> "Devices and Services", make sure you are on the Integrations tab, then click "+" and search for "Duke Energy Gateway". This will let you set it up.
- Using the tool of choice open the directory (folder) for your HA configuration (where you find
configuration.yaml
). - If you do not have a
custom_components
directory (folder) there, you need to create it. - In the
custom_components
directory (folder) create a new folder calledduke_energy_gateway
. - Download all the files from the
custom_components/duke_energy_gateway/
directory (folder) in this repository. - Place the files you downloaded in the new directory (folder) you created.
- Restart Home Assistant
- In the HA UI go to "Settings" -> "Devices and Services", make sure you are on the Integrations tab, then click "+" and search for "Duke Energy Gateway". This will let you set it up.
Configuration will be done in the UI. Initially, you will need to provide the following data:
Data | Description |
---|---|
email |
Your login email to Duke Energy. |
password |
Your login password to Duke Energy. |
After the integration is setup, you will be able to do further configuration by clicking "Configure" on the integration page. This will allow you to modify the following options:
Data | Description |
---|---|
Real-time Usage Update Interval (sec) |
By default, the real-time usage sensor will be updated any time a reading comes in. If this data is too frequent, you can configure this value to throttle the data. When set to a positive integer X , the sensor will only be updated once every X seconds. In other words, if set to 30, you will get a new real-time usage every ~30 seconds. |
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.
If your meter selection fails, a first step should be to enable logging for the component (see Logging). If this does not give insight into the problem, please open a GitHub issue.
If you run into any issues and want to look into the logs, this integration provides verbose logging at the debug level. That can be enabled by adding the following to your configuration.yaml
file.
logger:
default: info
logs:
custom_components.duke_energy_gateway: debug
pyduke_energy.client: debug
pyduke_energy.realtime: debug
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
.
If you are working on implementing new changes from pyduke-energy
but do not want to release version of that library, you can set up your development environment to install from a remote working branch.
- Update
requirements_dev.txt
to replace themain
ingit+https://github.com/mjmeli/pyduke-energy@main
with your working branch and update the username if you have a fork (e.g.git+https://github.com/notmjmeli/pyduke-energy@new-feature-dev-branch
) - Uninstall locally cached version of
pyduke-energy
:pip uninstall -y pyduke-energy
- Re-run requirements installation:
pip install -r requirements_dev.txt
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