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.0b2.tar.gz (5.6 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.0b2-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bgetech_modbus-0.1.0b2.tar.gz
  • Upload date:
  • Size: 5.6 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.0b2.tar.gz
Algorithm Hash digest
SHA256 b3affebcd0f1a40f47faf1b85062d24967e6cc74ebf41424aca872c026b7c001
MD5 4fdd58b1b91bb350c928be8572037be3
BLAKE2b-256 d827e6ddba23c03c09b3de27601c38358594372ce607f9ae937f1a429809cab9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bgetech_modbus-0.1.0b2-py3-none-any.whl
Algorithm Hash digest
SHA256 a1430febbaf99d9d4a2dd1d1daae49bea2cd6873939e3187be278ceebed92b5f
MD5 6ecb6363b8e08c96d49903ee22af50b1
BLAKE2b-256 9030ffaf1d8d889ebf06b8fae2f1a1e6047c6bdd05ccacb7b4eba35792f3a9be

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