Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions DEVELOPMENT.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# python-em511

Driver for Carlo Gavazzi EM511 Series Single Phase Energy Meters using Modbus RTU.

## Get started

### Prerequisites

* Install [Python (>=3.10)](https://www.python.org/downloads/)
* Install [git](https://git-scm.com/downloads)
* Install [uv](https://docs.astral.sh/uv/getting-started/installation/)

### Setup development environment

Clone the repository:

```sh
git clone git@github.com:id8-engineering/python-em511.git
```

Change directory:

```sh
cd python-em511
```

Run pre-commit tests:

```sh
uv run pre-commit run -a
```

Build package:

```sh
uv build
```
56 changes: 31 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,45 @@
[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/id8-engineering/python-em511/badge)](https://scorecard.dev/viewer/?uri=github.com/id8-engineering/python-em511)

# python-em511
## python-em511

Driver for Carlo Gavazzi EM511 Series Single Phase Energy Meters using Modbus RTU.
python-em511 provides a simple, Pythonic interface for reading and writing data
from Carlo Gavazzi EM511 series energy meters over Modbus RTU. It builds on top
of [pymodbus](https://pypi.org/project/pymodbus/).

## Get started
## Example usage:

### Prerequisites
```python
from em511 import Em511
from pymodbus.client import ModbusSerialClient

* Install [Python (>=3.10)](https://www.python.org/downloads/)
* Install [git](https://git-scm.com/downloads)
* Install [uv](https://docs.astral.sh/uv/getting-started/installation/)
# Configure the Modbus client
client = ModbusSerialClient(
port="COM3", # or "/dev/ttyUSB0" on Linux
baudrate=9600,
parity="E",
stopbits=1,
bytesize=8,
# datasheet specifies maximum response timeout of 500ms (typical 40ms)
timeout=0.5,
)

### Setup development environment
# Device Modbus address
device_address = 1

Clone the repository:
# Initialize the EM511 driver
meter = Em511(device_address=device_address, client=client)

```sh
git clone git@github.com:id8-engineering/python-em511.git
```

Change directory:
# Read voltage
voltage = meter.V
print(f"Voltage: {voltage} V")

```sh
cd python-em511
# Example of writing a password-protected parameter
meter.password = 1234
```

Run pre-commit tests:
## Report issues

```sh
uv run pre-commit run -a
```
If you run into problems, you can ask for help in our [issue tracker](https://github.com/id8-engineering/python-em511/issues) on GitHub.

Build package:

```sh
uv build
```
## Contributing
See [CONTRIBUTING.MD](https://github.com/id8-engineering/python-em511/blob/main/CONTRIBUTING.MD) and [DEVELOPMENT.MD](https://github.com/id8-engineering/python-em511/blob/main/DEVELOPMENT.MD).