Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The GetObjectState method returns the state of the object at the moment of method callinvocation.Method call syntax

Syntax for method invocation:

Code Block
languagejavascript
function  GetObjectState(objtype : String, id : String) : String

Method arguments:

  1. objtype - Required is a required argument. The It specifies the type of the system object whose which state is you want to be returned. It takes the following get. Possible values:   Type – String type, range – existing is limited by object types registered in the system.
  2. id - Required is a required argument. Identification It corresponds to the identification (registration) number of the object of the type set in the objtype argument. It takes the following values:  Type – String, range – existing identification numbers of the specified by the objtype argument. Possible values: String type, the range is limited by the identification numbers of objects of the specified type registered in the system.

Usage examples

ProblemExample. When Relay relay 1 activates is enabled (for example, on pressing the button connected to Relay the relay 1), arm Sensor sensor 1. The next time Relay the relay 1 activatesis enabled, disarm Sensor sensor 1.

Code Block
languagejavascript
 if (Event.SourceType == "GRELE" && Event.SourceId == "1" && Event.Action == "ON")
{
  if(GetObjectState("GRAY", "1")=="DISARM")
  {
    SetObjectState("GRAY", "1", "ARM");
  }
  else
  {
    SetObjectState("GRAY", "1", "DISARM");
  }
}


Info
titleNote

Some objects object types can have several states at the same time. For example:  ATTACHED|DISSOLVED DISARMED or ADDEDATTACHED|OFFDISARMED|RECORDER_ON|RECORDRECORDING.