Skip to main content
Version: 1.0

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:

Methods

Eth.SetConfig

Properties:

PropertyTypeDescription

config

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:

PropertyTypeDescription

offset

number

Starting index of the elements in the paginated repsonse list. Optional, default 0

Response

PropertyTypeDescription

ts

number

Unix timestamp of the generated response

offset

number

Index of the first client listed in the result

count

number

Number of currently listed clients

total

number

Total number of clients connected to the interface

dhcp_clients

array of objects

PropertyTypeDescription

host

string or null

Hostname of the connected client or null if not available

mac

string

MAC address of the connected client

ip

string

Assigned IP address of the connected client

ttl

number

Remaining time until expiration of the DHCP lease in seconds

Configuration

The configuration of the Ethernet component shows the current settings of the ethernet connection. Changing any parameter requires restart.

PropertyTypeDescription

enable

boolean

true if the connection is enabled, false otherwise

server_mode

boolean

true if the inerface is configured to operate in server mode, false if in client mode

ipv4mode

string

IPv4 mode. Range of values: dhcp, static. Applicable only for client mode. Can be omitted if once set

ip

string or null

IP in the network for client mode static and for server mode enabled. Required if not already set

netmask

string or null

Netmask of the network for client mode static and for server mode enabled. Optional, defaults to 255.255.255.0

gw

string or null

Gateway of the network for client mode static and for server mode enabled. Optional, set to null to clear

nameserver

string or null

Nameserver to use for client mode static and for server mode enabled. Optional, set to null to clear

dhcp_start

string

DHCP range starting IP address for the DHCP server in server mode. Applicable only for server mode. Required if not already set

dhcp_end

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.

PropertyTypeDescription

ip

string or null

IP of the device in the network

Examples

Eth.SetConfig example

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

Response

{
"restart_required": true
}

Eth.GetConfig example

http://192.168.33.1/rpc/Eth.GetConfig

Response

{
"enable": true,
"server_mode": false,
"ipv4mode": "dhcp",
"ip": null,
"netmask": null,
"gw": null,
"nameserver": null
}

Eth.GetStatus example

http://192.168.33.1/rpc/Eth.GetStatus

Response

{
"ip": null
}

Eth.ListClients example

http://192.168.33.1/rpc/Eth.ListClients

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
}
]
}