tib
Tibber
pypi i Tibber
tib

Tibber

Async Python 3 library for Tibber

by Daniel Hjelseth Høyer

0.16.0 (see all)License:MIT
pypi i Tibber
Readme

pyTibber

PyPI version Code style: black License: MIT Language grade: Python

Python3 library for Tibber.

Get electricity price and consumption.

If you use this link to signup for Tibber, you get 50 euro to buy smart home products in the Tibber store: https://invite.tibber.com/6fd7a447

If you have a Tibber Pulse or Watty you can see your consumption in real time.

Buy me a coffee :)

Go to developer.tibber.com/ to get your API token.

Install

pip3 install pyTibber

Example:

import tibber.const
import tibber

access_token = tibber.const.DEMO_TOKEN
tibber_connection = tibber.Tibber(access_token, user_agent="user_agent")
await tibber_connection.update_info()
print(tibber_connection.name)

home = tibber_connection.get_homes()[0]
await home.update_info()
print(home.address1)

await home.update_price_info()
print(home.current_price_info)

await tibber_connection.close_connection()

Example realtime data:

An example of how to subscribe to realtime data (Pulse/Watty):

import tibber.const
import asyncio

import aiohttp
import tibber

ACCESS_TOKEN = tibber.const.DEMO_TOKEN


def _callback(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(ACCESS_TOKEN, websession=session, user_agent="user_agent")
        await tibber_connection.update_info()
    home = tibber_connection.get_homes()[0]
    await home.rt_subscribe(_callback)

The library is used as part of Home Assitant: https://github.com/home-assistant/home-assistant/tree/dev/homeassistant/components/tibber

No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate