mjmeli / ha-duke-energy-gateway

Uses the Duke Energy Gateway to import real time energy usage into Home Assistant
MIT License
34 stars 4 forks source link

HA Energy Dashboard No Longer Displaying Duke Electric Usage #148

Closed BrettEBowman closed 1 year ago

BrettEBowman commented 1 year ago

Version of the custom_component

When I look at a device, the about says it is v1.0.0, but HACS shows the version as 0.1.2.

Configuration

It is connected to my account and has been working fine for quite a while.

Describe the bug

I noticed a couple of days ago that my energy usage was no longer being reported in the HA tab.

I think that the timing may have correlated with my upgrade to HA 2022.11.0.

It appears to me from the debug logging (see below) that it is receiving data from the Duke service. So I'm wondering if something about the interface to HA was changed in 2022.11.0 which is causing this integration to not properly pass the data to HA.

Debug log

2022-11-05 15:36:45.097 DEBUG (MainThread) [pyduke_energy.realtime] Socket readable, calling loop_read()
2022-11-05 15:36:45.098 DEBUG (MainThread) [pyduke_energy.realtime] Received PUBLISH (d0, q0, r0, m0), 'DESH/P210400605/out/sm/1/live', ... (129 bytes)
2022-11-05 15:36:48.100 DEBUG (MainThread) [pyduke_energy.realtime] Socket readable, calling loop_read()
2022-11-05 15:36:48.102 DEBUG (MainThread) [pyduke_energy.realtime] Received PUBLISH (d0, q0, r0, m0), 'DESH/P210400605/out/sm/1/live', ... (129 bytes)
2022-11-05 15:36:51.096 DEBUG (MainThread) [pyduke_energy.realtime] Socket readable, calling loop_read()
2022-11-05 15:36:51.097 DEBUG (MainThread) [pyduke_energy.realtime] Received PUBLISH (d0, q0, r0, m0), 'DESH/P210400605/out/sm/1/live', ... (129 bytes)
2022-11-05 15:36:54.112 DEBUG (MainThread) [pyduke_energy.realtime] Socket readable, calling loop_read()
2022-11-05 15:36:54.113 DEBUG (MainThread) [pyduke_energy.realtime] Received PUBLISH (d0, q0, r0, m0), 'DESH/P210400605/out/sm/1/live', ... (129 bytes)
2022-11-05 15:36:56.084 DEBUG (MainThread) [pyduke_energy.realtime] Sending PINGREQ
2022-11-05 15:36:56.085 DEBUG (MainThread) [pyduke_energy.realtime] Watching socket for writability.
2022-11-05 15:36:56.086 DEBUG (MainThread) [pyduke_energy.realtime] Socket is writable, calling loop_write
2022-11-05 15:36:56.087 DEBUG (MainThread) [pyduke_energy.realtime] Stop watching socket for writability.
2022-11-05 15:36:56.116 DEBUG (MainThread) [pyduke_energy.realtime] Socket readable, calling loop_read()
2022-11-05 15:36:56.117 DEBUG (MainThread) [pyduke_energy.realtime] Received PINGRESP
2022-11-05 15:36:57.096 DEBUG (MainThread) [pyduke_energy.realtime] Socket readable, calling loop_read()
2022-11-05 15:36:57.098 DEBUG (MainThread) [pyduke_energy.realtime] Received PUBLISH (d0, q0, r0, m0), 'DESH/P210400605/out/sm/1/live', ... (129 bytes)
2022-11-05 15:37:00.168 DEBUG (MainThread) [pyduke_energy.realtime] Socket readable, calling loop_read()
2022-11-05 15:37:00.169 DEBUG (MainThread) [pyduke_energy.realtime] Received PUBLISH (d0, q0, r0, m0), 'DESH/P210400605/out/sm/1/live', ... (129 bytes)
2022-11-05 15:37:03.100 DEBUG (MainThread) [pyduke_energy.realtime] Socket readable, calling loop_read()
2022-11-05 15:37:03.101 DEBUG (MainThread) [pyduke_energy.realtime] Received PUBLISH (d0, q0, r0, m0), 'DESH/P210400605/out/sm/1/live', ... (129 bytes)
2022-11-05 15:37:06.096 DEBUG (MainThread) [pyduke_energy.realtime] Socket readable, calling loop_read()
2022-11-05 15:37:06.097 DEBUG (MainThread) [pyduke_energy.realtime] Received PUBLISH (d0, q0, r0, m0), 'DESH/P210400605/out/sm/1/live', ... (129 bytes)
2022-11-05 15:37:09.096 DEBUG (MainThread) [pyduke_energy.realtime] Socket readable, calling loop_read()
2022-11-05 15:37:09.097 DEBUG (MainThread) [pyduke_energy.realtime] Received PUBLISH (d0, q0, r0, m0), 'DESH/P210400605/out/sm/1/live', ... (129 bytes)
2022-11-05 15:37:12.098 DEBUG (MainThread) [pyduke_energy.realtime] Socket readable, calling loop_read()
2022-11-05 15:37:12.100 DEBUG (MainThread) [pyduke_energy.realtime] Received PUBLISH (d0, q0, r0, m0), 'DESH/P210400605/out/sm/1/live', ... (129 bytes)
2022-11-05 15:37:13.293 DEBUG (MainThread) [pyduke_energy.client] Requesting usage between 2022-11-05T04:00 UTC and 2022-11-06T04:00 UTC
2022-11-05 15:37:15.094 DEBUG (MainThread) [pyduke_energy.realtime] Socket readable, calling loop_read()
2022-11-05 15:37:15.095 DEBUG (MainThread) [pyduke_energy.realtime] Received PUBLISH (d0, q0, r0, m0), 'DESH/P210400605/out/sm/1/live', ... (129 bytes)
2022-11-05 15:37:18.097 DEBUG (MainThread) [pyduke_energy.realtime] Socket readable, calling loop_read()
2022-11-05 15:37:18.098 DEBUG (MainThread) [pyduke_energy.realtime] Received PUBLISH (d0, q0, r0, m0), 'DESH/P210400605/out/sm/1/live', ... (129 bytes)
BrettEBowman commented 1 year ago

