Skip to main content
Version: 1.0

Modbus

The Modbus component provides Modbus-TCP communication protocol on tcp port 502 for supported Shelly devices.

The Modbus component uses Modbus as RPC namespace and implements the following methods:

Methods​

Modbus.SetConfig​

Parameters:

PropertyTypeDescription

config

object

Configuration that the method takes

Find more about the config properties in config section

Modbus.GetConfig​

Find the Modbus.GetConfig response properties in config section

Modbus.GetStatus​

Find more about the status response properties in status section

Configuration​

The configuration of the Modbus component enables or disables the server.

Parameters:

PropertyTypeDescription

enable

boolean

Set true to enable.

Status​

The status of the Modbus component shows whether the server is successfully enabled.

PropertyTypeDescription

enabled

boolean

true if enabled, false if disabled.

Registers​

Every Shelly component that supports Modbus has its own set of registers, listed in its documentation:

Device info registers:

AddressTypeDescription
30000ASCII stringDevice MAC (6 registers / 12 bytes)
30006ASCII stringDevice model (10 registers / 20 bytes zero padded)
30016ASCII stringDevice name (32 registers / 64 bytes zero padded)

Modbus.SetConfig example​

http://192.168.33.1/rpc/Modbus.SetConfig?config={"enable":true}

Response

{
"restart_required": false
}

Modbus.GetConfig example​

http://192.168.33.1/rpc/Modbus.GetConfig?

Response

{
"enable": true
}

Modbus.GetStatus example​

http://192.168.33.1/rpc/Modbus.GetStatus?

Response

{}

Useful Tools​

Many tools can be used to send MODBUS TCP requests to and receive responses from Shelly devices. Some of them are:

modbus_cli​

This Python modbus client, as stated in it's documentation can Read and write registers of Modbus devices. GitHub link

Example 1:

Reading timestamp of last update of EM component
modbus -B mixed 192.168.2.48 i@1000/I
Parsed 0 registers definitions from 1 files
1000: 1669379021 0x6380b3cd

Example 2:

Reading voltage on Phase A
modbus -B mixed 192.168.2.48 i@1020/f
Parsed 0 registers definitions from 1 files
1020: 232.2854461669922