Skip to main content

Asynchronous Modbus library for B+G e-tech energy meters.

Project description

bgetech_modbus

A asynchronous Modbus library for B+G e-tech energy meters.

Usage

Here is a simple example, how to use this lib. In general there are only a few simple steps:

  • create an instance
  • connect
  • build a list with all parameters you want to read from the meter
  • call the read_data() method
import asyncio

from bgetech_modbus.client import BGEtechClient
from bgetech_modbus.devices.ds100 import DS100


async def main():
    client = BGEtechClient(host="127.0.0.1", port=502, device_id=1)
    await client.connect()

    config = [DS100.active_energy_import, DS100.active_energy_export]
    data = await client.read_data(config)

    for entry in data:
        print(f"{entry.name}: {entry.value} {entry.unit}")
        print(f"Last received: {entry.last_received}")
        print(f"[{entry.address}, {entry.count}, {entry.data_type.value}]")
        print()

    client.close()


if __name__ == "__main__":
    try:
        asyncio.run(main())
    except KeyboardInterrupt:
        print("\nExit!")

VS Code or any other IDE will show you the possible values that can be retrieved:

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

bgetech_modbus-0.1.0b5.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

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

bgetech_modbus-0.1.0b5-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file bgetech_modbus-0.1.0b5.tar.gz.

File metadata

  • Download URL: bgetech_modbus-0.1.0b5.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bgetech_modbus-0.1.0b5.tar.gz
Algorithm Hash digest
SHA256 ec3e8c0a06b8b97d49917781fc0b69bcec1a90d1d3a12393954cbf8604c9f1ea
MD5 88ac426db9d54b41bcb76eb43364ab0d
BLAKE2b-256 888982d8544e89b4d4095e0ab1223d4375aceff8b097093cc480d70571737614

See more details on using hashes here.

File details

Details for the file bgetech_modbus-0.1.0b5-py3-none-any.whl.

File metadata

File hashes

Hashes for bgetech_modbus-0.1.0b5-py3-none-any.whl
Algorithm Hash digest
SHA256 c2e465a5cd44b6c1abbd87a4fbc91ff849dd3acdc00e408d670615421a27024a
MD5 a40a3c7b63bd67264298eda487096d8b
BLAKE2b-256 274f0cf99b4d3d941c4c075e58805098cef23097680adf75fec52e5c97b34b38

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