core: Tibber integration sensors "freeze"

The problem

During the latest 30 hours or so the Tibber integration sensors have “frozen” a couple of times. First: Yesterday afternoon. I discovered that this morning and restarted Home Assistant. Then: A few hours later. I discovered that a few minutes ago and reloaded the Tibber integration. Both HA restart and integration reload “unfreezes” the sensors.

image

It appears the the integration loses its connection with the API, but no error message is given in the HA logs. I have three Pulse devices on three different meters in two different locations (home and cabin) and the “freezing” happened at the same time both on my home HA instance and the cabin HA instance, so a network glitch seems to be an unlikely cause (it would have to be simultaneous network glitches in two different locations).

If network glitches are indeed the cause, it does not seem that the integration is able to restore the connection without reloading it (or restarting HA).

What version of Home Assistant Core has the issue?

2022.3.7

What was the last working version of Home Assistant Core?

2022.3.6

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

Tibber

Link to integration documentation on our website

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

Diagnostics information

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2022.3.7",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.9.9",
    "docker": true,
    "arch": "armv7l",
    "timezone": "Europe/Oslo",
    "os_name": "Linux",
    "os_version": "5.10.92-v7l",
    "supervisor": "2022.03.5",
    "host_os": "Home Assistant OS 7.5",
    "docker_version": "20.10.9",
    "chassis": "embedded",
    "run_as_root": true
  },
  "custom_components": {
    "nobo_hub": {
      "version": "1.1.3",
      "requirements": [
        "pynobo==1.1.2"
      ]
    },
    "remote_homeassistant": {
      "version": "3.6",
      "requirements": []
    },
    "hacs": {
      "version": "1.23.0",
      "requirements": [
        "aiogithubapi>=21.11.0"
      ]
    }
  },
  "integration_manifest": {
    "dependencies": [
      "recorder"
    ],
    "domain": "tibber",
    "name": "Tibber",
    "documentation": "https://www.home-assistant.io/integrations/tibber",
    "requirements": [
      "pyTibber==0.22.1"
    ],
    "codeowners": [
      "@danielhiversen"
    ],
    "quality_scale": "silver",
    "config_flow": true,
    "iot_class": "cloud_polling",
    "loggers": [
      "tibber"
    ],
    "is_built_in": true
  },
  "data": {
    "homes": {
      "9ea852ff-3462-4509-b31c-8cd31cc938d5": {
        "last_data_timestamp": "2022-03-25T23:00:00+01:00",
        "has_active_subscription": true,
        "has_real_time_consumption": true,
        "last_cons_data_timestamp": "2022-03-24T21:00:00+01:00",
        "country": "NO"
      },
      "779a80a7-7c74-4eb3-9cf1-742d6c28aa3a": {
        "last_data_timestamp": "2022-03-25T23:00:00+01:00",
        "has_active_subscription": true,
        "has_real_time_consumption": true,
        "last_cons_data_timestamp": "2022-03-24T21:00:00+01:00",
        "country": "NO"
      },
      "e773ffbe-3c77-46bf-944f-6ac29ee341a9": {
        "last_data_timestamp": "2022-03-25T23:00:00+01:00",
        "has_active_subscription": true,
        "has_real_time_consumption": true,
        "last_cons_data_timestamp": "2022-03-24T21:00:00+01:00",
        "country": "NO"
      }
    }
  }
}

Example YAML snippet

Not applicable

Anything in the logs that might be useful for us?

No - nothing in the logs

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 16
  • Comments: 72 (5 by maintainers)

Most upvoted comments

@chrfo892 The issue that many of us have had is that the tibber websocket for subscriptions to live updates is closing and the connection is “silently” lost. Then the tibber integration in HA is not reconnected by itself. The manual restart or reload, or the automation’s that some have deployed, resolves this by resubscribing. It doesn’t have anything to do with the throttle limit on the web service by the way.

The bug fix that has been implemented by the author is in the GraphQL library used by pytibber (and hence the tibber integration) and resolves this by reconnecting as soon as the dropped websocket is detected. This fix is in the works is for the next release 2022.4 (coming out today I think).

So I’m crossing my fingers that all will be resolved today if the next release of HA is available.

To solve this problem, I have temporary created a automation thats reload the integration. Sure its not the best solutions, but it will do the trick for now.

Automation:


- id: "010420222307"
  alias: "Tibber. Reload integration"
  trigger: 
    - platform: state
      entity_id: sensor.accumulated_consumption_XXXXXXXX
      for: 
        minutes: 25
  action: 
    - service: homeassistant.reload_config_entry
      data:
        entry_id: bcb725d07917eb70a94cbf212b69ced3    
    - service: persistent_notification.create
      data:
        title: Tibber integration frozen
        data: Integration reloaded

Feels like it is happening a lot more to me thatn others. yesterday I had to reload or restart 5 times and unfortunately this morning, causing the energy statistics to be completely wrong since the it froze late last night and then reported the wrong values until I noticed it this morning. The feeling is that I get more and more issues, from the beginning (1-2 weeks ago) is was once a day or every second day and now the last days it’s happening several times per day.

Tibber does not even answer on support regarding this. Time to try something else. Weekendproject https://github.com/iotux/ElWiz or https://github.com/toreamun/amshan-homeassistant looks promising!

Makes the Tibber Pulse local only, probably the best for Tibber and me 🙄

I have created a Node RED flow that restarts the Tibber Integration if no status has been received for 2 minutes. https://pastebin.com/Z24VQG5L image

@SebSkarp To get the entry id from devtools. Do the following in Chrome: Navigate to the integrations page in you ha instance. Then press CTRL + SHIFT + i. Devtools should appear. Select the Networks tab. Now you can push the reload button on the tibber integration. In devtools you should now have an request named “reload” select it and under Headers copy the request URL.

The long lived token you get by clicking your username in HA and then create a long lived token.

I hacked up an automation that reloads tibber if needed:

alias: tibber reload
description: ''
trigger:
  - platform: time_pattern
    minutes: /10
condition:
  - condition: template
    value_template: >-
      {{(as_timestamp(now()) -
      as_timestamp(states.sensor.accumulated_consumption_XXXX.last_changed))
      > 100}}
action:
  - service: rest_command.reload_tibber
    data: {}
mode: single

and in configuration.yaml the rest command:

rest_command:
  reload_tibber:
    url: https://[my-ha-instance:port]/api/config/config_entries/entry/[entry id, capture with devtools in chrome when pushing reload button in UI]/reload
    method: POST
    headers:
      Authorization: "Bearer [your very long bearer long lived token generated under your profile in HA UI]"
      content-type: "application/json"

@hnrkp Henrik would you mind to elaborate a bit about what you mean by capturing the entry id using devtools in chrome? 😃 Im still somewhat of a rookie here hehe. Also perhaps the long lived token part. Your automation sounds like something that could be used as a temporary fix until whatever is causing this is fixed for real.

But in the picture you posted there is the tibber integration, how did you get it there because I can’t add it… image

image image

This is an open-source project, so anyone can look into it. It only requires that someone has time they want to spend on it.

@JDolven Ah cool. Thanks. Will give it a try later today, since the integration now seems to be freezing multiple times every day 😕