Realtime energy unavailable in b7 or b8
Closed this issue · 7 comments
Version of the custom_component
Version 0.1.0b8
Configuration
Realtime interval left blank or set to 3.
Debug Logger set as follows:
logger:
default: info
logs:
custom_components.duke_energy_gateway: debug
pyduke_energy.client: debug
pyduke_energy.realtime: debug
Describe the bug
I had noticed this issue on b7 and had opted to continue running b6 where realtime energy usage was working at the time. I updated to b8 this morning after the patch for the API change. I'm seeing the same behavior in b8 as I observed in b7 where sensor.duke_energy_current_usage_w shows 'unavailable' and has not updated at the specified interval. I have tried leaving interval blank and also setting it to 3 (seconds), but it does not change. I do see two entries in the debug log for the realtime sensor, but I do not see any realtime updates as was in previous versions, only for today's usage. Rolling back to b6 restores realtime usage, but has the now outdated API references.
Debug log
2021-12-16 08:48:31 INFO (MainThread) [homeassistant.setup] Setting up duke_energy_gateway
2021-12-16 08:48:31 INFO (MainThread) [homeassistant.setup] Setup of domain duke_energy_gateway took 0.0 seconds
2021-12-16 08:48:31 INFO (MainThread) [custom_components.duke_energy_gateway]
-------------------------------------------------------------------
Duke Energy Gateway
This is a custom integration!
If you have any issues with this you need to open an issue here:
https://github.com/mjmeli/ha-duke-energy-gateway/issues
-------------------------------------------------------------------
2021-12-16 08:48:31 DEBUG (MainThread) [custom_components.duke_energy_gateway] Set up Duke Energy API clients
2021-12-16 08:48:31 DEBUG (MainThread) [pyduke_energy.client] Getting new OAuth auth
2021-12-16 08:48:34 DEBUG (MainThread) [pyduke_energy.client] Accounts to check for gateway (1): 'XXXXXXXX'
2021-12-16 08:48:34 DEBUG (MainThread) [pyduke_energy.client] Checking account XXXXXXXX' for gateway
2021-12-16 08:48:41 DEBUG (MainThread) [pyduke_energy.client] Meters to check for gateway (1): 'XXXXXXXX'
2021-12-16 08:48:41 DEBUG (MainThread) [pyduke_energy.client] Checking meter 'XXXXXXXX' for gateway [meter_type=ELECTRIC, is_certified_smart_meter=True]
2021-12-16 08:48:41 DEBUG (MainThread) [pyduke_energy.client] Getting new gateway auth
2021-12-16 08:48:42 DEBUG (MainThread) [pyduke_energy.client] Found meter 'XXXXXXXX' with gateway 'XXXXXXXX'
2021-12-16 08:48:42 DEBUG (MainThread) [pyduke_energy.client] Requesting usage between 2021-12-16T05:00 UTC and 2021-12-17T05:00 UTC
2021-12-16 08:48:42 DEBUG (MainThread) [custom_components.duke_energy_gateway] Finished fetching homeassistant data in 0.297 seconds (success: True)
2021-12-16 08:48:42 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.duke_energy_gateway
2021-12-16 08:48:42 DEBUG (MainThread) [custom_components.duke_energy_gateway] Subscribed target for _RealtimeUsageSensor to dispatcher
2021-12-16 08:48:42 DEBUG (MainThread) [custom_components.duke_energy_gateway] Triggered real-time connect/subscribe async task
2021-12-16 08:49:12 DEBUG (MainThread) [pyduke_energy.client] Requesting usage between 2021-12-16T05:00 UTC and 2021-12-17T05:00 UTC
2021-12-16 08:49:13 DEBUG (MainThread) [custom_components.duke_energy_gateway] Finished fetching homeassistant data in 0.765 seconds (success: True)
2021-12-16 08:49:42 DEBUG (MainThread) [pyduke_energy.client] Requesting usage between 2021-12-16T05:00 UTC and 2021-12-17T05:00 UTC
2021-12-16 08:49:43 DEBUG (MainThread) [custom_components.duke_energy_gateway] Finished fetching homeassistant data in 0.886 seconds (success: True)
2021-12-16 08:50:12 DEBUG (MainThread) [pyduke_energy.client] Requesting usage between 2021-12-16T05:00 UTC and 2021-12-17T05:00 UTC
2021-12-16 08:50:13 DEBUG (MainThread) [custom_components.duke_energy_gateway] Finished fetching homeassistant data in 1.087 seconds (success: True)
2021-12-16 08:50:42 DEBUG (MainThread) [pyduke_energy.client] Requesting usage between 2021-12-16T05:00 UTC and 2021-12-17T05:00 UTC
2021-12-16 08:50:43 DEBUG (MainThread) [custom_components.duke_energy_gateway] Finished fetching homeassistant data in 1.082 seconds (success: True)
2021-12-16 08:51:12 DEBUG (MainThread) [pyduke_energy.client] Requesting usage between 2021-12-16T05:00 UTC and 2021-12-17T05:00 UTC
2021-12-16 08:51:13 DEBUG (MainThread) [custom_components.duke_energy_gateway] Finished fetching homeassistant data in 0.611 seconds (success: True)
2021-12-16 08:51:42 DEBUG (MainThread) [pyduke_energy.client] Requesting usage between 2021-12-16T05:00 UTC and 2021-12-17T05:00 UTC
2021-12-16 08:51:43 DEBUG (MainThread) [custom_components.duke_energy_gateway] Finished fetching homeassistant data in 0.896 seconds (success: True)
2021-12-16 08:52:12 DEBUG (MainThread) [pyduke_energy.client] Requesting usage between 2021-12-16T05:00 UTC and 2021-12-17T05:00 UTC
2021-12-16 08:52:13 DEBUG (MainThread) [custom_components.duke_energy_gateway] Finished fetching homeassistant data in 0.761 seconds (success: True)
2021-12-16 08:52:42 DEBUG (MainThread) [pyduke_energy.client] Requesting usage between 2021-12-16T05:00 UTC and 2021-12-17T05:00 UTC
2021-12-16 08:52:43 DEBUG (MainThread) [custom_components.duke_energy_gateway] Finished fetching homeassistant data in 0.719 seconds (success: True)
2021-12-16 08:53:12 DEBUG (MainThread) [pyduke_energy.client] Requesting usage between 2021-12-16T05:00 UTC and 2021-12-17T05:00 UTC
2021-12-16 08:53:13 DEBUG (MainThread) [custom_components.duke_energy_gateway] Finished fetching homeassistant data in 0.467 seconds (success: True)
2021-12-16 08:53:42 DEBUG (MainThread) [pyduke_energy.client] Requesting usage between 2021-12-16T05:00 UTC and 2021-12-17T05:00 UTC
2021-12-16 08:53:43 DEBUG (MainThread) [custom_components.duke_energy_gateway] Finished fetching homeassistant data in 0.485 seconds (success: True)
2021-12-16 08:54:12 DEBUG (MainThread) [pyduke_energy.client] Requesting usage between 2021-12-16T05:00 UTC and 2021-12-17T05:00 UTC
2021-12-16 08:54:13 DEBUG (MainThread) [custom_components.duke_energy_gateway] Finished fetching homeassistant data in 0.838 seconds (success: True)
2021-12-16 08:54:42 DEBUG (MainThread) [pyduke_energy.client] Requesting usage between 2021-12-16T05:00 UTC and 2021-12-17T05:00 UTC
2021-12-16 08:54:43 DEBUG (MainThread) [custom_components.duke_energy_gateway] Finished fetching homeassistant data in 0.910 seconds (success: True)
2021-12-16 08:55:12 DEBUG (MainThread) [pyduke_energy.client] Requesting usage between 2021-12-16T05:00 UTC and 2021-12-17T05:00 UTC
2021-12-16 08:55:13 DEBUG (MainThread) [custom_components.duke_energy_gateway] Finished fetching homeassistant data in 0.865 seconds (success: True)
2021-12-16 08:55:42 DEBUG (MainThread) [pyduke_energy.client] Requesting usage between 2021-12-16T05:00 UTC and 2021-12-17T05:00 UTC
2021-12-16 08:55:43 DEBUG (MainThread) [custom_components.duke_energy_gateway] Finished fetching homeassistant data in 0.771 seconds (success: True)
b6 -> b7 brought in a new version of pyduke-energy that made sure connections were being made in an async safe manner, since the MQTT library's connect function blocks and I was seeing it take down the HA instance completely if the connect was failing and blocked.
I'm surprised this would be working on b6 if it isn't working on b7 though. My best guess is that the connect is failing, but in b6 that should mean your HA would hang.
I'm actively working on trying to fix #39 which will have some improvements to this to detect stuck connects in the event of network outages. Perhaps this might also address this issue. I'll try to see if I can figure out what's going on in this case.
those changes I mentioned are in now for version v0.1.0b9. can you check that version and see if it is working for you?
It does not. It does have a more verbose error though.
2021-12-18 14:56:41 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.duke_energy_gateway 2021-12-18 14:56:41 DEBUG (MainThread) [custom_components.duke_energy_gateway] Subscribed target for _RealtimeUsageSensor to dispatcher 2021-12-18 14:56:41 DEBUG (MainThread) [custom_components.duke_energy_gateway] Triggered real-time connect/subscribe async task 2021-12-18 14:56:41 ERROR (MainThread) [pyduke_energy.realtime] Caught non-retryable error 'TypeError' in forever loop. Will not attempt reconnect. Error: __init__() got an unexpected keyword argument 'reconnect_on_failure'
Let me know if there’s any other information I can gather that may be helpful. I appreciate all the work you’ve put into this.
It seems like there's a version issue in the MQTT library. That's provided by Home Assistant itself. What version of HA are you running?
Ah. That might explain it. I’m running Home Assistant 2021.10.0. I’ll check for updates and reply back here.
Updating HA fixed my issue. Thanks for your help diagnosing that. Everything’s looking good.
Good to hear, I didn't think about that being an issue. I'll update the min version of HA required shortly, probably 2021.11 is enough since it was working for me.