hombach / ioBroker.tibberlink

links tibber API data to be used in ioBroker
https://github.com/hombach/ioBroker.tibberlink
GNU General Public License v3.0
25 stars 5 forks source link

Multiple homes and pulses: adapter not starting correctly when enabling Tibber Pulse #41

Closed mrkww closed 1 year ago

mrkww commented 1 year ago

BUG
When trying to start the adapter with Tibber Pulse enabled, it throws the errors below (ERROR on Tibber-Feed). This maybe happens because I am using multiple homes and multiple Pulses. Home 1 with Pulse, Home 2 with Pulse, Home 3 has no Pulse and is a cancelled Tibber contract which was never removed from my list of homes. I am trying to read the consumption from Home 2 only.

LOG
2023-08-14 07:55:58.443 - info: host.raspberrypi instance system.adapter.tibberlink.0 started with pid 12710 2023-08-14 07:56:00.513 - info: tibberlink.0 (12710) starting. Version 0.1.7 (non-npm: hombach/ioBroker.tibberlink#d2fe83886bbdd6f530320eb0aa3ec97f113ff3ae) in /opt/iobroker/node_modules/iobroker.tibberlink, node: v18.17.1, js-controller: 4.0.24 2023-08-14 07:56:03.338 - error: tibberlink.0 (12710) ERROR on Tibber-Feed: [object Object] 2023-08-14 07:56:03.346 - warn: tibberlink.0 (12710) Feed was disconnected. I try to reconnect in 5s 2023-08-14 07:56:03.348 - error: tibberlink.0 (12710) ERROR on Tibber-Feed: [object Object] 2023-08-14 07:56:03.353 - warn: tibberlink.0 (12710) Feed was disconnected. I try to reconnect in 5s 2023-08-14 07:56:08.373 - error: tibberlink.0 (12710) ERROR on Tibber-Feed: [object Object] 2023-08-14 07:56:08.384 - warn: tibberlink.0 (12710) Feed was disconnected. I try to reconnect in 5s

Versions:

hombach commented 1 year ago

Are homes 1, 2 and 3 in this order called? So o you get data from 1and 2 and afterwards the errors from home 3? Would it be a problem if just home 3 isn't polled, but you can't choose only home 2?

mrkww commented 1 year ago

I don't see a connection or consumption data at all.

The error occurs when starting the adapter. Queries work fine and I see static data of homes as well as current pricing.

Is there any way to increase the log level?

hombach commented 1 year ago

Log level could be adjusted here: image

hombach commented 1 year ago

I asume you're getting a false at this point in your third home? image

mrkww commented 1 year ago

Log level could be adjusted here: image

Ok, this doesn't brought up to many new information:

2023-08-15 07:52:13.741 - error: tibberlink.0 (16181) ERROR on Tibber-Feed: [object Object]

2023-08-15 07:52:13.749 - debug: tibberlink.0 (16181) Tibber Feed: Disconnected from Tibber feed. 2023-08-15 07:52:13.750 - warn: tibberlink.0 (16181) Feed was disconnected. I try to reconnect in 5s 2023-08-15 07:52:13.751 - error: tibberlink.0 (16181) ERROR on Tibber-Feed: [object Object] 2023-08-15 07:52:13.756 - debug: tibberlink.0 (16181) Tibber Feed: Disconnected from Tibber feed. 2023-08-15 07:52:13.757 - warn: tibberlink.0 (16181) Feed was disconnected. I try to reconnect in 5s 2023-08-15 07:52:16.180 - debug: tibberlink.0 (16181) Tibber Feed: Connected to Tibber feed. 2023-08-15 07:52:16.207 - error: tibberlink.0 (16181) ERROR on Tibber-Feed: [object Object] 2023-08-15 07:52:16.211 - debug: tibberlink.0 (16181) Tibber Feed: Disconnected from Tibber feed. 2023-08-15 07:52:16.211 - warn: tibberlink.0 (16181) Feed was disconnected. I try to reconnect in 5s 2023-08-15 07:52:19.751 - debug: tibberlink.0 (16181) No TibberFeed connected try reconnecting now in 6sec interval! 2023-08-15 07:52:19.758 - debug: tibberlink.0 (16181) No TibberFeed connected try reconnecting now in 6sec interval! 2023-08-15 07:52:22.213 - debug: tibberlink.0 (16181) No TibberFeed connected try reconnecting now in 6sec interval! 2023-08-15 07:52:25.751 - debug: tibberlink.0 (16181) No TibberFeed connected try reconnecting now in 6sec interval!

mrkww commented 1 year ago

Here are my three homes - the first one listed here (without Pulse) has no folder "Features".

Bildschirmfoto 2023-08-15 um 08 00 01
hombach commented 1 year ago

Root cause of the problem is discovered - needs some bigger changes in source code. Please be patient, this needs some days.

hombach commented 1 year ago

I tried to mitigate the problem first... version 0.1.10 is verifying with Tibber Server if Pulse is available. So you should get less error messages. Unfortunately I don't have multiple homes in my account to validate this modification....

mrkww commented 1 year ago

I can confirm that 0.1.10 doesn't throw errors anymore... a warning shows up: scipping datafeed of live data - no Pulse configured according to Tibber server

It looks like it now skips even the existing datafeeds but I am sure this is what you mean with "bigger changes in source code" ;-)

The instance is turning "green".

Awesome work you are doing here. Thanks a lot so far!

hombach commented 1 year ago

But you get the message about skipping only once - correct?

