A python wrapper for the Tibber API.
Project description
tibber.py - The Python wrapper for the Tibber API
A python wrapper package for communication with the Tibber API. This package aims to cover all functionalities of the Tibber API.
Installation
Install via pip
python -m pip install tibber.py
Requirements
tibber.py depends only on aiohttp and websockets. As of now, the project requires Python 3.9+ as well (this might change in the future to support Python 3.7+).
Examples
Getting basic client data
import tibber
client = tibber.Client(tibber.DEMO_TOKEN) # Log in with an access token. All information gets updated here and stored in cache.
# These properties are retrieved from cache
print(client.name) # "Arya Stark"
print(client.user_id) # "df4b53bf-0709-4679-8744-08876cbb03c1"
print(client.account_type) # ["tibber", "customer"]
print(client.login) # "edgeir@tibber.com"
Getting basic home data
import tibber
client = tibber.Client(tibber.DEMO_TOKEN)
home = client.homes[0]
print(home.id) # "cc83e83e-8cbf-4595-9bf7-c3cf192f7d9c"
print(home.time_zone) # "Europe/Oslo"
print(home.app_nickname) # "Ulltang casa"
print(home.app_avatar) # "FLOORHOUSE2"
print(home.size) # 200
print(home.type) # "HOUSE"
print(home.number_of_residents) # 4
print(home.primary_heating_source) # "AIR2AIR_HEATPUMP"
print(home.has_ventilation_system) # True
print(home.main_fuse_size) # 63
Reading live measurements
Note how you can register multiple callbacks for the same event. These will be run in order of which they were registered.
INFO: In the future, events should be declared async and all callbacks will be ran asynchronously instead of sequentially.
import tibber
client = tibber.Client(tibber.DEMO_TOKEN)
home = client.homes[0]
@home.event("consumption")
def show_current_power(data):
print(data.power)
# Multiple callback functions for the same event!
@home.event("consumption")
def show_accumulated_cost(data):
print(f"{data.accumulated_cost} {data.currency}")
# Start the live feed. This runs forever.
home.start_livefeed()
100% API coverage TODO / Progress list
All the API features are documented here: https://developer.tibber.com/docs/reference
- Address
- Consumption
- ContactInfo
- Home
- HomeConsumptionConnection
- HomeConsumptionEdge
- HomeConsumptionPageInfo
- HomeFeatures
- HomeProductionConnection
- HomeProductionEdge
- HomeProductionPageInfo
- LegalEntity
- LiveMeasurement
- MeterReadingResponse
- MeteringPointData
- Price
- PriceInfo
- PriceRating
- PriceRatingEntry
- PriceRatingThresholdPercentages
- PriceRatingType
- Production
- PushNotificationResponse
- RootMutation
- RootSubscription
- Subscription
- SubscriptionPriceConnection
- SubscriptionPriceConnectionPageInfo
- SubscriptionPriceEdge
- Viewer
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
Built Distribution
Hashes for tibber.py-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0da7f7454f7db42b4c31b2d11eb5588950b4aea8cd53456a2aa5590a34d37546 |
|
MD5 | b813f4c1ae933941ce05a7222f2dc88a |
|
BLAKE2b-256 | e19e02f567f81e086acb5130643859f9843367d2f3cf3aa4f8a8473371425146 |