core: Tibber sensors do not update anymore

The problem

For the last 12h, Tibber Integration does not deliver certain sensor data through the API anymore. It is the most relevant and important data that is missing (e.g. current power, hour estimate, accumulated consumption) which makes it hard to use the data for load balancing or other automations. Some real-time data is available though (current L1, L3 for instance).

The API explorer on developer.tibber.com shows the data in real-time, so I assume the problem lies in the integration?

I have restarted the integration many times without any success (I usually do this when experiencing issues with inflowing data).

What version of Home Assistant Core has the issue?

core-2023.4.2

What was the last working version of Home Assistant Core?

core-2023.4.2

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

config_entry-tibber-3edf60663c5e9a37fec9b8ed52086a0a.json.txt

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: tibber
Source: helpers/aiohttp_client.py:67
First occurred: 10 April 2023 at 20:55:42 (52 occurrences)
Last logged: 11:06:38

Error connecting to Tibber: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain', url=URL('https://api.tibber.com/v1-beta/gql')
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/tibber/__init__.py", line 216, in _execute
    return await extract_response_data(resp)
  File "/usr/local/lib/python3.10/site-packages/tibber/tibber_response_handler.py", line 33, in extract_response_data
    result = await response.json()
  File "/usr/src/homeassistant/homeassistant/helpers/aiohttp_client.py", line 67, in json
    return await super().json(*args, loads=loads, **kwargs)
  File "/usr/local/lib/python3.10/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.10/site-packages/tibber/__init__.py", line 216, in _execute
    return await extract_response_data(resp)
  File "/usr/local/lib/python3.10/site-packages/tibber/tibber_response_handler.py", line 33, in extract_response_data
    result = await response.json()
  File "/usr/src/homeassistant/homeassistant/helpers/aiohttp_client.py", line 67, in json
    return await super().json(*args, loads=loads, **kwargs)
  File "/usr/local/lib/python3.10/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.10/site-packages/tibber/__init__.py", line 216, in _execute
    return await extract_response_data(resp)
  File "/usr/local/lib/python3.10/site-packages/tibber/tibber_response_handler.py", line 33, in extract_response_data
    result = await response.json()
  File "/usr/src/homeassistant/homeassistant/helpers/aiohttp_client.py", line 67, in json
    return await super().json(*args, loads=loads, **kwargs)
  File "/usr/local/lib/python3.10/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')

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 2
  • Comments: 21 (1 by maintainers)

Most upvoted comments

Mine is also stops workin then and now, the values freeze. After a reload the integration works fine again.

Same here. As soon as I restart the integration I get data again.

I also have this problem, and it has been there for weeks now. There must be a fix for this really soon or ppl will stop using the Tibber integration and go for other solutions.

Here is mine:

alias: Tibber Pulse Watcher
description: ""
trigger:
  - platform: time_pattern
    minutes: /5
condition:
  - condition: template
    value_template: >-
      {# Grid power has not changed in 5 minutes #}

      {{ as_timestamp(now()) -
      as_timestamp(states.sensor.power_XXXX.last_updated) > 60*5
      }}
action:
  - service: homeassistant.reload_config_entry
    data: {}
    target:
      device_id: 275f8d0e3ac354081f50c8a8516205a9
    enabled: true
mode: single

In the graphical interface, you just have to choose your Tibber device as the target of the “reload config entry” service.

This worked for me until recently, but now I have to restart HA every now and then to “unstick” the Tibber sensors. I have not made a automation for that yet, because that seems a bit dangerous to run unattended.

I have had this problem for a long while now. I made an automation that reloads the integration if the values do not get updated in a set amount of time. This made everything workwable so far.

But for the past 2 days this no longer helped and no sensor updated anymore. Restarting the integration no longer helped. Only after restarting Home Assistant did things start working again. So I think there must be something going very wrong in the Integration and/or HA in general.

Also experiencing this. Reloading the integration makes the sensors come alive again. Any status update?

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.

(message by CodeOwnersMention)


tibber documentation tibber source (message by IssueLinks)

Same here. I think it all started when updating to Core 2023.4.5. I get exactly the same error in logfile as @le-clu Tried to restore backup from yesterday with Core 2023.4.4, but the integration does not connect to Tibber with this version either.

I have the same issue that the integration suddenly stops, but a reload fixes it. I have this in my logs:

Logger: tibber
Source: /usr/local/lib/python3.10/site-packages/tibber/__init__.py:162 
First occurred: 14 april 2023 18:16:15 (3 occurrences) 
Last logged: 15 april 2023 12:36:24

Error in watchdog connect, will retry. Retry count: 17
Error in watchdog connect, will retry. Retry count: 55
Error in watchdog connect, will retry. Retry count: 57
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/tibber/__init__.py", line 160, in _rt_watchdog
    await self.rt_connect()
  File "/usr/local/lib/python3.10/site-packages/tibber/__init__.py", line 115, in rt_connect
    await self.sub_manager.connect_async()
  File "/usr/local/lib/python3.10/site-packages/gql/client.py", line 632, in connect_async
    await self.transport.connect()
  File "/usr/local/lib/python3.10/site-packages/gql/transport/websockets_base.py", line 490, in connect
    self.websocket = await asyncio.wait_for(
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 445, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 650, in _wrap_awaitable
    return (yield from awaitable.__await__())
  File "/usr/local/lib/python3.10/site-packages/websockets/legacy/client.py", line 655, in __await_impl_timeout__
    return await self.__await_impl__()
  File "/usr/local/lib/python3.10/site-packages/websockets/legacy/client.py", line 659, in __await_impl__
    _transport, _protocol = await self._create_connection()
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1036, in create_connection
    infos = await self._ensure_resolved(
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1418, in _ensure_resolved
    return await loop.getaddrinfo(host, port, family=family, type=type,
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 863, in getaddrinfo
    return await self.run_in_executor(
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.10/socket.py", line 955, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Try again

and

Logger: tibber
Source: /usr/local/lib/python3.10/site-packages/tibber/__init__.py:227 
First occurred: 15 april 2023 10:50:40 (3 occurrences) 
Last logged: 15 april 2023 13:26:00

Error connecting to Tibber: Cannot connect to host api.tibber.com:443 ssl:default [Try again]
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1152, in _create_direct_connection
    hosts = await asyncio.shield(host_resolved)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 874, in _resolve_host
    addrs = await self._resolver.resolve(host, port, family=self._family)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/resolver.py", line 33, in resolve
    infos = await self._loop.getaddrinfo(
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 863, in getaddrinfo
    return await self.run_in_executor(
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.10/socket.py", line 955, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Try again

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/tibber/__init__.py", line 214, in _execute
    resp = await self.websession.post(self.api_endpoint, **post_args)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 536, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 540, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 901, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1166, in _create_direct_connection
    raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.tibber.com:443 ssl:default [Try again]```