Skip to main content

Input

The Input component handles the input of a device and the input-triggered factory reset.

note

Factory reset by input is a way to roll back any changes made to the device and return it to its factory configuration. This action is possible only in the first 60 seconds after boot. The user should toggle the input 5 times and the device will be reset to its factory settings. Factory reset can also be done using an RPC call.

Status#

The status of the Input component contains information about the state of the chosen input instance.

Properties:

  • id: number, id of the Input component instance
  • state: boolean or null, state of the input (null if the input instance is stateless, e.g. for type button)
Example status object
{
"id": 0,
"state": false
}

Configuration#

The configuration of the Input component contains information about the type, invert and factory reset settings of the chosen input instance.

Properties:

  • 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 input-triggered factory reset option is enabled, false otherwise (shown if applicable)
Example configuration object
{
"id": 0,
"name": null,
"type": "switch",
"invert": 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
}
]
}
}