Skip to main content

A python3 library to communicate with Tibber

Project description

pyTibber

PyPI version Ruff pre-commit

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.

Buy me a coffee :)

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.37.6.tar.gz (37.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytibber-0.37.6-py3-none-any.whl (34.8 kB view details)

Uploaded Python 3

File details

Details for the file pytibber-0.37.6.tar.gz.

File metadata

  • Download URL: pytibber-0.37.6.tar.gz
  • Upload date:
  • Size: 37.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for pytibber-0.37.6.tar.gz
Algorithm Hash digest
SHA256 c270cb56dca1ce4ed6d3ee7f2c3b500412f7c47f32df4d9fce0e1c9041ca71b1
MD5 2e67c29e24eef2e5dea396dd2d4ca23b
BLAKE2b-256 8b55b6d20af540f5aa162da00d4a826a9802678d42121b3b6c6cd9da056654b7

See more details on using hashes here.

File details

Details for the file pytibber-0.37.6-py3-none-any.whl.

File metadata

  • Download URL: pytibber-0.37.6-py3-none-any.whl
  • Upload date:
  • Size: 34.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for pytibber-0.37.6-py3-none-any.whl
Algorithm Hash digest
SHA256 ff9a59e682f00c796c049eac6ef4dccd4eb114dd781840e974b3bbaf099817c4
MD5 620fd4080e62f23034a8bfc206d99b82
BLAKE2b-256 6cadc4ecf26473f403e0c2df7252cea27fbdd36c3b67d8ed1c0b3c6ed7241d32

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page