Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Error setting up entry brett@bowman-tech.com for duke_energy_gateway -- intermittent error #128

Closed
BrettEBowman opened this issue Sep 7, 2022 · 5 comments · Fixed by #129

Comments

@BrettEBowman
Copy link

Version of the custom_component

0.1.1

Configuration

Basically default configuration with 15 minute updates and correct Duke Energy Account which has the Gateway linked.

Describe the bug

Recently I've noticed quite a few failures of the integration to connect to the Duke Energy Gateway. This especially seems to happen after I do a restart of HA.

I do have the Smart Meter Gateway installed and linked to my account. And normally the integration works just fine. However, for some reason part of the time it errors saying "Failed to identify any smart meter with gateway access on your account"

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 357, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/duke_energy_gateway/__init__.py", line 54, in async_setup_entry
    selected_meter, selected_gateway = await client.select_default_meter()
  File "/usr/local/lib/python3.10/site-packages/pyduke_energy/client.py", line 175, in select_default_meter
    raise DukeEnergyError(
pyduke_energy.errors.DukeEnergyError: Failed to identify any smart meter with gateway access on your account

I'm not sure if there is some timeout that need to be lengthened or what. When this occurs, the Integrations screen show a red ! error saying "Failed to setup"
Screen Shot 09-07-22 at 12 22 PM

I believe that when that happens, the integration no longer tries to connect. So, maybe something just needs to be added so that when a known working configuration tries to restart and gets this error (i.e. due to a problem with the Duke servers) it would keep trying in the background.

Debug log

2022-09-07 11:08:23.399 INFO (MainThread) [homeassistant.bootstrap] Setting up stage 2: {'energy', 'counter', 'ring', 'proximity', 'input_number', 'homeassistant_alerts', 'hardware', 'localtuya', 'person', 'sensor', 'mobile_app', 'image', 'blueprint', 'analytics', 'script', 'repairs', 'ffmpeg', 'trace', 'onboarding', 'device_tracker', 'hardkernel', 'logbook', 'sun', 'timer', 'ipp', 'my', 'dwains_dashboard', 'brother', 'radio_browser', 'template', 'roku', 'mqtt', 'remote_homeassistant', 'search', 'tag', 'input_button', 'history', 'rest', 'device_automation', 'input_boolean', 'application_credentials', 'lovelace', 'openweathermap', 'wyzeapi', 'persistent_notification', 'input_text', 'tuya', 'duke_energy_gateway', 'input_datetime', 'hacs', 'diagnostics', 'met', 'browser_mod', 'tts', 'system_health', 'default_config', 'myq', 'config', 'zone', 'automation', 'input_select', 'map', 'utility_meter', 'auth', 'scene', 'media_source'}
2022-09-07 11:08:26.621 INFO (MainThread) [homeassistant.setup] Setting up duke_energy_gateway
2022-09-07 11:08:26.621 INFO (MainThread) [homeassistant.setup] Setup of domain duke_energy_gateway took 0.0 seconds
2022-09-07 11:08:26.671 INFO (MainThread) [custom_components.duke_energy_gateway]
2022-09-07 11:08:26.671 DEBUG (MainThread) [custom_components.duke_energy_gateway] Set up Duke Energy API clients
2022-09-07 11:08:28.878 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry brett@bowman-tech.com for duke_energy_gateway
File "/config/custom_components/duke_energy_gateway/__init__.py", line 54, in async_setup_entry
2022-09-07 11:08:56.530 DEBUG (MainThread) [custom_components.duke_energy_gateway] Set up Duke Energy API clients
2022-09-07 11:08:57.347 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry brett@bowman-tech.com for duke_energy_gateway
File "/config/custom_components/duke_energy_gateway/__init__.py", line 54, in async_setup_entry
2022-09-07 11:09:31.927 DEBUG (MainThread) [custom_components.duke_energy_gateway] Set up Duke Energy API clients
2022-09-07 11:09:32.487 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry brett@bowman-tech.com for duke_energy_gateway
File "/config/custom_components/duke_energy_gateway/__init__.py", line 54, in async_setup_entry
@mjmeli
Copy link
Owner

mjmeli commented Sep 7, 2022

Yeah I've been noticing this. Their API is getting increasingly flakey. I'll have to dig into this

@mjmeli
Copy link
Owner

mjmeli commented Sep 7, 2022

This is why, one of the API calls is failing

2022-09-07 14:08:35.626 DEBUG (MainThread) [pyduke_energy.client] Failed to find meter on account '': Request failed with unexpected error [https://cust-api.duke-energy.com/gep/v2/auth/account-details]: (ClientResponseError) 400, message='Bad Request', url=URL('https://cust-api.duke-energy.com/gep/v2/auth/account-details?email=&srcSysCd=ISU&srcAcctId=&bpNumber=')

@mjmeli
Copy link
Owner

mjmeli commented Sep 7, 2022

I think I was able to track the source of the 400 errors on that API call. In my testing, I did not hit the error. I'm pushing up a fix that can be updated to via HACS shortly.

@mjmeli
Copy link
Owner

mjmeli commented Sep 7, 2022

Please update to v0.1.2 of the integration and let me know if you are still seeing issues

@BrettEBowman
Copy link
Author

I updated to v0.1.2. So far so good--it's connected now and getting data. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants