core icon indicating copy to clipboard operation
core copied to clipboard

tibber.get_prices results in "Unknown Error", reloading integration solves the issue

Open hzulla opened this issue 1 year ago • 10 comments

The problem

The Tibber integration on my system keeps failing for unknown reasons, I do not find a particular reproducible cause for this. I notice the problem when HA's energy tab stops reporting any power sent from my (small) PV to the grid.

The integrations' sensor data for my home's power consumption sensor.tibber_pulse_full_house_kumulierter_verbrauch and production sensor.tibber_pulse_full_house_kumulierte_produktion just stops updating. The solution is simple: Reloading the integration solves the issue. But the problem will reappear later and I repeat the cycle of reloading the Tibber integration.

My problem may be related to the one reported in this bug #125312 comment, although #125312 speaks about 2024.9 while I observed my problem with HA versions prior to that. I am unable to say at which version number I first noticed the issue, it has appeared ever since I'm using Tibber and that's only since a few months.

Today, I wanted to test writing my own automation to control my heat pump based on the hourly price data. Using the developer tools, calling tibber.get_prices resulted in Unknown Error.

After reloading the Tibber integration, the error message disappeared and tibber.get_prices worked as expected.

I am assuming that this Unknown Error is the error that is causing my failing sensor updates reported above.

The cause cannot be a blocked ip as in bug #97970 as the IP did not change when the integration reloaded.

What version of Home Assistant Core has the issue?

core-2024.9.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Tibber

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.websocket_api.http.connection
Quelle: components/tibber/services.py:60
Integration: Home Assistant WebSocket API (Dokumentation, Probleme)
Erstmals aufgetreten: 15:39:50 (2 Vorkommnisse)
Zuletzt protokolliert: 15:40:11

