Skip to main content

An asynchronous Python library to communicate with PG LAB Electronics devices over MQTT.

Project description

pypglab

About

An asynchronous Python library to communicate with PG LAB Electronics devices over MQTT.

This library was created for Home Assistant integrations of PG LAB Electronics.

Features

  • Discover devices
  • Control relays (turn on/off)
  • Monitor relays status (on/off)
  • Control shutters (open/close/pause)
  • Monitor shutters status (open/opening/closed/closing)
  • Receiving device internal sensor update

Devices supported

  • E-BOARD

Coming soon

  • E-SWITCH

Installation

pip install pypglab

Usage

The library has an helper class to simplify the discovery and the use of PG LAB Electronics devices. The helper class hide the complexity to setup the MQTT connection with the broker.

In this simple working example pyPgLab class does the connection with the MQTT broker, retrieve an E-BOARD device and turn ON all available relay outputs

from pypglab.helper import pyPgLab

def turn_relay(relay, on):
    if on:
        asyncio.run( relay.turn_on() )
    else:
        asyncio.run( relay.turn_off() )
    time.sleep(0.02)

pglab = pyPgLab()
pglab.start("192.168.1.8")
pglab.connect()

e_board = pglab.get_device_by_name("E-BOARD-DD53AC85")

if e_board :
    # turn all relay outputs ON
    for relay in e_board.relays:
        asyncio.run( relay.turn_on() )

pglab.stop()

For more example and proper setup of the MQTT connection and callback, see the example.py and the unittest of pypglab python library.

Feedback

Please give us feedback on support@pglab.dev

Founder

This plugin is created by PG Lab Electronics.

License

Code is released under [MIT license]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pypglab-0.0.5.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

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

pypglab-0.0.5-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file pypglab-0.0.5.tar.gz.

File metadata

  • Download URL: pypglab-0.0.5.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for pypglab-0.0.5.tar.gz
Algorithm Hash digest
SHA256 cf7db4654d9a6367c8099c3db6c75002f40f15ed15dc43f1236a7d02a0c54a4b
MD5 118f75a23ee7da372555b5beae5bdd7f
BLAKE2b-256 d320c63002471c34124f9d435ef69749557f76c6ed1fac9c1161cf0d87cd6c5b

See more details on using hashes here.

File details

Details for the file pypglab-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: pypglab-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for pypglab-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8cead9a2134f46591082317553a74d72a8c85c027395778e63b76aae75e7c023
MD5 344eb27e0958bb744727e7b7bdd42a1b
BLAKE2b-256 9778eb3da67adf1caf3a88813a3fc0b715b60087a6a721470d75bb23591cc55a

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