Skip to main content

PyBLNET - a very basic python BL-NET bridge

PyPI - Version PyPI - Python Version Build status Coverage Status

A package that connects to the BL-NET that is connected itself to a UVR1611 device by Technische Alternative. It is able to read digital and analog values as well as to set switches to ON/OFF/AUTO.

Documentation on the modules and their methods can be found with the methods and modules themselves.

Installation

pip install pyblnet          # blocking clients
pip install pyblnet[async]   # also the async clients, with aiohttp

Interfaces

The BL-NET has two interfaces, and pyblnet has a client for each:

  • web.Client: the web interface. Reads 'analog' and 'digital' values with their names, and sets switches.
  • direct.Client: the direct connection (BLNet-Direct protocol [1], TA port). Reads 'analog', 'digital', 'speed', 'energy' and 'power' values, without names. It is only tested against a simulated BL-NET, the web interface is the preferred way of accessing it.

Client combines both, each can be enabled or disabled with use_web and use_ta. If both are enabled, values of the direct connection have priority. Setting switches and reading their manual/auto state is only possible via the web interface.

Blocking usage

Client

from pyblnet import Client  # the same as pyblnet.sync.Client

blnet = Client.create('192.168.178.10', password='pass', timeout=5)

# Fetch all data available via the enabled interfaces
print(blnet.fetch())

# Get a value by its name or id
value, entry, data = blnet.get_analog_value(name='TSP.oben')

# Control a switch by its id
blnet.turn_on(10)
blnet.turn_off(10)
blnet.turn_auto(10)

Web interface

from pyblnet.sync import web

# Check if there is a BL-NET at the given address
web.Client.probe('192.168.178.10')  # -> True/False

# The with statement logs in and out. Without logging out,
# the BL-NET blocks any further web access for the next 150s.
with web.Client.create('192.168.178.10', password='pass', timeout=5) as client:
    print(client.read_analog_values())
    print(client.read_digital_values())
    client.set_digital_value(10, 'AUS')

Direct connection

from pyblnet.sync import direct

client = direct.Client.create('192.168.178.10')
print(client.get_latest())
# Logged data, still inofficial because it fails often
print(client.get_data(1))

Async usage

The async clients need an aiohttp session for the web interface, and are closed with close() if they use the direct connection.

Client

import asyncio
import aiohttp
from pyblnet import aio

async def main():
    async with aiohttp.ClientSession() as session:
        blnet = await aio.Client.create('192.168.178.10', session, password='pass', timeout=5)
        print(await blnet.fetch())
        await blnet.turn_auto(10)

asyncio.run(main())

Web interface

async def main():
    async with aiohttp.ClientSession() as session:
        print(await aio.web.Client.probe('192.168.178.10', session))  # -> True/False
        client = await aio.web.Client.create('192.168.178.10', session, password='pass')
        async with client:
            print(await client.read_analog_values())
            await client.set_digital_value(10, 'AUS')

Direct connection

async def main():
    client = await aio.direct.Client.create('192.168.178.10')
    try:
        print(await client.get_latest())
    finally:
        await client.close()

[1] Technische Alternative, "Schnittstelle Winsol <> Bootloader" (2006), archived copy: http://web.archive.org/web/20160122124754/http://www.haus-terra.at:80/heizung/download/Schnittstelle/Schnittstelle_PC_Bootloader.pdf

Metadata

Release files for PyBLNET 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PyBLNET 1.0.1
File Size Uploaded Provenance Actions
pyblnet-1.0.1.tar.gz 22.1 kB Without provenance Details for pyblnet-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for PyBLNET 1.0.1
File Interpreter ABI Platform Actions
pyblnet-1.0.1-py3-none-any.whl Python 3 none any Details for pyblnet-1.0.1-py3-none-any.whl

Total release size: 48.9 kB

Release files / pyblnet-1.0.1.tar.gz

Download URL pyblnet-1.0.1.tar.gz
Size 22.1 kB
Tags Source
SHA-256 checksum
How to use checksums
229ff61b1985a88761368129df0cc1748021b00cbd6328b5ec06afa8ecfe67ee
BLAKE2b-256 checksum
How to use checksums
2eb96034598c1fa4fd1e1ab3b217b79da7f4fc92dbbe1aedf6bfba7c80d20e4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.5

Release files / pyblnet-1.0.1-py3-none-any.whl

Download URL pyblnet-1.0.1-py3-none-any.whl
Size 26.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
39492eb544dc82194b3e2ab1357f29fe2c5cc6aa4a10f962de421999fa610b98
BLAKE2b-256 checksum
How to use checksums
4a83c2c5e6cc4e935c569ad437f4d3fef6060a7e937bf47780f12cb91d1feab5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.5

Security for PyBLNET 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page