core icon indicating copy to clipboard operation
core copied to clipboard

Tibber integration can't handle HTTP status: 500. API error on startup

Open rrooggiieerr opened this issue 1 year ago • 9 comments

The problem

The Tiber integration seems to be unable to handle HTTP status: 500. API errors on startup. The integration loads, but with all sensors being unknown.

2024-06-18 00:44:27.692 ERROR (MainThread) [tibber] Fatal error interacting with Tibber API, HTTP status: 500. API error: INTERNAL_SERVER_ERROR / Unhandled error: Context creation failed: undefined/https://thewall.tibber.com/connect/introspect Response code 502 (Bad Gateway)
2024-06-18 00:44:27.730 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up tibber platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 366, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/usr/src/homeassistant/homeassistant/components/tibber/sensor.py", line 276, in async_setup_entry
    await home.update_info()
  File "/usr/local/lib/python3.12/site-packages/tibber/home.py", line 202, in update_info
    if data := await self._tibber_control.execute(UPDATE_INFO % self._home_id):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tibber/__init__.py", line 105, in execute
    return (await extract_response_data(resp)).get("data")
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tibber/response_handler.py", line 62, in extract_response_data
    raise FatalHttpException(
tibber.exceptions.FatalHttpException: Unhandled error: Context creation failed: undefined/https://thewall.tibber.com/connect/introspect Response code 502 (Bad Gateway)

A reload of the integration solves this, however there is currently no consumption data.

2024-06-18 03:03:56.175 ERROR (MainThread) [tibber.home] Could not find consumption data.

https://thewall.tibber.com/ currently gives an error

What version of Home Assistant Core has the issue?

core-2024.6.3

What was the last working version of Home Assistant Core?

core-2024.6.3

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Tibber

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

rrooggiieerr avatar Jun 18 '24 01:06 rrooggiieerr

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

Code owner commands

Code owners of tibber 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 tibber 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)


tibber documentation tibber source (message by IssueLinks)

home-assistant[bot] avatar Jun 18 '24 01:06 home-assistant[bot]

I have to say, my Tibber app is also not working at the moment.

rrooggiieerr avatar Jun 18 '24 01:06 rrooggiieerr

This was during a maintenance window. Does it work now?

Danielhiversen avatar Jun 18 '24 05:06 Danielhiversen

I think the maintenance broke it. image

Loft23 avatar Jun 18 '24 08:06 Loft23

image

Loft23 avatar Jun 18 '24 08:06 Loft23

image

It seems a manual reload has fixed it.

Loft23 avatar Jun 18 '24 08:06 Loft23

@Danielhiversen Yes it works now, but I think the integration should be beter in handling server errors and do the reloading by itself instead of user action to do so

rrooggiieerr avatar Jun 18 '24 08:06 rrooggiieerr

Same issue with HTTP Status 429. Restart and reload didn't help.

Logger: tibber
Quelle: components/tibber/__init__.py:55
Erstmals aufgetreten: 16:05:34 (6 Vorkommnisse)
Zuletzt protokolliert: 22:44:37

Fatal error interacting with Tibber API, HTTP status: 429. API error: UNKNOWN / Unexpected content type: text/plain

fridgee1 avatar Jun 18 '24 20:06 fridgee1

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.

Just encountered the same issue, the Tibber API returned a 504 twice in the logs and since the integration would simply stop working. A manual reload fixes the issue, but my energy consumption data is all wrong for the time it was down.

It seems to me that the integration is missing some retry logic? Especially for a 504, this can just occasionally happen on external cloud infrastructure and often is just a temporary issue.

maruno avatar Sep 27 '24 21:09 maruno