Repository navigation
Releases: LDoes/victron-modbus
Releases · LDoes/victron-modbus
Release list
0.2.0
Adds support for the Victron P1Link.
Supported devices
| Device | Notes |
|---|---|
| VM-3P75CT | Three-phase energy meter (the default in the examples) |
| VM-3P5A | Three-phase energy meter |
| P1Link | Smart meter reader |
What it reads
- Voltage, current and power per phase, plus total power
- Forward and reverse energy, in total and per phase
- Grid frequency and PE-N voltage on the VM-3P75CT and the VM-3P5A, with the fine-resolution frequency register where the device has one
- Device identity: product ID, serial number and hardware revision
Behaviour worth knowing
- Unavailable readings are
None. A value the device reports as invalid, for example from a phase that has nothing connected, is returned asNone, never as a number. - Phases that aren't wired are left out. The meter's phase configuration is read once, and readings for phases it isn't connected to are not requested.
- Timeouts are retried. A request that gets no answer is retried up to three times with a one-second timeout, so one lost UDP packet doesn't turn into a failed update.
- Any transport. The library is built on
modbus-connection, so it works over whatever backend you give it. Thecliextra installs a UDP backend for the command-line example.
Installation
pip install victron-modbus
For the command-line example in script/query.py:
pip install "victron-modbus[cli]"
Usage
from modbus_connection.tmodbus import connect_udp
from victron_modbus.vm_3p75ct import VM3P75CT
connection = await connect_udp("192.168.1.101")
try:
device = VM3P75CT(connection.for_unit(1))
report = await device.async_update() # which sub-systems updated / failed
print(device.info.serial_number, device.power.total, device.phase_1.voltage)
finally:
await connection.close()Check report.failed before using the values. If you don't know the model up front, async_identify returns the matching device object. See the README for the full documentation.
Tested on
VM-3P75CT, VM-3P5A and P1Link devices.
Changes since 0.1.0
- Added the P1Link (
victron_modbus.p1link, product ID0xC02F).
0.1.0
First release of victron-modbus, an asynchronous, transport-independent Python library for reading Victron Energy devices over Modbus.
Supported devices
| Device | Notes |
|---|---|
| VM-3P75CT | Three-phase energy meter (the default in the examples) |
| VM-3P5A | Three-phase energy meter |
What it reads
- Voltage, current and power per phase, plus total power
- Forward and reverse energy, in total and per phase
- Grid frequency, using the fine-resolution register where the device has one
- Device identity: product ID, serial number and hardware revision
Behaviour worth knowing
- Unavailable readings are
None. A value the device reports as invalid, for example from a phase that has nothing connected, is returned asNone, never as a number. - Phases that aren't wired are left out. The meter's phase configuration is read once, and readings for phases it isn't connected to are not requested.
- Timeouts are retried. A request that gets no answer is retried up to three times with a one-second timeout, so one lost UDP packet doesn't turn into a failed update.
- Any transport. The library is built on
modbus-connection, so it works over whatever backend you give it. Thecliextra installs a UDP backend for the command-line example.
Installation
pip install victron-modbus
For the command-line example in script/query.py:
pip install "victron-modbus[cli]"
Usage
from modbus_connection.tmodbus import connect_udp
from victron_modbus.vm_3p75ct import VM3P75CT
connection = await connect_udp("192.168.1.101")
try:
device = VM3P75CT(connection.for_unit(1))
report = await device.async_update() # which sub-systems updated / failed
print(device.info.serial_number, device.power.total, device.phase_1.voltage)
finally:
await connection.close()Check report.failed before using the values. A reading the device reports as unavailable is None. If you don't know the model up front, async_identify returns the matching device object. See the README for the full documentation.
Tested on
VM-3P75CT and VM-3P5A meters.