PyBLNET - a very basic python BL-NET bridge
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.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyblnet-1.0.2.tar.gz | 22.2 kB | Without provenance | Details for pyblnet-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyblnet-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for pyblnet-1.0.2-py3-none-any.whl |
Total release size: 49.0 kB
Release files / pyblnet-1.0.2.tar.gz
| Download URL | pyblnet-1.0.2.tar.gz |
|---|---|
| Size | 22.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b00f157a6c07e004b6398a6472a4737d69b8c526c9c76d6136fb065f436287a1
|
|
BLAKE2b-256 checksum How to use checksums |
c257c8313f598a570e46d2303aa6a5c1e6f3f7befd14f83e8b40784a917608fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.32.5
|
Release files / pyblnet-1.0.2-py3-none-any.whl
| Download URL | pyblnet-1.0.2-py3-none-any.whl |
|---|---|
| Size | 26.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a01b3d165633eb51156501eb802d97ab55645003cc6ea8696b6ea4982243d1ed
|
|
BLAKE2b-256 checksum How to use checksums |
22d8acc7583738a4791e91ad65010c07d2cf1aba62bee7e7c9a5c2b634e0f92d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.32.5
|
Security for PyBLNET 1.0.2
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.