mrkww commented 1 year ago

Correct.

hombach commented 1 year ago

in latest 0.1.10 in git you should get something like "try to establish feed of live data for home: 26b577...." in the debug log ..... once? or one for each home?

mrkww commented 1 year ago

I don't see this line or anything similar to this. Here are the last view lines after I restarted the instance...

2023-08-15 19:12:42.523 - debug: tibberlink.0 (18477) Got current price from tibber api: {} 2023-08-15 19:12:42.633 - debug: tibberlink.0 (18477) Got prices today from tibber api: [] 2023-08-15 19:12:42.736 - debug: tibberlink.0 (18477) Got prices tomorrow from tibber api: [] 2023-08-15 19:12:42.739 - warn: tibberlink.0 (18477) scipping datafeed of live data - no Pulse configured according to Tibber server 2023-08-15 19:12:43.160 - debug: tibberlink.0 (18477) Tibber Feed: Connected to Tibber feed. 2023-08-15 19:12:48.155 - debug: tibberlink.0 (18477) Tibber Feed: Connected to Tibber feed.

hombach commented 1 year ago

Please install again from Git, Version 0.1.10. Then you should see the mentioned lines. Also typo "scipping datafeed of live data" is corrected. Perhaps you also see more... ;) BTW: I assume you truncated "Got current price from tibber api: {}" ??? And in your log it's not empty? PLUS: I'm wondering that you only getting one "Got current price from tibber api:" .... should be one for each home

mrkww commented 1 year ago

I re-installed 0.1.10 from Git and now I finally see the lines you mentioned.

I also see a subfolder called "LiveMeasurement" but only in one of my home's folders beginning with fe7...

Again (truncated) the last lines after restart: 2023-08-15 20:40:33.663 - debug: tibberlink.0 (18671) Got current price from tibber api: {} 2023-08-15 20:40:33.762 - debug: tibberlink.0 (18671) Got prices today from tibber api: [] 2023-08-15 20:40:33.953 - debug: tibberlink.0 (18671) Got prices tomorrow from tibber api: [] 2023-08-15 20:40:33.955 - debug: tibberlink.0 (18671) try to establish feed of live data for home: d26... 2023-08-15 20:40:33.957 - debug: tibberlink.0 (18671) try to establish feed of live data for home: fe7... 2023-08-15 20:40:33.957 - debug: tibberlink.0 (18671) try to establish feed of live data for home: 3cc... 2023-08-15 20:40:33.958 - warn: tibberlink.0 (18671) skipping feed of live data - no Pulse configured for this home according to Tibber server 2023-08-15 20:40:34.394 - debug: tibberlink.0 (18671) Tibber Feed: Connected to Tibber feed. 2023-08-15 20:40:36.935 - debug: tibberlink.0 (18671) Tibber Feed: Connected to Tibber feed.

mrkww commented 1 year ago

Important add on: my Raspberry Pi now crashes after a couple of minutes and becomes unavailable. I have to hard reboot it. I will need to disable the adapter now :-(

hombach commented 1 year ago

That's not good... so no Pulse data for home d26.... ?? But you see live data in your Tibber smartphone app for this home?

mrkww commented 1 year ago

No subfolder LiveMeasurement (and therefore no data) for d26... (that's the home I'd like to measure with ioBroker). Live data is available in the Tibber App.

hombach commented 1 year ago

I think i corrected the error why you got only one feed - but I have currently no idea why your reaspi crashed, and if it's rooted by this error..... SO, if you want to have some more trouble, I would greatly appreciate that you retry... new edition of version 0.1.10 is installable from github. Another point: I don't see your crash in Sentry... Did you disable it in ioBroker?

mrkww commented 1 year ago

I don't want to ruin your evening... still no "LiveMeasurement" for d26...

Maybe it is prohibited to use the API key for two feeds at the same time?

Sentry is and was enabled on your adapter.

I am off now for the rest of the evening ;-) Thank you so far.

mrkww commented 1 year ago

Almost forgot: no crash this time ;-)

hombach commented 1 year ago

I'm only disappointed... ;) Thank you for testing!! No crash is also good news. :)

mrkww commented 1 year ago

From the Tibber API docs: "...Note that the maximum number of open websockets is limited to two...."

Maybe Tibber app uses a web socket that counts as well?

hombach commented 1 year ago

Deleting label "BUG" from the issue as no crashes or error messages anymore - now it's only a "enhancement" to get the values for multiple homes. -> If there is anybody out there with working Pulse Live-Data from 2 or more homes - please give me a note!

mrkww commented 1 year ago

I don't know the code in detail but maybe it makes more sense to let the user specify a HomeId as a parameter (next to the API key). This way you could avoid API/websocket traffic for homes not needed and it maybe is much easier to subscribe to a given HomeId. Users with more than one Pulse could create additional instances of the adapter with a different HomeId.

hombach commented 1 year ago

I also thought about this option.... I'll play around with getting the Home IDs into config screen

hombach commented 1 year ago

started with implementation - release 0.3.0 will have the option to get several homes seperately configured if Pulse data to be pulled or not.

hombach commented 1 year ago

Please give version 0.3.0 - available in latest repository - a try. There you could choose which homes to be used with Pulse

mrkww commented 1 year ago

I just installed 0.3.0 and it looks like it is working fine. Great work. I created a personal workaround a couple of weeks ago which injected the values via Simple API adapter. However, I prefer your solution to have all functionality in one adapter. Thank you so far.

hombach commented 1 year ago

Thanks for testing!