Skip to main content

Ethernet

The Ethernet component is called Eth. It handles ethernet services of a device. It supports the following methods:

Eth.GetStatus#

This method returns the status of the component instance.

Request#

This method takes no parameters.

http://192.168.33.1/rpc/Eth.GetStatus

Response#

Attributes in the result:

  • ip: string or null, IP of the device in the network
{
"ip": "10.33.55.170"
}

Eth.GetConfig#

This method returns the configuration of the component instance.

Request#

This method takes no parameters.

http://192.168.33.1/rpc/Eth.GetConfig

Response#

Attributes in the result:

  • enable: boolean, true if the connection is enabled, false otherwise
  • ipv4mode: string, IPv4 mode. Range of values: {dhcp, static}
  • ip: string or null, ip in the network when ipv4mode is static
  • netmask: string or null, netmask of the network when ipv4mode is static
  • gw: string or null, gateway of the network when ipv4mode is static
  • nameserver: string or null, nameserver to use when ipv4mode is static
{
"enable": true,
"ipv4mode": "dhcp",
"ip": null,
"netmask": null,
"gw": null,
"nameserver": null
}

Eth.SetConfig#

This method makes changes in the configuration of the component instance.

Request#

Parameters:

  • config: JSON object, configuration to be applied. This object should be identical in structure to the JSON returned by Eth.GetConfig, containing only the keys that need to be modified. Required
Disable ethernet connection for this device.
curl -X POST -d '{"id":1, "src":"user_1", "method":"Eth.SetConfig",
"params":{"config":{"enable":false}}}' http://${SHELLY}/rpc

Response#

Attributes in the result:

  • restart_required: boolean, true if restart is required to apply the changes, false otherwise
{
"id": 1,
"src": "shellypro4pm-f008d1d8b8b8",
"dst": "user_1",
"result": {
"restart_required": true
}
}