Skip to main content

Async Python library for communicating with Zendure P1 Smart Meter

Project description

zendure-p1

Asynchronous Python library for communicating with Zendure P1 Smart Meter.

Installation

pip install zendure-p1

Usage

import asyncio
from zendure_p1 import ZendureP1Client

async def main():
    async with ZendureP1Client("192.168.1.100") as client:
        report = await client.get_report()
        print(f"Total power: {report.total_power} W")
        print(f"Phase A: {report.a_apparent_power} W")
        print(f"Phase B: {report.b_apparent_power} W")
        print(f"Phase C: {report.c_apparent_power} W")

asyncio.run(main())

Error handling

from zendure_p1 import ZendureP1Client
from zendure_p1.exceptions import (
    ZendureP1ConnectionError,
    ZendureP1TimeoutError,
    ZendureP1ResponseError,
)

async with ZendureP1Client("192.168.1.100", timeout=5.0) as client:
    try:
        report = await client.get_report()
    except ZendureP1ConnectionError:
        print("Could not connect to the device")
    except ZendureP1TimeoutError:
        print("Request timed out")
    except ZendureP1ResponseError as e:
        print(f"Device returned an error: {e}")

Model

Report

Returned by client.get_report(). All power values are in watts.

Field Type Description
timestamp int Unix timestamp of the measurement
a_apparent_power int Apparent power on phase A
b_apparent_power int Apparent power on phase B
c_apparent_power int Apparent power on phase C
total_power int Total power across all phases

License

MIT

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

zendure_p1-0.1.0.tar.gz (58.2 kB view details)

Uploaded Source

Built Distribution

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

zendure_p1-0.1.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file zendure_p1-0.1.0.tar.gz.

File metadata

  • Download URL: zendure_p1-0.1.0.tar.gz
  • Upload date:
  • Size: 58.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zendure_p1-0.1.0.tar.gz
Algorithm Hash digest
SHA256 049f84ab331a37359c59051a23fbb1cce85001026dde4139d6a9b278ec395ca6
MD5 28daa9a4a5d8899839b22003909db629
BLAKE2b-256 67ac9a8370bc8a620cc9a7a2f2119773df1c67e8565323a90de05c4fb2fd1d64

See more details on using hashes here.

Provenance

The following attestation bundles were made for zendure_p1-0.1.0.tar.gz:

Publisher: release.yml on NextNebula/zendure-p1

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zendure_p1-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: zendure_p1-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zendure_p1-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 24896dea2f38ac2eaa678c1e697cf4026ec32067db22f6293ed13cb11f246acb
MD5 0ddbfcb4c47d08fd04d89821ce04d4e1
BLAKE2b-256 5dba7120903c0a4259c6f325d6aa530f348a1748994614ef80487a51a17e6bf6

See more details on using hashes here.

Provenance

The following attestation bundles were made for zendure_p1-0.1.0-py3-none-any.whl:

Publisher: release.yml on NextNebula/zendure-p1

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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