A python3 library to communicate with Tibber
Project description
pyTibber
Python3 library for Tibber.
Get electricity price and consumption.
If you have a Tibber Pulse or Watty you can see your consumption in real time.
Go to developer.tibber.com/ to get your API token.
Install
pip3 install pyTibber
Example:
import tibber.const
import tibber
import asyncio
async def start():
tibber_connection = tibber.Tibber(tibber.const.DEMO_TOKEN, user_agent="change_this")
await tibber_connection.update_info()
print(tibber_connection.name)
home = tibber_connection.get_homes()[0]
await home.fetch_consumption_data()
await home.update_info()
print(home.address1)
await home.update_price_info()
print(home.current_price_info)
# await tibber_connection.close_connection()
loop = asyncio.run(start())
Example realtime data:
An example of how to subscribe to realtime data (Pulse/Watty):
import tibber.const
import asyncio
import aiohttp
import tibber
def _callback(pkg):
print(pkg)
data = pkg.get("data")
if data is None:
return
print(data.get("liveMeasurement"))
async def run():
async with aiohttp.ClientSession() as session:
tibber_connection = tibber.Tibber(tibber.const.DEMO_TOKEN, websession=session, user_agent="change_this")
await tibber_connection.update_info()
home = tibber_connection.get_homes()[0]
await home.rt_subscribe(_callback)
while True:
await asyncio.sleep(10)
loop = asyncio.run(run())
The library is used as part of Home Assistant.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pytibber-0.31.6.tar.gz
(27.9 kB
view details)
Built Distribution
pytibber-0.31.6-py3-none-any.whl
(29.1 kB
view details)
File details
Details for the file pytibber-0.31.6.tar.gz
.
File metadata
- Download URL: pytibber-0.31.6.tar.gz
- Upload date:
- Size: 27.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
f7e75ab1391ace584f7723e5babaac463c4084132367883f0af60a4b5d7e2984
|
|
MD5 |
378a2c4b06c3979127e8f9b85322abf4
|
|
BLAKE2b-256 |
4e0ee28cef78642332517d0bfa958213f3eddb925711f546359fc61c2c58f2bd
|
File details
Details for the file pytibber-0.31.6-py3-none-any.whl
.
File metadata
- Download URL: pytibber-0.31.6-py3-none-any.whl
- Upload date:
- Size: 29.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
1cd6a29a6d7eb7c5257d51407e4874bfca856db3cd47762da88105026dc24efa
|
|
MD5 |
b169a408b8fead4c0a78f6aa1bf3170d
|
|
BLAKE2b-256 |
2c62fd22c916888a0faef9952464a8646dbfabd12fa813f75b83fd6e695fc70f
|