Ethernet
The Ethernet component handles the ethernet interface of devices and uses Eth
for RPC method namespace. It uses the key eth
when enumerated in objects including multiple component payloads, like Shelly.GetStatus
. The ethernet interface can operate in two modes: client
- when the device obtains IP address from DHCP server or sets static IP configuration or server
when it brings up its own DHCP server and allow other devices to connect to it. The ethernet component provides the minimal component interface and a method to list DHCP clients in server mode:
Eth.SetConfig
to update the component's configurationEth.GetConfig
to obtain the component's configurationEth.GetStatus
to obtain the component's statusEth.ListClients
to list devices connected to the DHCP serever in server mode
Methods
Eth.SetConfig
Properties:
Property | Type | Description |
---|---|---|
| object | Configuration that the method takes |
Find more about the config properties in config section
Eth.GetConfig
The Eth.GetConfig method does not own any request properties.Find the response properties in config section
Eth.GetStatus
The Eth.GetStatus method does not own any request properties.Find the response properties in status section
Eth.ListClients
Request
Parameters:
Property | Type | Description |
---|---|---|
| number | Starting index of the elements in the paginated repsonse list. Optional, default |
Response
Property | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| number | Unix timestamp of the generated response | |||||||||||||||
| number | Index of the first client listed in the result | |||||||||||||||
| number | Number of currently listed clients | |||||||||||||||
| number | Total number of clients connected to the interface | |||||||||||||||
| array of objects |
|
Configuration
The configuration of the Ethernet component shows the current settings of the ethernet connection. Changing any parameter requires restart.
Property | Type | Description |
---|---|---|
| boolean |
|
| boolean |
|
| string | IPv4 mode. Range of values: |
| string or null | IP in the network for client mode |
| string or null | Netmask of the network for client mode |
| string or null | Gateway of the network for client mode |
| string or null | Nameserver to use for client mode |
| string | DHCP range starting IP address for the DHCP server in server mode. Applicable only for server mode. Required if not already set |
| string | DHCP range ending IP address for the DHCP server in server mode. Applicable only for server mode. Required if not already set |
Status
The status of the Ethernet component contains the IP address which can be used to access the device over ethernet.
Property | Type | Description |
---|---|---|
| string or null | IP of the device in the network |
Examples
Eth.SetConfig example
- Eth.SetConfig HTTP GET Request
- Eth.SetConfig Curl Request
- Eth.SetConfig Mos Request
http://192.168.33.1/rpc/Eth.SetConfig?config={"enable":true}
curl -X POST -d '{"id":1,"method":"Eth.SetConfig","params":{"config":{"enable":true}}}' http://${SHELLY}/rpc
mos --port ${PORT} call Eth.SetConfig '{"config":{"enable":true}}'
Response
- Eth.SetConfig HTTP GET Response
- Eth.SetConfig Curl Response
- Eth.SetConfig Mos Response
{
"restart_required": true
}
{
"id": 1,
"src": "shellypro1-84cca87c1f90",
"params": {
"restart_required": true
}
}
{
"restart_required": true
}
Eth.GetConfig example
- Eth.GetConfig HTTP GET Request
- Eth.GetConfig Curl Request
- Eth.GetConfig Mos Request
http://192.168.33.1/rpc/Eth.GetConfig
curl -X POST -d '{"id":1,"method":"Eth.GetConfig"}' http://${SHELLY}/rpc
mos --port ${PORT} call Eth.GetConfig
Response
- Eth.GetConfig HTTP GET Response
- Eth.GetConfig Curl Response
- Eth.GetConfig Mos Response
{
"enable": true,
"server_mode": false,
"ipv4mode": "dhcp",
"ip": null,
"netmask": null,
"gw": null,
"nameserver": null
}
{
"id": 1,
"src": "shellypro1-84cca87c1f90",
"params": {
"enable": true,
"server_mode": false,
"ipv4mode": "dhcp",
"ip": null,
"netmask": null,
"gw": null,
"nameserver": null
}
}
{
"enable": true,
"server_mode": false,
"ipv4mode": "dhcp",
"ip": null,
"netmask": null,
"gw": null,
"nameserver": null
}
Eth.GetStatus example
- Eth.GetStatus HTTP GET Request
- Eth.GetStatus Curl Request
- Eth.GetStatus Mos Request
http://192.168.33.1/rpc/Eth.GetStatus
curl -X POST -d '{"id":1,"method":"Eth.GetStatus"}' http://${SHELLY}/rpc
mos --port ${PORT} call Eth.GetStatus
Response
- Eth.GetStatus HTTP GET Response
- Eth.GetStatus Curl Response
- Eth.GetStatus Mos Response
{
"ip": null
}
{
"id": 1,
"src": "shellypro1-84cca87c1f90",
"params": {
"ip": null
}
}
{
"ip": null
}
Eth.ListClients example
- Eth.ListClients HTTP GET Request
- Eth.ListClients Curl Request
- Eth.ListClients Mos Request
http://192.168.33.1/rpc/Eth.ListClients
curl -X POST -d '{"id":1,"method":"Eth.ListClients"}' http://${SHELLY}/rpc
mos --port ${PORT} call Eth.ListClients
Response
- Eth.ListClients HTTP GET Response
- Eth.ListClients Curl Response
- Eth.ListClients Mos Response
{
"ts": 1718875111,
"offset": 0,
"count": 3,
"total": 3,
"dhcp_clients": [
{
"host": null,
"mac": "ec:62:60:90:df:a3",
"ip": "192.168.0.131",
"ttl": 360
},
{
"host": null,
"mac": "08:f9:e0:e4:a3:23",
"ip": "192.168.0.167",
"ttl": 530
},
{
"host": null,
"mac": "ec:62:60:8a:98:a7",
"ip": "192.168.0.106",
"ttl": 520
}
]
}
{
"id": 1,
"src": "shellypro1-84cca87c1f90",
"params": {
"ts": 1718875111,
"offset": 0,
"count": 3,
"total": 3,
"dhcp_clients": [
{
"host": null,
"mac": "ec:62:60:90:df:a3",
"ip": "192.168.0.131",
"ttl": 360
},
{
"host": null,
"mac": "08:f9:e0:e4:a3:23",
"ip": "192.168.0.167",
"ttl": 530
},
{
"host": null,
"mac": "ec:62:60:8a:98:a7",
"ip": "192.168.0.106",
"ttl": 520
}
]
}
}
{
"ts": 1718875111,
"offset": 0,
"count": 3,
"total": 3,
"dhcp_clients": [
{
"host": null,
"mac": "ec:62:60:90:df:a3",
"ip": "192.168.0.131",
"ttl": 360
},
{
"host": null,
"mac": "08:f9:e0:e4:a3:23",
"ip": "192.168.0.167",
"ttl": 530
},
{
"host": null,
"mac": "ec:62:60:8a:98:a7",
"ip": "192.168.0.106",
"ttl": 520
}
]
}