Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duke Energy Unknown error occurred during setup. #128414

Closed
ghvader opened this issue Oct 15, 2024 · 4 comments
Closed

Duke Energy Unknown error occurred during setup. #128414

ghvader opened this issue Oct 15, 2024 · 4 comments

Comments

@ghvader
Copy link

ghvader commented Oct 15, 2024

The problem

When adding the duke energy integration It says "initializing" Then shows above the login "Unknown error occurred" and in the integrations window is says "Failed to setup"
If I try to hit submit again after this failure, the message says "invalid flow specified"
I am able to log into duke-energy.com with my credentials. and I do see energy data displayed for my account.
I do have an electric meter as required.

What version of Home Assistant Core has the issue?

core-2024.10.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

duke_energy

Link to integration documentation on our website

https://www.home-assistant.io/integrations/duke_energy/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

The only results from the log file that appear to be some what useful 
is the "ignore[union-attr] the rest are get this result=await whatever it was trying to get.

File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1022, in start
    message, payload = await protocol.read()  # type: ignore[union-attr]
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/streams.py", line 643, in read
    await self._waiter
asyncio.exceptions.CancelledError

Additional information

No response

@home-assistant
Copy link

Hey there @hunterjm, mind taking a look at this issue as it has been labeled with an integration (duke_energy) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of duke_energy can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign duke_energy Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


duke_energy documentation
duke_energy source
(message by IssueLinks)

@badnetmask
Copy link

badnetmask commented Oct 24, 2024

EDIT: after re-adding, took about 5-10 minutes but data eventually showed up in the energy dashboard, so my problem might not be related to the original ticket. Sorry about the noise.

This morning I noticed my energy dashboard had no data for Duke for the past 3 days, so I tried to refresh the integration and got the same "Unknown error occurred" (see log below). When it finished refreshing, the integration showed "no entities", so I removed and re-added. Adding worked without issues, but I continue without any entities.
I'm guessing Duke changed the API, or cut off the access.
Here's my log from a previously working integration that was unable to refresh:

2024-10-24 14:15:25.862 ERROR (MainThread) [homeassistant.components.duke_energy.coordinator] Unexpected error fetching Duke Energy data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 354, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/duke_energy/coordinator.py", line 122, in _async_update_data
    consumption_sum = cast(float, stats[consumption_statistic_id][0]["sum"])
                                  ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'duke_energy:electric_NNN_energy_consumption'

@kirklandm-notaprogrammer
Copy link

kirklandm-notaprogrammer commented Dec 19, 2024

I just tried setting up the integration on my Duke account and received the following initialization issues that resulted in a similar failure. It seems the integration isn't quite robust enough to handle the possible responses from the API.

Logger: homeassistant.components.duke_energy.coordinator
Source: helpers/update_coordinator.py:379
integration: Duke Energy (documentation, issues)
First occurred: 1:18:33 PM (14 occurrences)
Last logged: 1:24:34 PM

Unexpected error fetching Duke Energy data
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 379, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/duke_energy/coordinator.py", line 101, in _async_update_data
usage = await self._async_get_energy_usage(meter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/duke_energy/coordinator.py", line 202, in _async_get_energy_usage
results = await self.api.get_energy_usage(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
meter["serialNum"], "HOURLY", "DAY", start_step, end_step
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/local/lib/python3.13/site-packages/aiodukeenergy/dukeenergy.py", line 227, in get_energy_usage
if result["TickSeries"][n] != expected_series:
~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@issue-triage-workflows issue-triage-workflows bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants