core: Tibber integration fails

The problem

Tibber integration has failed since yesterday. And when I delete the integration, and try to set it up again I get: Unknown Error

What version of Home Assistant Core has the issue?

core-2023.8.1

What was the last working version of Home Assistant Core?

core-2023.8.0

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

I cannot provide a deug-logfile, since I cannot get the integration up and running again, so I have to copy-paste the log.

Example YAML snippet

No response

Anything in the logs that might be useful for us?

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/tibber/__init__.py", line 105, in execute
    return (await extract_response_data(resp)).get("data")
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/tibber/response_handler.py", line 26, in extract_response_data
    result = await response.json()
             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/aiohttp_client.py", line 73, in json
    return await super().json(*args, loads=loads, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1104, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain', url=URL('https://api.tibber.com/v1-beta/gql')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 508, in update_body_from_data
    body = payload.PAYLOAD_REGISTRY.get(body, disposition=None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/payload.py", line 118, in get
    raise LookupError()
aiohttp.payload.LookupError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 181, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 296, in async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 392, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tibber/config_flow.py", line 47, in async_step_user
    await tibber_connection.update_info()
  File "/usr/local/lib/python3.11/site-packages/tibber/__init__.py", line 138, in update_info
    if (data := await self.execute(INFO)) is None:
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/tibber/__init__.py", line 108, in execute
    return await self.execute(
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/tibber/__init__.py", line 108, in execute
    return await self.execute(
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/tibber/__init__.py", line 108, in execute
    return await self.execute(
           ^^^^^^^^^^^^^^^^^^^
  [Previous line repeated 956 more times]
  File "/usr/local/lib/python3.11/site-packages/tibber/__init__.py", line 104, in execute
    resp = await self.websession.post(API_ENDPOINT, **post_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 508, in _request
    req = self._request_class(
          ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 313, in __init__
    self.update_body_from_data(data)
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 510, in update_body_from_data
    body = FormData(body)()
           ^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/formdata.py", line 26, in __init__
    self._writer = multipart.MultipartWriter("form-data")
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/multipart.py", line 714, in __init__
    boundary = boundary if boundary is not None else uuid.uuid4().hex
                                                     ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/uuid.py", line 723, in uuid4
    return UUID(bytes=os.urandom(16), version=4)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/uuid.py", line 171, in __init__
    if [hex, bytes, bytes_le, fields, int].count(None) != 4:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RecursionError: maximum recursion depth exceeded in comparison
2023-08-07 16:22:04.578 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140497827613888] 
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 226, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1974, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2011, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 980, in admin_handler
    await result
  File "/usr/src/homeassistant/homeassistant/components/homeassistant/__init__.py", line 281, in async_handle_reload_config_entry
    await asyncio.gather(
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1242, in async_reload
    raise UnknownEntry
homeassistant.config_entries.UnknownEntry
2023-08-07 16:22:31.290 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140497827613888] 
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 226, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1974, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2011, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 980, in admin_handler
    await result
  File "/usr/src/homeassistant/homeassistant/components/homeassistant/__init__.py", line 281, in async_handle_reload_config_entry
    await asyncio.gather(
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1242, in async_reload
    raise UnknownEntry
homeassistant.config_entries.UnknownEntry
2023-08-07 16:22:31.291 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140497827613888] 
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 226, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1974, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2011, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 980, in admin_handler
    await result
  File "/usr/src/homeassistant/homeassistant/components/homeassistant/__init__.py", line 281, in async_handle_reload_config_entry
    await asyncio.gather(
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1242, in async_reload
    raise UnknownEntry
homeassistant.config_entries.UnknownEntry

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 92 (11 by maintainers)

Most upvoted comments

It should not be related to the Tibber custom integration. I think I have solved this, and will try to push a fix this weekend.

It is open source, so nothing is stopping you to solve it yourself 😃 Yes, lack of knowledge is stopping me. I’m a dentist, not a programmer.

@Danielhiversen please help me by explaining the installation procedure.

Thanks, Rien

Noob question…how did you Update pyTibber? Did you download the integration and put it in the Custom Integration folder or what?

I have had trouble for several hours now. Impossible to reload the integration, even it I waited for two hours. I have now tried to disable tibber custom, as it started after Tibber Custom was installed. I then waited for ten minutes, and the integration reloaded with eease. Not sure if it was the Tibber custom, but going to leave it out for some days to see if it resolves the problem.

Seems to solve the problem also for me!

I have had trouble for several hours now. Impossible to reload the integration, even it I waited for two hours. I have now tried to disable tibber custom, as it started after Tibber Custom was installed. I then waited for ten minutes, and the integration reloaded with eease. Not sure if it was the Tibber custom, but going to leave it out for some days to see if it resolves the problem.

I do also have this problem. Only way I has been able to solve it is to install a backup, then it works for a day or two. A lot of my automations is depending on Tibber so this is a huge deal.

I’ve had the exact same repl from Tibber myself. Today I got two error messages in my log related to Tibber. These log entries are huge!! Several hundred lines long, appearing several hundred times. I cannot attach them here, but if any useful information can be found in these logs, they are both available on my OneDrive: https://1drv.ms/u/s!Aubs2beaxXQegaQnkhCWmfnQY3P7YQ?e=84USKT https://1drv.ms/u/s!Aubs2beaxXQegaQvWr5apaUllVBzTQ?e=cLGurT

I’m not surprised at all that such massive amount of errors do result in a ban!

I had contact with Tibber about this issue.

They told me this

'We will do an auto-release 10 minutes after the ban, if there are still a lot of requests, the IP will be banned for another 10 minutes.The IP will be blocked if you go over the rate limit of 100 requests per 5 minutes. If the API explorer is working on another IP or network, please try this: Disconnect your network for 30 minutes (The IP should then be released) Connect your network, but don’t run the script or plugin Check if you get a response on one of the examples quarries in API explorer If this doesn’t work -> Write down the time you tried this, we can then check our logs for your IP. If you don’t change your script and go over the rate limit again, you will be blocked once more. ’

After the 30 minute action, it worked again (API explorer and also the Tibber plugin) but this was only for a couple of minutes and the issue was back again.

I reported this to back to Tibber, let’s see what the tell me.

So it looks like the Tibber integration do a lot of API requests which will result in an IP BAN

Only @Danielhiversen can find that out.

It is open source, so nothing is stopping you to solve it yourself 😃

Problem solved itself. I had to delete the API-token and create a new one, delete the integration and restart HA. Then I could add the integration again. So something isn’t quite right here, and should be examined further.