[140202521783040] Error handling message: Unknown error (unknown_error) XXX from 192.168.153.10 (Mozilla/5.0 (X11; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 28, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 816, in handle_execute_script
    script_result = await script_obj.async_run(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1795, in async_run
    return await asyncio.shield(create_eager_task(run.async_run()))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 463, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 527, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 557, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 525, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 763, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 726, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tibber/services.py", line 60, in __get_prices
    for price in price_info[key]
                 ~~~~~~~~~~^^^^^
KeyError: 'today'


Logger: homeassistant.helpers.script.websocket_api_script
Quelle: helpers/script.py:525
Erstmals aufgetreten: 15:39:50 (2 Vorkommnisse)
Zuletzt protokolliert: 15:40:11

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: 'today'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 525, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 763, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 726, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tibber/services.py", line 60, in __get_prices
    for price in price_info[key]
                 ~~~~~~~~~~^^^^^
KeyError: 'today'

Additional information

No response

hzulla avatar Sep 10 '24 14:09 hzulla

Here is an example of when the sensor data stopped updating shortly before 10:30.

The Tibber integration was reloaded manually at 12:32 in this screenshot and you can see how the value plops upwards to report the current value.

Bildschirmfoto vom 2024-09-10 16-50-02

hzulla avatar Sep 10 '24 14:09 hzulla

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 Sep 10 '24 21:09 home-assistant[bot]

After updating to home assistant 2024.9, currently running 2024.9.2, it looks like most values in my Tibber integration becomes unavailable whenever my solar panels have excess producing and sending power into the grid. Whenever I use power from the grid, the integration starts working again.

espenkv avatar Sep 19 '24 11:09 espenkv

After updating to home assistant 2024.9, currently running 2024.9.2, it looks like most values in my Tibber integration becomes unavailable whenever my solar panels have excess producing and sending power into the grid. Whenever I use power from the grid, the integration starts working again.

I have same problem. Reload integration sometimes help, but only for less than a minute. If I reload too many times, this reload no longer work for some hours. In my HA dashboard the Tibber values show up as "Unavailable"

erikinoslo avatar Sep 19 '24 11:09 erikinoslo

it looks like most values in my Tibber integration becomes unavailable whenever my solar panels have excess producing and sending power into the grid. Whenever I use power from the grid, the integration starts working again.

I cannot confirm this observation. I have long periods of normal behaviour where my PV sends excess power to the grid. And then the integration sensors stop sending data for no apparent reason and reloading the integration fixes it.

hzulla avatar Sep 19 '24 19:09 hzulla

I have a similar problem. Since 3 weeks my integration does not work at night. Reloading doesn't solved the Problem. Sometimes the Integration does not send Data at the daytime. But then only for 10 minutes or so.

Here are the logs


Logger: tibber.home
Quelle: /usr/local/lib/python3.12/site-packages/tibber/home.py:474
Erstmals aufgetreten: 19. September 2024 um 22:37:55 (782 Vorkommnisse)
Zuletzt protokolliert: 21:10:21

Error in rt_subscribe
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/tibber/home.py", line 460, in _start
    data = _add_extra_data(data)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tibber/home.py", line 421, in _add_extra_data
    if live_data.get("powerProduction", 0) > 0 and live_data.get("power") is None:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '>' not supported between instances of 'NoneType' and 'int'


Logger: tibber.realtime
Quelle: runner.py:189
Erstmals aufgetreten: 19. September 2024 um 22:38:56 (817 Vorkommnisse)
Zuletzt protokolliert: 21:14:40

Watchdog: Connection is down, 2024-09-20 19:10:28.200685+00:00
Watchdog: Connection is down, 2024-09-20 19:11:33.768737+00:00
Watchdog: Connection is down, 2024-09-20 19:12:39.372660+00:00
Watchdog: Connection is down, 2024-09-20 19:13:44.862814+00:00
Watchdog: Connection is down, 2024-09-20 19:14:50.566071+00:00

Here you can see that the integration does not send data at night:

image

Version: Core 2024.9.2

Kuhnok avatar Sep 20 '24 19:09 Kuhnok

Home Assistant Core Update to 2024.9.3 is out - do someone know if this update contains a fix described in this ticket?

erikinoslo avatar Sep 24 '24 14:09 erikinoslo

Home Assistant Core Update to 2024.9.3 is out - do someone know if this update contains a fix described in this ticket?

Just updated and looks like it works for me now.

espenkv avatar Sep 27 '24 11:09 espenkv

Updated to Core 2024.9.3, and it is working.

However, I’ve had a connection problem for the past two years.


Logger: tibber.realtime
Quelle: runner.py:189
Erstmals aufgetreten: 10:25:02 (1 Vorkommnisse)
Zuletzt protokolliert: 10:25:02

Watchdog: Connection is down, 2024-09-29 08:25:12.683938+00:00

Most of the time reloading solves the Problem.

Kuhnok avatar Sep 29 '24 08:09 Kuhnok

hey there, i get also the same initial error and have investigated to find the error. the problem is the service call does not refresh the data and if the last refresh had not get info + price data, then there is no data for this service call. my solution was really simple, get fresh data at each service call. if you can edit a file in the homeassistant container, then edit /usr/src/homeassistant/homeassistant/components/tibber/services.py and insert these line at line number 49 with the correct indention: await tibber_home.update_info_and_price_info()

i will try to make a pull request for this, but i first need to upgrade to 2024.10 and check if it works there too.

timtasse avatar Oct 06 '24 12:10 timtasse

Some logs Hope helps.

Logger: tibber.home
Quelle: /usr/local/lib/python3.12/site-packages/tibber/home.py:475
Erstmals aufgetreten: 20. Oktober 2024 um 23:24:19 (7 Vorkommnisse)
Zuletzt protokolliert: 17:34:10

Error in rt_subscribe
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/tibber/home.py", line 456, in _start
    async for _data in self._tibber_control.realtime.sub_manager.session.subscribe(
  File "/usr/local/lib/python3.12/site-packages/gql/client.py", line 1475, in subscribe
    async for result in inner_generator:
  File "/usr/local/lib/python3.12/site-packages/gql/client.py", line 1372, in _subscribe
    async for result in inner_generator:
  File "/usr/local/lib/python3.12/site-packages/gql/transport/websockets_base.py", line 388, in subscribe
    answer_type, execution_result = await listener.get()
                                    ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/gql/transport/websockets_base.py", line 56, in get
    raise item
gql.transport.exceptions.TransportServerError: No pong received after 15.0 seconds
Logger: tibber
Quelle: runner.py:189
Erstmals aufgetreten: 23. Oktober 2024 um 12:17:49 (2 Vorkommnisse)
Zuletzt protokolliert: 23. Oktober 2024 um 23:05:17

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

Logger: tibber.home
Quelle: /usr/local/lib/python3.12/site-packages/tibber/home.py:475
Erstmals aufgetreten: 22. Oktober 2024 um 09:22:00 (1 Vorkommnisse)
Zuletzt protokolliert: 22. Oktober 2024 um 09:22:00

Error in rt_subscribe
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/tibber/home.py", line 456, in _start
    async for _data in self._tibber_control.realtime.sub_manager.session.subscribe(
  File "/usr/local/lib/python3.12/site-packages/gql/client.py", line 1478, in subscribe
    raise TransportQueryError(
gql.transport.exceptions.TransportQueryError: {'message': 'unable to start stream api:xxx for device xxx; userId xxx', 'locations': [{'line': 2, 'column': 3}], 'path': ['liveMeasurement']}

Frieker avatar Oct 24 '24 15:10 Frieker

Stopped again with debug Mode

Logger: tibber.home
Quelle: /usr/local/lib/python3.12/site-packages/tibber/home.py:475
Erstmals aufgetreten: 17:52:21 (3 Vorkommnisse)
Zuletzt protokolliert: 19:06:21

Error in rt_subscribe
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/websockets/legacy/protocol.py", line 1287, in close_connection
    await self.transfer_data_task
  File "/usr/local/lib/python3.12/site-packages/websockets/legacy/protocol.py", line 953, in transfer_data
    message = await self.read_message()
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/websockets/legacy/protocol.py", line 1023, in read_message
    frame = await self.read_data_frame(max_size=self.max_size)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/websockets/legacy/protocol.py", line 1098, in read_data_frame
    frame = await self.read_frame(max_size)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/websockets/legacy/protocol.py", line 1155, in read_frame
    frame = await Frame.read(
            ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/websockets/legacy/framing.py", line 70, in read
    data = await reader(2)
           ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/streams.py", line 752, in readexactly
    await self._wait_for_data('readexactly')
  File "/usr/local/lib/python3.12/asyncio/streams.py", line 545, in _wait_for_data
    await self._waiter
asyncio.exceptions.CancelledError

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/tibber/home.py", line 456, in _start
    async for _data in self._tibber_control.realtime.sub_manager.session.subscribe(
  File "/usr/local/lib/python3.12/site-packages/gql/client.py", line 1475, in subscribe
    async for result in inner_generator:
  File "/usr/local/lib/python3.12/site-packages/gql/client.py", line 1372, in _subscribe
    async for result in inner_generator:
  File "/usr/local/lib/python3.12/site-packages/gql/transport/websockets_base.py", line 388, in subscribe
    answer_type, execution_result = await listener.get()
                                    ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/gql/transport/websockets_base.py", line 56, in get
    raise item
  File "/usr/local/lib/python3.12/site-packages/gql/transport/websockets_base.py", line 301, in _receive_data_loop
    answer = await self._receive()
             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/tibber/websocket_transport.py", line 38, in _receive
    msg = await asyncio.wait_for(super()._receive(), timeout=self._timeout)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
    return await fut
           ^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/gql/transport/websockets_base.py", line 231, in _receive
    data: Data = await self.websocket.recv()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/websockets/legacy/protocol.py", line 562, in recv
    await self.ensure_open()
  File "/usr/local/lib/python3.12/site-packages/websockets/legacy/protocol.py", line 938, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedError: sent 1011 (internal error) keepalive ping timeout; no close frame received

Frieker avatar Oct 24 '24 20:10 Frieker

@Frieker Your issue is not the same as the issue here.

HTTP status: 429. Means that you are rate-limited.

Danielhiversen avatar Oct 25 '24 04:10 Danielhiversen

Could someone test if this solves your issue? https://github.com/home-assistant/core/compare/129014?expand=1

Danielhiversen avatar Oct 25 '24 04:10 Danielhiversen

Could someone test if this solves your issue? https://github.com/home-assistant/core/compare/129014?expand=1

I'd like to test. However, that link seems dead. Edit: Found it: https://github.com/home-assistant/core/pull/129276

functionpointer avatar Nov 03 '24 22:11 functionpointer

It appears that https://github.com/home-assistant/core/pull/129276 does not fix this issue. I ran 696efe349e5ec8a4cd5ac3ba01daac2540d910ea which includes the PR for the last couple days. I got the KeyError after a while.

grafik The latest run was since 14:55. My template sensor updates every 30mins and on 21:00 the first KeyError appeared.

Nov 03 20:59:57 netberry hass[747814]: 2024-11-03 20:59:57.837 DEBUG (MainThread) [tibber.realtime] Watchdog: Checking if home redacted_home_id is alive, True, True
Nov 03 20:59:57 netberry hass[747814]: 2024-11-03 20:59:57.837 DEBUG (MainThread) [tibber.realtime] Watchdog: Home redacted_home_id is alive
Nov 03 20:59:57 netberry hass[747814]: 2024-11-03 20:59:57.837 DEBUG (MainThread) [tibber.realtime] Watchdog: Connection is alive
Nov 03 21:00:00 netberry hass[747814]: 2024-11-03 21:00:00.070 INFO (MainThread) [homeassistant.helpers.script.trigger_update_coordinator] Trigger Update Coordinator: Running template script
Nov 03 21:00:00 netberry hass[747814]: 2024-11-03 21:00:00.071 INFO (MainThread) [homeassistant.helpers.script.trigger_update_coordinator] Trigger Update Coordinator: Executing step call service
Nov 03 21:00:00 netberry hass[747814]: 2024-11-03 21:00:00.071 ERROR (MainThread) [homeassistant.helpers.script.trigger_update_coordinator] Trigger Update Coordinator: Error executing script. Unexpected error for call_service at pos 1: 'today'
Nov 03 21:00:00 netberry hass[747814]: Traceback (most recent call last):
Nov 03 21:00:00 netberry hass[747814]:   File "/opt/myhass-home/my-hass/homeassistant/helpers/script.py", line 526, in _async_step
Nov 03 21:00:00 netberry hass[747814]:     await getattr(self, handler)()
Nov 03 21:00:00 netberry hass[747814]:   File "/opt/myhass-home/my-hass/homeassistant/helpers/script.py", line 764, in _async_call_service_step
Nov 03 21:00:00 netberry hass[747814]:     response_data = await self._async_run_long_action(
Nov 03 21:00:00 netberry hass[747814]:                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 03 21:00:00 netberry hass[747814]:   File "/opt/myhass-home/my-hass/homeassistant/helpers/script.py", line 727, in _async_run_long_action
Nov 03 21:00:00 netberry hass[747814]:     return await long_task
Nov 03 21:00:00 netberry hass[747814]:            ^^^^^^^^^^^^^^^
Nov 03 21:00:00 netberry hass[747814]:   File "/opt/myhass-home/my-hass/homeassistant/core.py", line 2802, in async_call
Nov 03 21:00:00 netberry hass[747814]:     response_data = await coro
Nov 03 21:00:00 netberry hass[747814]:                     ^^^^^^^^^^
Nov 03 21:00:00 netberry hass[747814]:   File "/opt/myhass-home/my-hass/homeassistant/core.py", line 2845, in _execute_service
Nov 03 21:00:00 netberry hass[747814]:     return await target(service_call)
Nov 03 21:00:00 netberry hass[747814]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 03 21:00:00 netberry hass[747814]:   File "/opt/myhass-home/my-hass/homeassistant/components/tibber/services.py", line 60, in __get_prices
Nov 03 21:00:00 netberry hass[747814]:     for price in price_info[key]
Nov 03 21:00:00 netberry hass[747814]:                  ~~~~~~~~~~^^^^^
Nov 03 21:00:00 netberry hass[747814]: KeyError: 'today'
Nov 03 21:00:00 netberry hass[747814]: 2024-11-03 21:00:00.180 INFO (MainThread) [homeassistant.components.automation.trv_read_temp] TRV read temp: Running automation actions
Nov 03 21:00:00 netberry hass[747814]: 2024-11-03 21:00:00.180 INFO (MainThread) [homeassistant.components.automation.trv_read_temp] TRV read temp: Executing step device automation
Nov 03 21:00:00 netberry hass[747814]: 2024-11-03 21:00:00.448 INFO (MainThread) [homeassistant.helpers.script.trigger_update_coordinator] Trigger Update Coordinator: Running template script
Nov 03 21:00:00 netberry hass[747814]: 2024-11-03 21:00:00.448 INFO (MainThread) [homeassistant.helpers.script.trigger_update_coordinator] Trigger Update Coordinator: Executing step call service
Nov 03 21:00:00 netberry hass[747814]: 2024-11-03 21:00:00.476 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Nov 03 21:00:00 netberry hass[747814]: Traceback (most recent call last):
Nov 03 21:00:00 netberry hass[747814]:   File "/opt/myhass-home/my-hass/homeassistant/components/template/coordinator.py", line 115, in _handle_triggered_with_script
Nov 03 21:00:00 netberry hass[747814]:     if script_result := await self._script.async_run(run_variables, script_context):
Nov 03 21:00:00 netberry hass[747814]:                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 03 21:00:00 netberry hass[747814]:   File "/opt/myhass-home/my-hass/homeassistant/helpers/script.py", line 1801, in async_run
Nov 03 21:00:00 netberry hass[747814]:     return await asyncio.shield(create_eager_task(run.async_run()))
Nov 03 21:00:00 netberry hass[747814]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 03 21:00:00 netberry hass[747814]:   File "/opt/myhass-home/my-hass/homeassistant/helpers/script.py", line 464, in async_run
Nov 03 21:00:00 netberry hass[747814]:     await self._async_step(log_exceptions=False)
Nov 03 21:00:00 netberry hass[747814]:   File "/opt/myhass-home/my-hass/homeassistant/helpers/script.py", line 528, in _async_step
Nov 03 21:00:00 netberry hass[747814]:     self._handle_exception(
Nov 03 21:00:00 netberry hass[747814]:   File "/opt/myhass-home/my-hass/homeassistant/helpers/script.py", line 558, in _handle_exception
Nov 03 21:00:00 netberry hass[747814]:     raise exception
Nov 03 21:00:00 netberry hass[747814]:   File "/opt/myhass-home/my-hass/homeassistant/helpers/script.py", line 526, in _async_step
Nov 03 21:00:00 netberry hass[747814]:     await getattr(self, handler)()
Nov 03 21:00:00 netberry hass[747814]:   File "/opt/myhass-home/my-hass/homeassistant/helpers/script.py", line 764, in _async_call_service_step
Nov 03 21:00:00 netberry hass[747814]:     response_data = await self._async_run_long_action(
Nov 03 21:00:00 netberry hass[747814]:                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 03 21:00:00 netberry hass[747814]:   File "/opt/myhass-home/my-hass/homeassistant/helpers/script.py", line 727, in _async_run_long_action
Nov 03 21:00:00 netberry hass[747814]:     return await long_task
Nov 03 21:00:00 netberry hass[747814]:            ^^^^^^^^^^^^^^^
Nov 03 21:00:00 netberry hass[747814]:   File "/opt/myhass-home/my-hass/homeassistant/core.py", line 2802, in async_call
Nov 03 21:00:00 netberry hass[747814]:     response_data = await coro
Nov 03 21:00:00 netberry hass[747814]:                     ^^^^^^^^^^
Nov 03 21:00:00 netberry hass[747814]:   File "/opt/myhass-home/my-hass/homeassistant/core.py", line 2845, in _execute_service
Nov 03 21:00:00 netberry hass[747814]:     return await target(service_call)
Nov 03 21:00:00 netberry hass[747814]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 03 21:00:00 netberry hass[747814]:   File "/opt/myhass-home/my-hass/homeassistant/components/tibber/services.py", line 60, in __get_prices
Nov 03 21:00:00 netberry hass[747814]:     for price in price_info[key]
Nov 03 21:00:00 netberry hass[747814]:                  ~~~~~~~~~~^^^^^
Nov 03 21:00:00 netberry hass[747814]: KeyError: 'today'
Nov 03 21:00:00 netberry hass[747814]: 2024-11-03 21:00:00.500 WARNING (Recorder) [homeassistant.components.recorder.db_schema] State attributes for sensor.weather_forecast_hourly exceed maximum size of 16384 bytes. This can cause database performance issues; Attributes will not be stored
Nov 03 21:00:02 netberry hass[747814]: 2024-11-03 21:00:02.838 DEBUG (MainThread) [tibber.realtime] Watchdog: Checking if home redacted_home_id is alive, True, True
Nov 03 21:00:02 netberry hass[747814]: 2024-11-03 21:00:02.839 DEBUG (MainThread) [tibber.realtime] Watchdog: Home redacted_home_id is alive
Nov 03 21:00:02 netberry hass[747814]: 2024-11-03 21:00:02.839 DEBUG (MainThread) [tibber.realtime] Watchdog: Connection is alive

logs-tibber-keyerror.txt

functionpointer avatar Nov 03 '24 22:11 functionpointer

Could you share your template sensor?

Danielhiversen avatar Nov 04 '24 05:11 Danielhiversen

template:
  - trigger:
     - platform: time_pattern
       minutes: /30
    action:
      - service: tibber.get_prices
        data:
          start: "{{ today_at(0).replace(tzinfo=None) }}"
          end: "{{ (today_at('23:59:59')+timedelta(days=1)).replace(tzinfo=None) }>
        response_variable: my_spot_prices
    sensor:
      - name: Tibber Spot Prices
        unique_id: tibber_spot_prices
        state: "{{ now().isoformat() }}"
        attributes:
          price: "{{ my_spot_prices['prices']['redacted_home_address'] }}"

It relies on the new output format as string, which was recently merged

functionpointer avatar Nov 04 '24 08:11 functionpointer

Could you test this? https://github.com/home-assistant/core/pull/129844/files

Danielhiversen avatar Nov 04 '24 18:11 Danielhiversen

~~That doesn't include the string datatype, which breaks my template sensor. So i backported the change: f841e5593881f0d95974164ed1e198b77bd60bbc I am testing it now. So far it hasn't failed. Guess we will see in a few days.~~

Edit: Nevermind, i see you updated your pull request. I am now running 7b24c0728d372763b5dbadee068d61c8d1f4aaf3, so far it is working

functionpointer avatar Nov 04 '24 22:11 functionpointer