Skip to main content

Input

The Input component handles the input of a device. It supports the following methods:

Input.GetStatus#

This method returns the status of the component instance.

Request#

Parameters.

  • id: number, id of the Input component instance in the system. Required
http://192.168.33.1/rpc/Input.GetStatus?id=0

Response#

Attributes in the result:

  • id: number, id of the Input component instance
  • state: boolean or null, state of the input (null if the input instance stateless)
{
"id": 0,
"state": false
}

Input.GetConfig#

This method returns the configuration of the component instance.

Request#

Parameters.

  • id: number, id of the Input component instance. Required
http://192.168.33.1/rpc/Input.GetConfig?id=0

Response#

Attributes in the result:

  • id: number, id of the Input component instance
  • name: string or null, name of the input instance
  • type: string, type of associated input. Range of values {switch, button}
  • invert: boolean, true if the logical state of the associated input is inverted, false otherwise. For the change to be applied, the physical switch has to be toggled once after invert is set.
  • factory_reset: boolean, true if factory reset opion is enabled, false otherwise (shown if applicable)
{
"id": 0,
"name": null,
"type": "switch",
"invert": false
}

Input.SetConfig#

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

Request#

Parameters:

  • id: number, id of the Input component instance. Required
  • config: JSON object, configuration to be applied. This object should be identical in structure to the JSON returned by Input.GetConfig, containing only the keys that need to be modified. Note that id of the instance cannot be configured. Required
Change the configuration of the input with id=0 setting its name to my-Shelly-One and its type to switch.
curl -X POST -d '{"id":1, "src":"user_1", "method":"Input.SetConfig",
"params":{"id":0, "config":{"name":"my-Shelly-One", "type":"switch"}}}' 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": false
}
}

Events Triggering Webhooks#

Currently, depending on the type of Input component different events that can trigger webhooks are available:

  • for Input instances of type switch:
    • input.toggle_on - produced when the input instance is toggled from off to on state
    • input.toggle_off - produced when the input instance is toggled from on to off state
  • for Input instances of type button:
    • input.button_push - produced when the button is pushed once
    • input.button_longpush - produced when the button is pushed once for longer time
    • input.button_doublepush - produced when the button is pushed two consecutive times

Notifications#

This section describes notifications for events specific to the Input component. For general information please see this page.

Instances of the Input component can send notifications for the following events:

  • Button press (only when Input type = button):

Example 1:

Notify that a button press event has occurred.
{
"src": "shellypro4pm-f008d1d8b8b8",
"dst": "user_1",
"method": "NotifyEvent",
"params": {
"ts": 1631266595.43,
"events": [
{
"component": "input:0",
"id": 0,
"event": "btn_down",
"ts": 1631266595.43
}
]
}
}
  • Button release (only when Input type = button):

Example 2:

Notify that a button release event has occurred.
{
"src": "shellypro4pm-f008d1d8b8b8",
"dst": "user_1",
"method": "NotifyEvent",
"params": {
"ts": 1631266564.64,
"events": [
{
"component": "input:0",
"id": 0,
"event": "btn_up",
"ts": 1631266564.64
}
]
}
}
  • Single button push (only when Input type = button):

Example 3:

Notify that a button single push event has occurred.
{
"src": "shellypro4pm-f008d1d8b8b8",
"dst": "user_1",
"method": "NotifyEvent",
"params": {
"ts": 1631266595.44,
"events": [
{
"component": "input:0",
"id": 0,
"event": "single_push",
"ts": 1631266595.44
}
]
}
}
  • Double button push (only when Input type = button):

Example 4:

Notify that a button double push event has occurred.
{
"src": "shellypro4pm-f008d1d8b8b8",
"dst": "user_1",
"method": "NotifyEvent",
"params": {
"ts": 1631266647.44,
"events": [
{
"component": "input:0",
"id": 0,
"event": "double_push",
"ts": 1631266647.44
}
]
}
}
  • Long button push (only when Input type = button):

Example 5:

Notify that a button long push event has occurred.
{
"src": "shellypro4pm-f008d1d8b8b8",
"dst": "user_1",
"method": "NotifyEvent",
"params": {
"ts": 1631266629.79,
"events": [
{
"component": "input:0",
"id": 0,
"event": "long_push",
"ts": 1631266629.79
}
]
}
}