core
core copied to clipboard
Tibber integration not working; server rejected WebSocket connection
The problem
After updating to the newest beta, the integration stopped working.
What version of Home Assistant Core has the issue?
2023.3.0b0
What was the last working version of Home Assistant Core?
2023.2.5
What type of installation are you running?
Home Assistant OS
Integration causing the issue
tibber
Link to integration documentation on our website
https://rc.home-assistant.io/integrations/tibber
Diagnostics information
Logger: tibber
Source: /usr/local/lib/python3.10/site-packages/tibber/__init__.py:181
First occurred: 9:06:34 AM (16 occurrences)
Last logged: 9:27:58 AM
Error in watchdog connect, retrying in 69 seconds, 9
Error in watchdog connect, retrying in 84 seconds, 10
Error in watchdog connect, retrying in 139 seconds, 11
Error in watchdog connect, retrying in 172 seconds, 12
Error in watchdog connect, retrying in 169 seconds, 13
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/tibber/__init__.py", line 173, in _rt_watchdog
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 659, in __await_impl_timeout__
return await asyncio.wait_for(self.__await_impl__(), self.open_timeout)
File "/usr/local/lib/python3.10/asyncio/tasks.py", line 445, in wait_for
return fut.result()
File "/usr/local/lib/python3.10/site-packages/websockets/legacy/client.py", line 666, in __await_impl__
await protocol.handshake(
File "/usr/local/lib/python3.10/site-packages/websockets/legacy/client.py", line 332, in handshake
raise InvalidStatusCode(status_code, response_headers)
websockets.exceptions.InvalidStatusCode: server rejected WebSocket connection: HTTP 404
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response
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. Troubleshooting I've tried so far:
- I've removed the Tibber integration
- created a new API key with Tibber.
- Recreated the Tibber integration with new API key: no sensor are showing up.
error log is showing the following error: websockets.exceptions.InvalidStatusCode: server rejected WebSocket connection: HTTP 404 2023-02-23 11:19:15.528 DEBUG (MainThread) [tibber.tibber_home] Waiting for rt_connect
The Tibber status page says:
API/HA - Tibber API will not work with the latest HA update
Monitoring - Home assistant can currently connect to websockets only when they specify user agent HomeAssistant/2022.12, HomeAssistant/2023.1 or HomeAssistant/2023.2. HomeAssistant/2023.3 wont be able to connect unless it will start using the pyTibber version 0.27. (Currently it uses 0.26). Feb 14, 2023 - 08:20 CET
I just did some local testing and updating the manifest to pyTibber==0.27.1 is confirmed to be working again. Im not sure how to make a pull request as i havn`t before. I can give it a try tomorrow but if someone can do it faster feel free to do so.
Yes, newer versions of Home Assistant will not have real-time data before this is merged: https://github.com/home-assistant/core/pull/86940#issuecomment-1429235775
I hope someone can fix this quickly...I use Tibber and the Pulse in a few of my automations and they are now all dead in the water. If there is a workaround I can implement myself as a stopgap measure then I would love to hear about it...
I hope someone can fix this quickly...I use Tibber and the Pulse in a few of my automations and they are now all dead in the water. If there is a workaround I can implement myself as a stopgap measure then I would love to hear about it...
You can do the following to get the sensors working again (probably requires home assistant >=2023.3.0):
- Go to https://minhaskamal.github.io/DownGit/#/home
- Enter
https://github.com/home-assistant/core/tree/dev/homeassistant/components/tibber
as the URL - Press "Download"
- Create a new folder (if it doesn't already exist) in Home Assistants
config
folder calledcustom_components
- Create a new folder in
config/custom_components
calledtibber
- Paste the contents of the downloaded archive into the
tibber
folder - Open the unpacked manifest.json and change it to:
{
"domain": "tibber",
"name": "Tibber",
"codeowners": ["@danielhiversen"],
"config_flow": true,
"dependencies": ["recorder"],
"documentation": "https://www.home-assistant.io/integrations/tibber",
"iot_class": "cloud_polling",
"loggers": ["tibber"],
"quality_scale": "silver",
"requirements": ["pyTibber==0.27.1"],
"version": "1.0.0"
}
- Restart Home Assistant
This forces Home Assistant to use of the latest version of the pytibber library.
You can also create sensors to fetch information manually.
Sadly the consumption data requires a websocket subscription, so you're limited to price information.
This sensor will fetch an array of todays and tomorrows prices:
# in configuration.yaml
rest:
- resource: https://api.tibber.com/v1-beta/gql
method: POST
scan_interval: 2400
timeout: 60
payload: '{ "query": "{ viewer { homes { currentSubscription { priceInfo { current{total} today { total startsAt } tomorrow { total startsAt }}}}}}" }'
headers:
Authorization: !secret Tibber_API
Content-Type: application/json
User-Agent: REST
sensor:
- name: Tibber prices
json_attributes_path: "$.data.viewer.homes[0].currentSubscription.priceInfo"
json_attributes:
- today
- tomorrow
value_template: Ok
Make sure to replace !secret Tibber_API
with your API key (starts with Bearer...)
Thanks! I followed your instructions and Tibber is working again!
Just one question though...do I have to remove the custom component when an official fix has been merged?
Yes, newer versions of Home Assistant will not have real-time data before this is merged: #86940 (comment)
@Danielhiversen do we need to make the workaround posted by @xorbital or we wait for the fix ASAP?
All sensors stop working :S we need a fix ASAP!
All sensors stop working :S we need a fix ASAP!
Workaround fixes it... waiting for the fix in the core.
https://github.com/home-assistant/core/issues/88656#issuecomment-1451245229
Made a Rollback to 2.5 and waiting for working update π
Made a Rollback to 2.5 and waiting for working update π
Do you have an easy "how-to", for doing such rollback?
Thanks! I followed your instructions and Tibber is working again!
Just one question though...do I have to remove the custom component when an official fix has been merged?
Yes, the custom component overrides home assistants built-in integration, so if you donβt remove it you wonβt receive any updates for tibber in the future. If 2023.3.1 came out with a fix just remove the folder and update.
I hope someone can fix this quickly...I use Tibber and the Pulse in a few of my automations and they are now all dead in the water. If there is a workaround I can implement myself as a stopgap measure then I would love to hear about it...
You can do the following to get the sensors working again (probably requires home assistant >=2023.3.0):
- Go to https://minhaskamal.github.io/DownGit/#/home
- Enter
https://github.com/home-assistant/core/tree/dev/homeassistant/components/tibber
as the URL- Press "Download"
- Create a new folder (if it doesn't already exist) in Home Assistants
config
folder calledcustom_components
- Create a new folder in
config/custom_components
calledtibber
- Paste the contents of the downloaded archive into the
tibber
folder- Open the unpacked manifest.json and change it to:
{ "domain": "tibber", "name": "Tibber", "codeowners": ["@danielhiversen"], "config_flow": true, "dependencies": ["recorder"], "documentation": "https://www.home-assistant.io/integrations/tibber", "iot_class": "cloud_polling", "loggers": ["tibber"], "quality_scale": "silver", "requirements": ["pyTibber==0.27.1"], "version": "1.0.0" }
- Restart Home Assistant
This forces Home Assistant to use of the latest version of the pytibber library. You can also create sensors to fetch information manually. Sadly the consumption data requires a websocket subscription, so you're limited to price information. This sensor will fetch an array of todays and tomorrows prices:
# in configuration.yaml rest: - resource: https://api.tibber.com/v1-beta/gql method: POST scan_interval: 2400 timeout: 60 payload: '{ "query": "{ viewer { homes { currentSubscription { priceInfo { current{total} today { total startsAt } tomorrow { total startsAt }}}}}}" }' headers: Authorization: !secret Tibber_API Content-Type: application/json User-Agent: REST sensor: - name: Tibber prices json_attributes_path: "$.data.viewer.homes[0].currentSubscription.priceInfo" json_attributes: - today - tomorrow value_template: Ok
Make sure to replace
!secret Tibber_API
with your API key (starts with Bearer...)
Works (Y) Should this folder be removed after update?
Made a Rollback to 2.5 and waiting for working update π
Do you have an easy "how-to", for doing such rollback?
You should always (imo) make a fresh backup before upgrading to any HA release, especially the .0 releases. Rollback means just restoring to that backup (that's what I did and it fixed the integration)
Do you have an easy "how-to", for doing such rollback?
Depends on your skill level as well as what version of HA you are running but I did this:
From SSH & Web Terminal Addon you can run the command:
ha core update --version 2023.2.5
Do you have an easy "how-to", for doing such rollback?
Depends on your skill level as well as what version of HA you are running but I did this:
From SSH & Web Terminal Addon you can run the command:
ha core update --version 2023.2.5
Do you know which version you ran before the downgrade? Home Assistant 2023.3.0? Worried about potential db upgrade/migrations that happened after 2023.2.5.
Do you have an easy "how-to", for doing such rollback?
Depends on your skill level as well as what version of HA you are running but I did this:
From SSH & Web Terminal Addon you can run the command:
ha core update --version 2023.2.5
Do you know which version you ran before the downgrade? Home Assistant 2023.3.0? Worried about potential db upgrade/migrations that happened after 2023.2.5.
Made a Rollback to 2.5 and waiting for working update π
Do you have an easy "how-to", for doing such rollback?
You should always (imo) make a fresh backup before upgrading to any HA release, especially the .0 releases. Rollback means just restoring to that backup (that's what I did and it fixed the integration)
Hi. Yes I always do backup after every change I do to system. So latest backup was 1 day old. Now that backup is restored, and we are all a happy smiling family here at home. For info: restore took approx. 1 h, before it was fully back. Thanks for info and help!
Works with 2023.3.1
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.