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.0b6.tar.gz (5.7 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.0b6-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bgetech_modbus-0.1.0b6.tar.gz
  • Upload date:
  • Size: 5.7 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.0b6.tar.gz
Algorithm Hash digest
SHA256 1a75c58d821966a9e031994e18dc803d782d1a3a1c1286aff2ec326d52afe1eb
MD5 d192ed60748c2453f622dd32b07ce9c4
BLAKE2b-256 31282bcc40c7dd22b32734e24d167122557c20b7774cbd28e07a20f643693e6d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bgetech_modbus-0.1.0b6-py3-none-any.whl
Algorithm Hash digest
SHA256 f5d5df92e107fc387138d032df3d789c8789b837fa7ded1f72e4a9fd6456250b
MD5 571b71a563ce770c2edd970fc0e03ade
BLAKE2b-256 4cd090e914beac64ed9cdb8af643b996d4645b8d456c0797ec5f4f784e97b7f1

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