ottopaulsen / MMM-Tibber

Show data from Tibber in MagicMirror
MIT License
33 stars 11 forks source link

Tibber WebSocket closed #48

Closed Empyreum closed 8 months ago

Empyreum commented 1 year ago

Updated to the new version and configured with my HomeId, it worked for a while and I got data from my pulse. All of a sudden I'm not getting any personal data anymore. There's nothing that I can see in the error log, only these LOG/INFO statements:

[2023-01-21 13:45:19.771] [LOG] Connecting socket for: MMM-Tibber [2023-01-21 13:45:19.773] [LOG] MMM-Tibber: Starting node helper [2023-01-21 13:45:19.776] [LOG] Sockets connected & modules started ... [2023-01-21 13:45:23.021] [LOG] MMM-Tibber: Configuring [2023-01-21 13:45:23.022] [LOG] MMM-Tibber: Tibber update interval: 5 minutes [2023-01-21 13:45:24.080] [INFO] Tibber API logged in with user [2023-01-21 13:45:24.103] [LOG] Starting Tibber subscription of live consumption [2023-01-21 13:45:26.683] [LOG] Found endpoint: wss://websocket-api.tibber.com/v1-beta/gql/subscriptions [2023-01-21 13:45:26.685] [LOG] User-Agent: MMM-Tibber/2.13.0 (linux; Node.js/v12.4.0) [2023-01-21 13:45:26.687] [LOG] Initializing WebSocket [2023-01-21 13:45:31.257] [LOG] Tibber WebSocket closed [2023-01-21 13:45:46.695] [LOG] Reconnecting in 54 seconds [2023-01-21 13:46:40.700] [LOG] Reconnecting (retry no 1) [2023-01-21 13:46:40.702] [LOG] Initializing WebSocket [2023-01-21 13:46:41.067] [LOG] Tibber WebSocket closed [2023-01-21 13:46:50.721] [LOG] Reconnecting in 36 seconds [2023-01-21 13:47:26.727] [LOG] Reconnecting (retry no 2) [2023-01-21 13:47:26.728] [LOG] Initializing WebSocket [2023-01-21 13:47:27.068] [LOG] Tibber WebSocket closed [2023-01-21 13:47:36.736] [LOG] Reconnecting in 59 seconds [2023-01-21 13:48:35.746] [LOG] Reconnecting (retry no 3) [2023-01-21 13:48:35.747] [LOG] Initializing WebSocket [2023-01-21 13:48:36.789] [LOG] Tibber WebSocket closed

Tried deleting and cloning the module again, but with the same result.

Timaor commented 1 year ago

This just happened to me as well. After a reboot it worked for a couple of hours before the screen turned black and now I cant get it to work.

ottopaulsen commented 1 year ago

You may try to upgrade your node to 14 or 16.

Timaor commented 1 year ago

0|MagicMirror | [19.02.2023 07:04.25.370] [LOG] User-Agent: MMM-Tibber/2.22.0 (linux; Node.js/v16.17.1) 0|MagicMirror | [19.02.2023 07:04.25.373] [LOG] Initializing WebSocket 0|MagicMirror | [19.02.2023 07:04.25.741] [LOG] Tibber WebSocket closed

Got it working and this happened again. Any clues @ottopaulsen ?

Timaor commented 1 year ago

@Empyreum This worked for me. Delete the Tibber token and create a new one. To many connections on the token was the problem for me. Now it works fine.

mrhawkin commented 1 year ago

Thanks @Timaor, the tip worked! Getting a new token made the real-time data work again.

Timaor commented 1 year ago

Thanks @Timaor, the tip worked! Getting a new token made the real-time data work again.

No problem :-) There might also be a problem with the update interval. Been talking to Tibber about it, I've set my update interval to 10 minutes, it used to be every 5 minutes. Tibber said its limited to 100 requests per 5 minutes, this might be a reason for the web socket closed.

mrhawkin commented 1 year ago

FYI; I changed it to 30 minutes before the v3.0 release. Not sure what that value controls, since I sometimes get "No data for 10 minutes. Restarting., Initializing WebSocket" even if its set to 30.

Timaor commented 1 year ago

I noticed when WebSocket closed and there is no real-time data if you go to Tibber developer page, API explorer and launch real time subscription I get "To many connections on server" error message. Can't figure out why that is since its only MagicMirror that uses the API.

mrhawkin commented 1 year ago

FYI: Running with "logging: true", I see the priceinfo and consumption per hour are requesting according to updateInterval, but in between the real-time data are recorded every other second (see below) that would be 60/2*5=150 requests per 5 minutes that would be above the limit of 100 request per 5 minutes, but unsure if the requests are are accounted like this.

"timestamp": "2023-02-27T10:10:14.000+01:00" "timestamp": "2023-02-27T10:10:16.000+01:00" "timestamp": "2023-02-27T10:10:18.000+01:00" "timestamp": "2023-02-27T10:10:20.000+01:00"

Timaor commented 1 year ago

Aha, that might be the issue.

Empyreum commented 1 year ago

@Empyreum This worked for me. Delete the Tibber token and create a new one. To many connections on the token was the problem for me. Now it works fine.

@Timaor Thanks, this seems to work for me too. Changed my updateInterval to 10 just to be sure as well 😄

ottopaulsen commented 1 year ago

Just so you know, in version 3.0.1 there is a fix that restarts the tibber connection if it has not received data for some time. I can see in my logs that it has been restarting 8 times since Feb 22.

DanielHabenicht commented 7 months ago

Should we update the default values and README to reflect these recommendations?