Python Plugin: Tibber [Unsupported]

Python and python framework

Moderator: leecollings

Post Reply
Flopp
Posts: 279
Joined: Sunday 03 January 2016 14:55
Target OS: -
Domoticz version:
Location: Sweden
Contact:

Python Plugin: Tibber [Unsupported]

Post by Flopp »

I wrote a plugin for Tibber

https://github.com/flopp999/Tibber-Domoticz

Please give me ideas how to make it better or with new features
Last edited by Flopp on Sunday 02 June 2024 10:32, edited 1 time in total.
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python Plugin: Tibber

Post by waltervl »

Thank you. Already a small topic here viewtopic.php?f=21&t=35721&p=270504
I will add it to the plugin list in the wiki.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Flopp
Posts: 279
Joined: Sunday 03 January 2016 14:55
Target OS: -
Domoticz version:
Location: Sweden
Contact:

Re: Python Plugin: Tibber

Post by Flopp »

Ah ok great
Jannebozz
Posts: 2
Joined: Monday 10 January 2022 14:53
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Tibber

Post by Jannebozz »

@flopp: Is this plugin suppose to work on a synology environment?
I´m having issue...

2022-01-10 15:01:39.648 Status: New sensors allowed for 5 minutes...
2022-01-10 15:01:40.199 (RFX) Temp + Humidity (Undervåning)
...
2022-01-10 15:02:19.743 Status: (Tibber) Started.
...
2022-01-10 15:03:33.031 Error: WebServer:8443 thread seems to have ended unexpectedly (last update 74.000000 seconds ago)
2022-01-10 15:03:33.031 Error: Tibber hardware (15) thread seems to have ended unexpectedly
2022-01-10 15:03:36.067 (RFX) Temp + Humidity (Ute)
2022-01-10 15:03:37.203 (RFX) Temp + Humidity (Undervåning)
2022-01-10 15:03:42.830 (RFX) Temp + Humidity (Förråd)
2022-01-10 15:03:47.141 Error: WebServer:8443 thread seems to have ended unexpectedly (last update 88.000000 seconds ago)
2022-01-10 15:03:47.142 Error: Tibber hardware (15) thread seems to have ended unexpectedly
2022-01-10 15:03:56.841 (Motherboard) General/Percentage (CPU_Usage)

After a few minutes the domoticz system hangs...

Version: 2020.2 (build 12731)
Build Hash: 7933f659d-modified
Compile Date: 2020-12-06 10:22:02
dzVents Version: 3.0.18
Python Version: 3.8.6 (default, Jan 4 2021, 16:09:30) [GCC 4.9.3 20150311 (prerelease)]

Any help would be appricated...
Flopp
Posts: 279
Joined: Sunday 03 January 2016 14:55
Target OS: -
Domoticz version:
Location: Sweden
Contact:

Re: Python Plugin: Tibber

Post by Flopp »

Hi

It is not anything that I have tested.

From what the log says it seems not to work.

Maybe a python package is missing?
Jannebozz
Posts: 2
Joined: Monday 10 January 2022 14:53
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Python Plugin: Tibber

Post by Jannebozz »

Thanks for the reply.
Not sure about missing package, everything seems to install fine but the something hangs.
Anyone have any ideas how to get some more debug info…?
teha
Posts: 18
Joined: Wednesday 30 December 2015 20:23
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Lomma, Sweden
Contact:

Re: Python Plugin: Tibber

Post by teha »

Looks promising but I have a small problem

