Duke Energy Gateway - Realtime Smart Meter Readings

Use a static price
enter your kWh cost

Gives me the same result $0.00 I was thinking it may be a problem in core-2021.9.6. Does the static price work for you? Really isn’t a huge deal either way.

Yes, you may have to wait some time (2hrs) before it starts reading.

I have no issues with that template price on 2021.9.6. Do you have any errors in the logs? For example, if your currency was ever something over than USD, it can break the cost sensor.

I did have a few errors when i first tried adding the sensor in the energy configuration. Something about not understanding it was USD/kWh. To fix it I removed the line in the yaml that had “unit_of_measurement: USD/kWh” pasted it right straight back in and that fixed it after a reboot. I couldn’t see that I did a thing. I kept the formatting exactly the same.

No errors are in the log now. Should I remove the sensor, reboot, and try again?

Sorry to sound thick. Learning as I go. Thanks.

I don’t know honestly. I did personally run into an issue with the statistic when I had my currency in HA set as EUR while the sensor was USD. The error was that since the unit of measure did not match, it would not record statistics anymore. This was my error message Generation of long term statistics will be suppressed unless the unit changes back - #3 by mjmeli. I went in and manually adjusted the UOM in the DB for that statistic. However that error showed in the logs.

Yes, I experienced this problem too. When currency was added to HA, the default was EUR. When you setup the Duke Energy integration HA automatically creates a cost entity that uses the currency you have set in Configurations / General. If you try to change the currency type after the cost entity is created it causes a currency error which prevents the Energy page from updating the cost (stays 0.00).

For now I have simply changed currency back to EUR under configurations / general. Cost shows properly, just in EUR rather than $.

I think when the cost entity is created, a second hidden cost entity is also created that is used on the energy page. Deleting and recreating the regular cost entity does not clear the history on the energy page. So there is an energy page cost entity with a currency set that can’t currently be updated.

I assume this bug will be fixed, I’ve seen a number of people having the same problem.

It is fixable in the DB if you are comfortable adjusting it. You can also just wipe out your DB but it will reset your history and long-term statistics.

Yeah I had seen that suggestion of deleting my DB elsewhere too lol, but I’m ok just leaving it as EUR until the HA devs fix it

While looking to get real time energy information I stumbled across this and have a request pending with Duke to get one of their gateways as part of the pilot program. Based on my understanding this gateway will use Zigbee to communicate with my smart meter (in my case an Itron AM7). Has anybody figured out how to directly leverage Zigbee to communicate with the Itron from HA without having to use one of Duke’s gateways and thus having to rely on their cloud APIs (is there any way to read the Zigbee key off of the gateway)?

I’m also awaiting a Duke Energy gateway device. I’m keenly interested in reading Zigbee from the meter and NOT using their gateway if at all possible.

The Gateway is very much locked down. When you first power up the device TCP 22 and 9330 are open. I could SSH into the device but without a username/password I couldn’t get in. After setup and gateway pairing those ports close.

USB and SATA are not in the boot sequence. The only way I could think of to get access is either via UART (you’d have to solder in the pins because only the pads for serial are present), or remove the eMMC and read it.

I’m pretty sure the ZigBee communication is encrypted.

The app gives current demand. Is there anyway to send that to HA?

It’s possible. I have an pure implementation of the real-time data pull in a Python script, but I haven’t started on anything to bring that into HA and it’s a little unstable due to the nature of how Duke implemented it.

Debian 11 Bullseye
Home Assistant Supervised 2021.10.6
pip installed pyduke-energy and downloaded duke_energy_gateway, then loaded the custom_components directory.
Despite restarting HA supervisor, HA core, and the Debian host system, cannot see the Duke Energy Gateway as an available integration. :frowning:

I’m fairly certain I’ve missed something, but not really sure what it may be.

I don’t have any experience with the manual installation method as I use HACS, but one “gotcha” is that you often need to clear your browser cache for new things to show in the UI. Maybe try Ctrl+F5 on the integrations page and then see if it shows up.

1 Like

Refresh got it - - THANK YOU!!

For those using the HACS custom integration, I’ve recently pushed a new beta release that has support for capturing the real-time power reading. The recent Duke Energy maintenance downtime hampered testing but I’ve had it running for a while myself and it seems pretty stable. It drops sometimes but it’s not too bad.

If you’re interested in trying, it out, via HACS on the install (or re-install if you already have it), you can toggle the “Show beta versions” toggle and select v0.1.0b5.

A new entity will be created with the current usage in watts.
image

One disclaimer…this produces a lot of data. You will get a reading every second or so. If you have concerns with the amount of data, you can click on the integration’s “Configure” options and set a throttling interval which will only update the entity every X seconds. By default this is disabled (= 0).
image

I’ll push this to a proper release 0.1.0 soon, but I’ll be out of town so I don’t want to be on the hook if it breaks anything :slight_smile:

1 Like

Just upgraded. This looks great, thank you!

I like that this gives me readings down to the watt, even if it is a little jittery. Also having 1sec resolution is nice.
Now to see how much this inflates my database size :slight_smile:

I may just turn off this entity in the recorder. Is there a way to set different time intervals for different entities in the recorder? I have a 10 day history, but for this real-time entity I don’t need more than an hour or two history.

No, I don’t think that’s possible. Maybe somehow there is a way to execute a scheduled SQL script to clean it up or something. I’ve definitely been keeping my eye on DB size too. I have gone back and forth on implementing the throttling by default or let the user decide for themselves. Still undecided on that.