About
This is an addon for qToggleServer.
With this addon you can read and control Modbus-enabled devices (such as energy meters) via qToggleServer. You can also configure a Modbus server so that your qToggleServer behaves like a Modbus device itself.
Install
Install using pip:
pip install qtoggleserver-modbus
Usage
Serial Client
qtoggleserver.conf:
...
peripherals = [
...
{
driver = "qtoggleserver.modbus.ModbusSerialClient"
method = rtu # `ascii` (default), `rtu` or `binary`
serial_port = "/dev/ttyUSB0"
serial_baud = 9600 # this is the default
serial_stopbits = 1 # this is the default
serial_bytesize = 8 # this is the default
serial_parity = N # `N`, `E` or `O` (defaults to `N`)
handle_local_echo = false # this is the default
# see below for common parameters
}
...
]
...
Serial Server
qtoggleserver.conf:
...
peripherals = [
...
{
driver = "qtoggleserver.modbus.ModbusSerialServer"
method = rtu # `ascii` (default), `rtu` or `binary`
serial_port = "/dev/ttyUSB0"
serial_baud = 9600 # this is the default
serial_stopbits = 1 # this is the default
serial_bytesize = 8 # this is the default
serial_parity = N # `N`, `E` or `O` (defaults to `N`)
# see below for common parameters
}
...
]
...
TCP Client
qtoggleserver.conf:
...
peripherals = [
...
{
driver = "qtoggleserver.modbus.ModbusTcpClient"
method = socket # `socket` (default), `ascii`, `rtu` or `binary`
tcp_host = "192.168.0.2" # IP or hostname of the Modbus device
tcp_port = 502 # Modbus device TCP port
# see below for common parameters
}
...
]
...
TCP Server
qtoggleserver.conf:
...
peripherals = [
...
{
driver = "qtoggleserver.modbus.ModbusTcpServer"
method = socket # `socket` (default), `ascii`, `rtu` or `binary`
tcp_address = "0.0.0.0" # binds on all interfaces by default
tcp_port = 502 # Modbus device TCP port
# see below for common parameters
}
...
]
...
Passive Serial Client
qtoggleserver.conf:
...
peripherals = [
...
{
driver = "qtoggleserver.modbus.PassiveModbusSerialClient"
serial_port = "/dev/ttyUSB0"
serial_baud = 9600 # this is the default
serial_stopbits = 1 # this is the default
serial_bytesize = 8 # this is the default
serial_parity = N # `N`, `E` or `O` (defaults to `N`)
# see below for common parameters
}
...
]
...
Passive TCP(dump) Client
qtoggleserver.conf:
...
peripherals = [
...
{
driver = "qtoggleserver.modbus.PassiveModbusTcpClient"
port = 5020 # TCP port to sniff
iface = "eth0" # network interface to sniff (defaults to `any`)
master_ip = "192.168.1.122" # IP address of the master Modbus machine (optional)
slave_ip = "192.168.1.123" # IP address of the slave Modbus machine (optional)
master_port = 5020 # TCP port of the master Modbus machine (optional)
slave_port = 5021 # TCP port of the slave Modbus machine (optional)
tcpdump = "/usr/bin/tcpdump" # full path to the `tcpdump` binary (optional)
# see below for common parameters
}
...
]
...
Common Parameters
The following parameters are common to all types of Modbus clients and servers:
qtoggleserver.conf:
...
peripherals = [
...
{
...
name = "mydevice" # an optional name of your choice
timeout = 5 # in seconds, this is the default
unit_id = 1 # slave unit id, this is the default
ports = {
"port_id1" = {
modbus_type = coil # `coil`, discrete_input`, `input_register` or `holding_register`
address = 1234 # Modbus port address (from `0000` to `9999`)
# number of successive registers mapped to the port, starting at `address` (defaults to `1`)
length = 2
writable = false # defaults to `null`, inferred from `modbus_type`
# `struct` format to use to group multiple register values into a byte array (defaults to `>` followed
# by `H` times `length`)
register_group_fmt = ">HH"
# `struct` format to use to map register byte array to port value (defaults to `>h`)
value_fmt = ">i"
}
...
}
...
}
...
]
...
Common Client Parameters
The following parameters are common to all types of Modbus clients:
qtoggleserver.conf:
...
peripherals = [
...
{
...
use_single_functions = false # set to `true` to use single Modbus access functions instead of multi ones
initial_delay = 5 # the number of seconds to delay polling after connection (defaults to `0`)
...
}
...
]
...
Common Server Parameters
The following parameters are common to all types of Modbus servers:
qtoggleserver.conf:
...
peripherals = [
...
{
...
identity_vendor_name = "My Vendor"
identity_product_code = "PROD1234"
identity_major_minor_revision = "3.14.15"
identity_vendor_url = "https://example.com"
identity_product_name = "My Product"
identity_model_name = "My Model"
identity_user_application_name = "My Custom Model"
...
}
...
]
...
Metadata
Release files for qtoggleserver-modbus 1.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| qtoggleserver_modbus-1.6.0.tar.gz | 17.4 kB | Without provenance | Details for qtoggleserver_modbus-1.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| qtoggleserver_modbus-1.6.0-py3-none-any.whl | Python 3 | none | any | Details for qtoggleserver_modbus-1.6.0-py3-none-any.whl |
Total release size: 37.0 kB
Release files / qtoggleserver_modbus-1.6.0.tar.gz
| Download URL | qtoggleserver_modbus-1.6.0.tar.gz |
|---|---|
| Size | 17.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5b276eb9f05bf40ab599529834c347c61745d14cfc19088bb4e9c084b51a175e
|
|
BLAKE2b-256 checksum How to use checksums |
9b616e5f90c579bf38a356a94d9e82df744e97dd0a73db952f9b9511a771c4dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / qtoggleserver_modbus-1.6.0-py3-none-any.whl
| Download URL | qtoggleserver_modbus-1.6.0-py3-none-any.whl |
|---|---|
| Size | 19.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e6cdb768552af9f9e8c30dde332ed9b7656211f3652d81b1be851b35aecffb0e
|
|
BLAKE2b-256 checksum How to use checksums |
bc5ee4a0e082ed69bbcb12adfebe46949d27b72e4f6e2e58bade690a1fa2053d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for qtoggleserver-modbus 1.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.