A little more info:

When I look at the 2 entities under the Duke Energy Gateway device, I can see that the "Duke Energy Current Usage [W]" entity has data, but the "Duke Energy Usage Today [kWh]" entity is always 0 now.

mjmeli commented 1 year ago

I'm currently running Home Assistant 2022.11.1 and version 0.1.2 of the integration and I'm not seeing this issue.

There are 2 different API interaction methods in this integration. One is the realtime push which is the Current Usage entity, which definitely is getting updated as you can see that in the logs. The other is a polling call to the API which shows in the log as a request but for some reason isn't updating

Requesting usage between 2022-11-05T04:00 UTC and 2022-11-06T04:00 UTC

There's no error message so it seems like the API is returning 0 maybe.

I'm not sure if they have made some change to the API that is on some sort of A/B mode so I'm not able to see the same issue

BrettEBowman commented 1 year ago

I think it is some problem with Duke's server(s). When I go into their app on my phone, it is showing the smart meter gateway is online. But when I try to display Energy Usage for the current day, I get an error saying "Sorry, but your data is unavailable at this times. Please select a different time frame or check back later." If I go and look at yesterday there, it is showing me data.

I guess I'll just wait a little while longer and see if it starts working again.

mjmeli commented 1 year ago

Strange, I think people have had issues similar in the past and they've had to re-add their gateway.

If you want, you can try using this web app I made that calls the APIs directly and might provide more insight: https://pyduke-energy-test-app.up.railway.app/

However not sure if it will provide any good insight

BrettEBowman commented 1 year ago

Thanks for helping try to troubleshoot.

I tried you test app. It ends up just displaying “ERROR: “ ☹

I did also log into my account on the Duke website. It is only showing usage data through yesterday, too.

When you said “they’ve had to re-add their gateway” did you mean re-add the gateway in their Duke account or re-add the integration and re-enter credentials?

-Brett

From: Michael Meli @.> Sent: Monday, November 7, 2022 3:37 PM To: mjmeli/ha-duke-energy-gateway @.> Cc: Brett Bowman @.>; Author @.> Subject: Re: [mjmeli/ha-duke-energy-gateway] HA Energy Dashboard No Longer Displaying Duke Electric Usage (Issue #148)

Strange, I think people have had issues similar in the past and they've had to re-add their gateway.

If you want, you can try using this web app I made that calls the APIs directly and might provide more insight: https://pyduke-energy-test-app.up.railway.app/

However not sure if it will provide any good insight

— Reply to this email directly, view it on GitHubhttps://github.com/mjmeli/ha-duke-energy-gateway/issues/148#issuecomment-1306155690, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEEJW7ORWCTULI5APPTDIN3WHFR5XANCNFSM6AAAAAARYCE4KY. You are receiving this because you authored the thread.Message ID: @.**@.>>

mjmeli commented 1 year ago

Usage data through yesterday is the default data that comes from a regular meter without the gateway. It sounds like the realtime data isn't getting through (which is weird how the realtime stream is working).

Ultimately I just reverse engineered the API that the app is making, so if the app isn't working then the integration isn't going to work

For the re-adding, I mean they are re-adding it to their Duke account, so basically running the setup again

BrettEBowman commented 1 year ago

Well, I ended up trying rebooting the smart gateway. And now I’m getting data again! Don’t know why it wasn’t working before, but glad it’s back now.

Thanks again for your help!

-Brett

From: Michael Meli @.> Sent: Monday, November 7, 2022 4:23 PM To: mjmeli/ha-duke-energy-gateway @.> Cc: Brett Bowman @.>; Author @.> Subject: Re: [mjmeli/ha-duke-energy-gateway] HA Energy Dashboard No Longer Displaying Duke Electric Usage (Issue #148)

Usage data through yesterday is the default data that comes from a regular meter without the gateway. It sounds like the realtime data isn't getting through (which is weird how the realtime stream is working).

Ultimately I just reverse engineered the API that the app is making, so if the app isn't working then the integration isn't going to work

For the re-adding, I mean they are re-adding it to their Duke account, so basically running the setup again

— Reply to this email directly, view it on GitHubhttps://github.com/mjmeli/ha-duke-energy-gateway/issues/148#issuecomment-1306211665, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEEJW7IUTMO5KK7ZMMXV4G3WHFXMBANCNFSM6AAAAAARYCE4KY. You are receiving this because you authored the thread.Message ID: @.**@.>>

mjmeli commented 1 year ago

Good to hear! I'll have to remember that in case someone else has that issue