modbusproxy
The modbusproxy
setting is a list of devices that are exposed for third-party systems via Modbus TCP on the network.
Some devices allow only a very limited number of Modbus TCP clients. In the worst case, only a single connection is allowed, as is the case with SolarEdge components. Additionally, in serial Modbus RTU RS485 bus systems, only one master is allowed.
With the help of modbusproxy
, it's possible to set up evcc as a Modbus proxy that can share existing Modbus connections with other systems. This allows evcc to communicate directly with the device, while other systems communicate with evcc, which bundles the communication connections and forwards them to the target device.
The modbusproxy
configuration is a list of different proxy configurations.
For example:
modbusproxy:
- port: 5021
uri: 192.0.2.2:502
- port: 5022
device: /dev/ttyUSB0
baudrate: 9600
comset: "8N1"
- port: 5023
uri: 192.0.2.3:502
rtu: true
Incoming (from third-party systems such as home automation, loggers), the proxy function exclusively supports Modbus TCP.
Outgoing towards the target device to be queried (e.g., inverter, energy meter), the protocol may be translated according to the target device's configuration.
For more information about evcc sponsorship, please visit the sponsorship page.
Required Parameters
port
The local TCP/IP port under which a connection is provided as a proxy server, and from which incoming Modbus TCP connections from third-party systems are accepted.
For example:
port: 5021
Optional Parameters
uri
The IP address and the port of the target device in common URI Scheme.
Every provided port must be unique and not already in use by another application on the same host, however, it must not be different from the port of the target device. Therefore it is valid to define a configuration for port 502, which refers to port 502 on the target device.
For example:
- port: 502
uri: 192.0.2.2:502
rtu
Modbus TCP is typically used for communication with network targets. If needed, you can switch to Modbus RTU over TCP by specifying rtu: true
. A typical use case is for simple transparent RS485-TCP converters (without protocol translation). This must match the device's configuration. It's ignored for serial target systems.
For example:
rtu: true
readonly
By setting this parameter, you can prevent Modbus write accesses by third-party systems.
Possible values:
true
: Write access is blocked without responsedeny
: Write access is blocked with a modbus error as responsefalse
: Write access is forwarded
For example:
readonly: true