Skip to content

The Button Object in Netsocs

The functionality of a Button object adapts perfectly to the Netsocs model of states and properties,
but with a focus on instantaneous events rather than persistent states.

It is a type of object designed specifically to execute a specific action towards a device or service within Netsocs. Its main function is to act as an event trigger, similar to a virtual momentary pushbutton. Unlike other objects, it doesn't store state information (such as "on" or "off"), but focuses solely on initiating specific commands when activated.

This type of object is ideal for representing actions that require a single and immediate execution, such as:

  • Restart device: Force remote restart of equipment.
  • Update firmware: Start the embedded software update process.
  • Synchronize data: Request immediate synchronization of information with a cloud service.
  • Execute script: Manually activate a set of preconfigured commands.
  • Test connectivity: Verify the connection status of a device in real time.
  • Reset counters: Reset cumulative values like usage statistics to zero.

Although conceptually similar to a physical pushbutton, its implementation is exclusively oriented towards virtual control within the Netsocs ecosystem, providing an intuitive interface for operations that don't require permanent visual state feedback, but simply the reliable execution of a defined action.


πŸ”‘ Key State and Property

A button generally has a simple and static state, such as:

  • ready β†’ Ready to use.

The real magic is in a state property that acts as an event log,
typically a timestamp such as:

  • last_pressed
  • triggered_at

⏱️ The Moment of Pressing

When a user presses the button (physical or digital):

  • The last_pressed property is instantly updated with the current date and time.
  • It doesn't change a persistent state, but rather records a specific event.

πŸ‘€ Detection and Logic

In Netsocs, a rule is configured to observe any changes in last_pressed.

Example:

IF the last_pressed property of the Panic Button object changes... THEN:

Command the Alarm Panel object β†’ in_alarm state

Command the Strobe Light object β†’ turned on


πŸš€ Action Execution

As soon as the rule detects the change, the associated action sequence is executed,
allowing fast and controlled responses.


✨ Key Point

The fundamental difference of the Button object is that it introduces manual and deliberate control
in a system that could be completely automatic.

While sensors allow the system to react to the environment,
buttons give the user the power to direct the system at will.