2022-03-21 10:45:05.654 Tibber: {'Status': '200', 'Headers': {'Date': 'Mon, 21 Mar 2022 10:45:05 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '510', 'Connection': 'keep-alive', 'X-Powered-By': 'Express', 'Access-Control-Allow-Origin': '*', 'ETag': 'W/"1fe-g5zzQu191I7k/EHoShxuOXIt5+U"', 'Vary': 'Accept-Encoding'}, 'Data': b'{"data":{"viewer":{"homes":[{"currentSubscription":{"priceInfo":{"today":[{"total":0.2396},{"total":0.215},{"total":0.2072},{"total":0.2996},{"total":0.4406},{"total":1.9776},{"total":2.45},{"total":2.485},{"total":2.5032},{"total":2.451},{"total":2.0179},{"total":2.105},{"total":1.6258},{"total":0.5061},{"total":0.4913},{"total":0.5202},{"total":0.6822},{"total":2.4808},{"total":2.9548},{"total":3.0846},{"total":2.492},{"total":2.369},{"total":1.615},{"total":0.4636}]}}},{"currentSubscription":null}]}}}\n'}
2022-03-21 10:45:05.654 Error: Tibber: 'onMessage' failed 'TypeError':''NoneType' object is not subscriptable'.
2022-03-21 10:45:05.654 Error: Tibber: Exception traceback:
2022-03-21 10:45:05.654 Error: Tibber: ----> Line 560 in '/home/teha/domoticz/plugins/Tibber-Domoticz/plugin.py'
2022-03-21 10:45:05.654 Error: Tibber: ----> Line 292 in '/home/teha/domoticz/plugins/Tibber-Domoticz/plugin.py'

I am on version 2022.1 stable

From what I can see all the values are there however something goed wrong when executing the code, I am not that good an .py so I haven't spent that much time trying to look into the code
RPi2 with RFXtrf433(E) at stable, RPi2 with AeonStick S2 on beta, 14*Sonos, Synology DS415play, Axis, D-link camera, PhilipsHue
teha
Posts: 18
Joined: Wednesday 30 December 2015 20:23
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: Lomma, Sweden
Contact:

Re: Python Plugin: Tibber

Post by teha »

found the problem!!

I had registered 2 homes in the Tibber app but I did only have a contract with one of the addresses, so currectSubscription was "null" for the 2nd subscription and caused the error (If you ever want to update with this fault tolerance!!!!)

Unfortunately ou need to contact Tibber support to remove homes from the tibber account

... but all set now
RPi2 with RFXtrf433(E) at stable, RPi2 with AeonStick S2 on beta, 14*Sonos, Synology DS415play, Axis, D-link camera, PhilipsHue
NiklasO
Posts: 67
Joined: Friday 16 August 2013 18:34
Target OS: -
Domoticz version:
Location: Stockholm, Sweden
Contact:

Re: Python Plugin: Tibber

Post by NiklasO »

Working fine here. Just wanted to say thanks!

Edit
Installed Pulse today.
Last edited by NiklasO on Friday 22 July 2022 21:04, edited 2 times in total.
Flopp
Posts: 279
Joined: Sunday 03 January 2016 14:55
Target OS: -
Domoticz version:
Location: Sweden
Contact:

Re: Python Plugin: Tibber

Post by Flopp »

NiklasO wrote: Friday 22 July 2022 19:36 Working fine here. Just wanted to say thanks!
Nice to hear, thank you
juppiejo
Posts: 3
Joined: Thursday 08 December 2016 23:16
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Python Plugin: Tibber

Post by juppiejo »

Thanks for creating this plugin. It works fine here!

The thoughts I have for further usage within Domoticz:
  • Switch on a device within a certain timeframe when the energy price is the lowest (eg heating up the espresso machine in the morning), in that case you would need more datapoints for the hourly prices
  • Calculate actual energy costs per day/month/year, using the hourly prices. Updating the prices in the Domoticz settings won't work unfortunately, since it uses only the latest value to calculate costs in the reports.
If anyone has already found usefull scripts/has suggestions or wants to work together to create the functionalities, please let me know!
wkossen
Posts: 62
Joined: Friday 06 November 2020 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Tibber

Post by wkossen »

Hi,

I gave this plugin a go as I am a soon to be Tibber client.

I noticed that it does not have Euro support. I know Tibber is originally a scandinavian company, but it has expanded to other countries, including the Netherlands.

Now, i can add the word Euro in the plugin description, and even as a selection currency in the setup screen. But there are still issues. The main one is that the price values are off by a factor of 10. I get 2.675 current price where it should be .2675.

Also, there is this entry for transfer fee, that i don't know how to use. There are additional usage based cost in the Dutch pricing system, mainly different types of tax. I just don't know which one to add, or maybe they are already in the total price.

Then there are monthly costs that i can't add anywhere. I guess that doesnot have anything to do with Tibber, but to get a cost management setup i need to be able to calculate and forcast cost in full.

So i guess further development would be helpful. I would like to have a 'monthly cost variable' available in Domoticz to do stuff with. I'ld like to understand transfer cost. I would like Euro to work without fail.

I also think a way to reset min and max prices would be helpful so you can see what peaks and valleys happen in a certain time. I also would like notifications on low price and high prices based on certain thresholds.

Another thing is, i don't have a pulse, but i do have p1 and homewizard. It would be great if those (or others) could be somehow connected to the prices.

I'm not a programmer although i can kinda read and understand the code. I also don't have a lot of time to set aside for this. But if anyone could, i'ld be happy to test future versions. My Tibber contract starts february 8th, i'ld love to have it all running by then.

Thanks for any help!
Cheers, Willem Kossen
LMER
Posts: 11
Joined: Tuesday 30 May 2017 15:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python Plugin: Tibber

Post by LMER »

Hi!

Thanks for a nice plugin!

I read about someone having 2 home ID's in it's Tibber subscriptions. I have 2 ID's as well, but only one active.

My CurrentSubscriptionStatus response looks like this (real ID's replaced by x, y, and z):

{
"data": {
"viewer": {
"homes": [
{
"id": "yyy-47bc-a749-xxx",
"currentSubscription": {
"status": "running"
}
},
{
"id": "zzz-131b-4a1c-aa9b-xxx",
"currentSubscription": null
}
]
}}}

The second ID is not active.
The plugin wasn't creating any devices and gave some errors.
I then changed line 242 in plugin.py to
self.House += 0

I also see that line 262 is hardcoded to House [0] (the other are Self.House), but that doesn't create any problems in this situation.
and then there were no errors and he devices were created.

An option to this HomeID handling would maybe be to include it in the query directly:
{
viewer {
home (id:"yyy-47bc-a749-xxx") {
id
currentSubscription {
status
}}}}

and get the response:

{
"data": {
"viewer": {
"home": {
"id": "yyy-47bc-a749-xxx",
"currentSubscription": {
"status": "running"
}}}}}

since we already have the information about the HomeID from the users Hardware settings, when creating the Tibber hardware.

BR
User avatar
Domoberry
Posts: 116
Joined: Tuesday 30 May 2017 19:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.7
Contact:

Re: Python Plugin: Tibber

Post by Domoberry »

Hi Team,
Tried to install the Tibber plugin from https://github.com/flopp999/Tibber-Domoticz on my RPI4 running Domoticz 2024.1.
The installation does not throw any errors when installing/upgrading the various packages as per the requirements.txt file from Github.
However, when 'adding'; the hardware, the Domoticz log shows:

Code: Select all

2024-05-29 10:13:12.598 Error: Tibber: (Tibber) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/Tibber/:/usr/lib/python39.zip:/usr/lib/python3.9:/usr/lib/python3.9/lib-dynload:/usr/local/lib/python3.9/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.9/dist-packages'.
2024-05-29 10:13:12.599 Error: Tibber: Traceback (most recent call last):
2024-05-29 10:13:12.599 Error: Tibber: File "/home/pi/domoticz/plugins/Tibber/plugin.py", line 71, in <module>
2024-05-29 10:13:12.599 Error: Tibber: import requests, json, os, logging, asyncio
2024-05-29 10:13:12.599 Error: Tibber: File "/usr/local/lib/python3.9/dist-packages/requests/__init__.py", line 48, in <module>
2024-05-29 10:13:12.599 Error: Tibber: from charset_normalizer import __version__ as charset_normalizer_version
2024-05-29 10:13:12.599 Error: Tibber: File "/usr/local/lib/python3.9/dist-packages/charset_normalizer/__init__.py", line 24, in <module>
2024-05-29 10:13:12.599 Error: Tibber: from .api import from_bytes, from_fp, from_path, is_binary
2024-05-29 10:13:12.599 Error: Tibber: File "/usr/local/lib/python3.9/dist-packages/charset_normalizer/api.py", line 5, in <module>
2024-05-29 10:13:12.599 Error: Tibber: from .cd import (
2024-05-29 10:13:12.599 Error: Tibber: File "/usr/local/lib/python3.9/dist-packages/charset_normalizer/cd.py", line 14, in <module>
2024-05-29 10:13:12.599 Error: Tibber: from .md import is_suspiciously_successive_range
2024-05-29 10:13:12.599 Error: Tibber: AttributeError: PyCapsule_Import "charset_normalizer.md__mypyc.init_charset_normalizer___md" is not valid
Such errors put me outside my technical comfort zone, hence this post and asking if someone could suggest a next step.
I was considering to downgrade the 'requests' package from the current 2.31.0 to the minimum required version 2.25.1, which - as I understood - also downgrades the 'charset-normalizer' package. But frankly speaking, this is for me 'trial and error' and before going down such slippery slope I would appreciate your expert view :-)
Flopp
Posts: 279
Joined: Sunday 03 January 2016 14:55
Target OS: -
Domoticz version:
Location: Sweden
Contact:

Re: Python Plugin: Tibber

Post by Flopp »

Domoberry wrote: Wednesday 29 May 2024 14:13 Hi Team,
Tried to install the Tibber plugin from https://github.com/flopp999/Tibber-Domoticz on my RPI4 running Domoticz 2024.1.
The installation does not throw any errors when installing/upgrading the various packages as per the requirements.txt file from Github.
However, when 'adding'; the hardware, the Domoticz log shows:

Code: Select all

2024-05-29 10:13:12.598 Error: Tibber: (Tibber) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/Tibber/:/usr/lib/python39.zip:/usr/lib/python3.9:/usr/lib/python3.9/lib-dynload:/usr/local/lib/python3.9/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.9/dist-packages'.
2024-05-29 10:13:12.599 Error: Tibber: Traceback (most recent call last):
2024-05-29 10:13:12.599 Error: Tibber: File "/home/pi/domoticz/plugins/Tibber/plugin.py", line 71, in <module>
2024-05-29 10:13:12.599 Error: Tibber: import requests, json, os, logging, asyncio
2024-05-29 10:13:12.599 Error: Tibber: File "/usr/local/lib/python3.9/dist-packages/requests/__init__.py", line 48, in <module>
2024-05-29 10:13:12.599 Error: Tibber: from charset_normalizer import __version__ as charset_normalizer_version
2024-05-29 10:13:12.599 Error: Tibber: File "/usr/local/lib/python3.9/dist-packages/charset_normalizer/__init__.py", line 24, in <module>
2024-05-29 10:13:12.599 Error: Tibber: from .api import from_bytes, from_fp, from_path, is_binary
2024-05-29 10:13:12.599 Error: Tibber: File "/usr/local/lib/python3.9/dist-packages/charset_normalizer/api.py", line 5, in <module>
2024-05-29 10:13:12.599 Error: Tibber: from .cd import (
2024-05-29 10:13:12.599 Error: Tibber: File "/usr/local/lib/python3.9/dist-packages/charset_normalizer/cd.py", line 14, in <module>
2024-05-29 10:13:12.599 Error: Tibber: from .md import is_suspiciously_successive_range
2024-05-29 10:13:12.599 Error: Tibber: AttributeError: PyCapsule_Import "charset_normalizer.md__mypyc.init_charset_normalizer___md" is not valid
Such errors put me outside my technical comfort zone, hence this post and asking if someone could suggest a next step.
I was considering to downgrade the 'requests' package from the current 2.31.0 to the minimum required version 2.25.1, which - as I understood - also downgrades the 'charset-normalizer' package. But frankly speaking, this is for me 'trial and error' and before going down such slippery slope I would appreciate your expert view :-)
Hi, I do not use Domoticz anymore and this plugin is not supported by me anymore.
User avatar
gizmocuz
Posts: 2350
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Python Plugin: Tibber [Unsupported]

Post by gizmocuz »

Best to use the build in Enever hardware and specify Tibber
Quality outlives Quantity!
User avatar
Domoberry
Posts: 116
Joined: Tuesday 30 May 2017 19:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.7
Contact:

Re: Python Plugin: Tibber [Unsupported]

Post by Domoberry »

Thanks, will give Enever a try!
nieass
Posts: 3
Joined: Friday 19 February 2016 23:36
Target OS: -
Domoticz version:
Contact:

Re: Python Plugin: Tibber [Unsupported]

Post by nieass »

gizmocuz wrote:Best to use the build in Enever hardware and specify Tibber
Seems like Tibber Gas prices not yet Integrated? They do deliver Gas also.

Verstuurd vanaf mijn Mi 10 met Tapatalk

Henry
Posts: 29
Joined: Tuesday 06 March 2018 18:56
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.7
Location: Netherlands
Contact:

Re: Python Plugin: Tibber [Unsupported]

Post by Henry »

nieass wrote: Wednesday 11 September 2024 15:25 Seems like Tibber Gas prices not yet Integrated? They do deliver Gas also.
Maybe you already found this, but for gas with Tibber you have to use Energy Zero
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest