Using the JSON-RPC protocol that allows remote access to conditions, commands, scenes and rules over HTTP connection.
Method
|
Return Value
|
Parameters
|
Parameter Description
|
HAM/getRule
|
Rule or null if there is no rule with the specified ruleId and applicationId.
|
- ruleId: string
- applicationId: string (optional)
|
- ruleId: string - The ID of the rule.
- applicationId: string (optional) - The ID of the application owning the rule. To get a rule no matter the application it belongs to, pass an empty string for this argument.
|
HAM/getRules
|
Rule[] owned by the specified application and matching the specified filter or null if no rule satisfies the filter.
|
- filter: object
- applicationId: string (optional)
|
- filter: object - A filter containing condition_type, condition_id, command_type, command_id and/or active. These filter attributes narrow down the result of this method. Pass null to get all rules.
- applicationId: string (optional) - The ID of the application owning the rules. To get all rules for all applications, pass an empty string for this argument.
|
HAM/createRule
|
The ID of type string of the created rule. There will be an error will occur if the ruleData doesn't contain the mandatory rule fields.
|
- ruleData: Rule
- applicationId: string (optional)
|
- ruleData: Rule - The rule object. It must contain the mandatory rule fields.
- applicationId: string (optional) - The ID of the application owning the rule. To create a rule common to all applications, pass an empty string for this argument.
|
HAM/setRuleActiveState
|
true if the new active state is set, and false if the specified rule does not exist.
|
- ruleId: string
- active: boolean
- applicationId: string (optional)
|
- ruleId: string - The ID of the rule.
- active: boolean - true to activate the rule and false otherwise.
- applicationId: string (optional) - The ID of the application owning the rule. To target a rule common to all applications, pass an empty string for this argument.
|
HAM/updateRule
|
true if the update is successful, and false if the specified rule does not exist.
|
- ruleId: string
- ruleData: Rule
- applicationId: string (optional)
|
- ruleId: string - The ID of the rule.
- ruleData: Rule - The new data of the rule. It must contain the mandatory rule fields.
- applicationId: string (optional) - The ID of the application owning the rule. To update a rule common to all applications, pass an empty string for this argument.
|
HAM/deleteRule
|
true, when the delete operation is performed successfully, and false if the rule does not exist.
|
- ruleId: string
- applicationId: string (optional)
|
- ruleId: string - The ID of the rule which must be deleted.
- applicationId: string (optional) - The ID of the application owning the rule. To delete a rule common to all applications, pass an empty string for this argument.
|
Method
|
Return Value
|
Parameters
|
Parameter Description
|
HAM/getConditionTypes
|
String[] of condition types. or null if no condition types are available.
|
|
|
HAM/getConditions
|
Condition[] of the requested condition type, or null if conditions of the specified type do not exist.
|
- type: string
- applicationId: string (optional)
|
- type: string - The type of the condition.
- applicationId: string (optional) - The ID of the application owning the conditions. To get all conditions of a specific type for to all applications, pass an empty string for this argument.
|
HAM/getConditionsSimple
|
Condition[] of the requested condition type, or null if conditions of the specified type are not available. The Condition objects in the response will contain the condition_type, condition_id and name (if set) properties plus the properties explicitly requested.
|
- type: string
- props: string[]
- applicationId: string (optional)
|
- type: string - The type of the condition.
- props: string[] - List of condition properties to be included in the response for each condition. The properties condition_type, condition_id and name are always present by default and they should not be included.
- applicationId: string (optional)The ID of the application owning the conditions. To get all conditions of a specific type for to all applications, pass an empty string for this argument.
|
HAM/getCondition
|
Condition or null if there is no such condition in the scope of the specified type. There will be an error if the specified type is invalid.
|
- type: string
- id: string
- applicationId: string (optional)
|
- type: string - The type of the condition.
- id: string - The ID of the condition.
- applicationId: string (optional) - The ID of the application owning the conditions. To get all conditions of a specific type for to all applications, pass an empty string for this argument.
|
HAM/getConditionSimple
|
Condition or null if the condition is not present. The Condition object in the response will contain the condition_type, condition_id and name (if set) properties plus the properties explicitly requested. There will be an error in case the specified type is invalid.
|
- type: string
- id: string
- props: string[]
- applicationId: string (optional)
|
- type: string - Type of the conditions
- id: string - The ID of the condition
- props: string[] - List of condition properties to be included in the response. The properties condition_type, condition_id and name are always present by default and there is no need to include them in this parameter.
- applicationId: string (optional) - The ID of the application owning the conditions. To get all conditions of a specific type for to all applications, pass an empty string for this argument.
|
HAM/getAllConditions
|
Condition[] of all available conditions of all types of a specific application or null if there are no conditions.
|
- applicationId: string (optional)
|
- applicationId: string (optional) - The ID of the application owning the conditions. To get all conditions of a specific type for to all applications, pass an empty string for this argument.
|
HAM/getAllConditionsSimple
|
Condition[] of all available conditions of all types or null if there are no conditions. The Condition objects in the response will contain the condition_type, condition_id and name (if set) properties plus the properties explicitly requested.
|
- props: string[]
- applicationId: string (optional)
|
- props: string[] - List of condition properties to be included in the response for each condition. The properties condition_type, condition_id and name are always present by default.
- applicationId: string (optional) - The ID of the application owning the conditions. To get all conditions of all applications, pass an empty string for this argument.
|
HAM/deleteCondition
|
true if the delete operation is successful, and false if the condition does not exist.
|
- type: string
- id: string
- applicationId: string (optional)
|
- type: string - The type of the condition.
- id: string - The ID of the condition.
- applicationId: string (optional) - The ID of the application owning the conditions. To delete a condition not belonging to a concrete application, pass an empty string for this argument.
|
HAM/createCondition
|
The ID of type string of the created condition. There will be an error if conditonData doesn't contain the mandatory condition fields.
|
- type: string
- conditionData: object
- applicationId: string (optional)
|
- type: string - The type of the new condition.
- conditionData: object - The new condition's data. It must contain mandatory condition fields.
- applicationId: string (optional) - The ID of the application owning the conditions. To create a condition common to all applications, pass an empty string for this argument.
|
HAM/updateCondition
|
true if the update is successful, or false if the condition does not exist. There will be an error if conditionData does not contain the mandatory condition fields or the type is not available.
|
- type: string
- id: string
- conditionData: object
- applicationId: string (optional)
|
- type: string - The type of the condition.
- id: string - The ID of the condition.
- conditionData: object - The new condition's data. It must contain mandatory condition fields.
- applicationId: string (optional) - The ID of the application owning the conditions. To update a condition not belonging to a concrete application, pass an empty string for this argument.
|
HAM/triggerCondition
|
true if the condition is triggered successfully, and false otherwise.
|
- type: string
- id: string
- applicationId: string (optional)
|
- type: string - The type of the condition.
- id: string - The ID of the condition.
- applicationId: string (optional) - The ID of the application owning the conditions. To target a condition not belonging to a concrete application, pass an empty string for this argument.
|
Method
|
Return Value
|
Parameters
|
Parameter Description
|
HAM/getCommandTypes
|
String[] of command types or null if no command types are available.
|
|
|
HAM/getCommands
|
Command[] of the requested command type or null if commands of the specified type are not available in the scope of the application.
|
- type: string
- applicationId: string (optional)
|
- type: string - The type of the commands.
- applicationId: string (optional) - The ID of the application holding commands. To get the commands of a certain type of all applications, pass an empty string for this argument.
|
HAM/getCommandsSimple
|
Command[] of the specified application and of the requested command type, or null if commands of the specified type are not available for the specified application. The Command objects in the response will contain the command_type, command_id, application (if set) and name (if set) properties plus the properties explicitly requested.
|
- type: string
- props: string[]
- applicationId: string (optional)
|
- type: string - The type of the command.
- props: string[] - List of command properties to be included in the response for each command. The properties command_type, command_id and name are always present by default.
- applicationId: string (optional) - The ID of the application owning the commands. To get the commands of a certain type of all applications, pass an empty string for this argument.
|
HAM/getCommand
|
Command of the specified application or null if there is not such a command in the scope of the specified type or application. There will be an error in case of invalid type.
|
- type: string
- id: string
- applicationId: string (optional)
|
- type: string - The type of the command.
- id: string - The ID of the command.
- applicationId: string (optional) - The ID of the application owning the command. To get a command not belonging to an application, pass an empty string for this argument.
|
HAM/getCommandSimple
|
Command of the specified application or null if the command is not present. The Command object in the response will contain the command_type, command_id, application (if set) and name (if set) properties plus the properties explicitly requested. There will be an error in case of the type is not available.
|
- type: string
- id: string
- props: string[]
- applicationId: string (optional)
|
- type: string - The type of the command.
- id: string - The ID of the command.
- props: string[] - List of command properties to be included in the response for each command. The properties command_type, command_id and name are always present by default.
- applicationId: string (optional) - The ID of the application holding the command. To get a command not belonging to an application, pass an empty string for this argument.
|
HAM/getAllCommands
|
Commands[] of all available commands of all types of a specified application, or null if there are no defined commands.
|
- applicationId: string (optional)
|
- applicationId: string (optional) - The ID of the application owning the commands. To get all commands of all applications, pass an empty string for this argument.
|
HAM/getAllCommandsSimple
|
Command[] of all available commands of all types of the specified application, or null if there are no defined commands of the application. The Command objects in the response will contain the command_type, command_id, application (is set) and name (if set) properties plus the properties explicitly requested.
|
- props: string[]
- applicationId:string (optional)
|
- props: string[] - List of command properties to be included in the response for each command. The properties command_type, command_id, application and name are always present by default.
- applicationId:string (optional) - The ID of the application owning the commands. To get all commands of all applications, pass an empty string for this argument.
|
HAM/deleteCommand
|
true if the delete operation is successful, and false if the specified command does not exist.
|
- type: string
- id: string
- applicationId: string (optional)
|
- type: string - The type of the command.
- id: string - The ID of the command.
- applicationId: string (optional) - The ID of the application owning the command. To delete a command not belonging to a specific application, pass an empty string for this argument.
|
HAM/createCommand
|
The ID of type string of the created command. There will be an error if commandData does not contain the mandatory command fields.
|
- type: string
- commandData: object
- applicationId:string (optional)
|
- type: string - The type of the new command.
- commandData: object - The new command's data. It must contain the mandatory command fields.
- applicationId:string (optional) - The ID of the application to own the command. To create a command common to all applications, pass an empty string for this argument.
|
HAM/updateCommand
|
true if the update is successful, or false if no such command is found. There will be an error if commandData does not contain the mandatory command fields.
|
- type: string
- id: string
- commandData: object
- applicationId: string (optional)
|
- type: string - The type of the command.
- id: string - The ID of the command.
- commandData: object - The new command's data. It must contain the mandatory command fields.
- applicationId: string (optional) - The ID of the application owning the command. To update a command common to all applications, pass an empty string for this argument.
|
HAM/runCommand
|
true if the command of the specified application is executed successfully, and false if the command is not available. There will be an error if the execution fails.
|
- type: string
- id: string
- applicationId: string (optional)
|
- type: string - The type of the command.
- id: string - The ID of the command.
- applicationId: string (optional) - The ID of the application owning the command. To run a command common to all applications, pass an empty string for this argument.
|
HAM/runWithProps
|
true if the command is executed of the specified application, and false if the command is not available. There will be an error if the execution fails.
|
- type: string
- id: string
- props: object
- applicationId: string (optional)
|
- type: string - The type of the command.
- id: string - The ID of the command.
- props: object - The properties to the command as a JavaScript object.
- applicationId: string (optional) - The ID of the application owning the command. To run a command common to all applications, pass an empty string for this argument.
|
HAM/sceneControl
|
true if the execution is performed, or false if the scene is not available or the action is not supported. There will be an error if the execution fails.
|
- id: string
- action: string
- applicationId: string (optional)
|
- id: string - The ID of the scene command.
- action: string - The action to perform on the scene, can be "start", "stop", "pause", "resume" or "quickRun".
- applicationId: string (optional) - The ID of the application owning the scene. To locate a scene common to all applications, pass an empty string for this argument.
|
HAM/getSceneState
|
int value corresponding to the state of the specified scene. There will be an error if the scene does not exist. The scene stats are: IDLE = "0", RUNNING = "1", INTERRUPTED = "2" and PAUSED = "3".
|
- id: string
- applicationId: string (optional)
|
- id: string - The ID of the scene command.
- applicationId: string (optional) - The ID of the application owning the scene. To get the state of a scene common to all applications, pass an empty string for this argument.
|
Object
|
Field
|
FIeld Description
|
Supported JSON Types
|
-
|
string, number, object, array, true, false, null. We use boolean when we have true or false. Number can be used to represent int and double.
|
HAObject
|
- name: string
- internal: boolean
|
- name: string - User-friendly name of the rule, command or condition.
- internal: boolean - Optional property that will be set if the rule, condition or command is internal.
|
Rule (extends HAObject)
|
- condition_type: string
- condition_id: string
- command_type: string
- command_id: string
- active: boolean
- properties: object
- rule_id: string
|
- condition_type: string - The type of the associated condition. Mandatory property.
- condition_id: string - The ID of the associated condition. Mandatory property.
- command_type: string - The type of the associated command. Mandatory property.
- command_id: string - A flag to indicate that the rule is active or not. Optional property, if not specified the default value is true.
- properties: object - Optional properties, that are used to pass parameters to the start() method.
- rule_id: string - The ID of the rule.
|
Condition (extends HAObject)
|
- condition_type: string
- condition_id: string
- usedInRules: string []
|
- condition_type: string - The type of the condition.
- condition_id: string - The ID of the condition.
- usedInRules: string [] - Optional field with the list of rule IDs where the command is used.
|
Command (extends HAObject)
|
- command_type: string
- command_id: string
- usedInRules: string []
- usedInScenes: string []
|
- command_type: string - The type of the command.
- command_id: string - The ID of the command.
- usedInRules: string [] - Optional field with the list of rule IDs where the command is used.
- usedInScenes: string [] - Optional field with the list of scene IDs where the command is used.
|
Scene (extends Command)
|
- state: number
- command_count: string []
- 0..n: SceneCommand
|
- state: number - State of the scene: "0" - idle, "1" - running, "2" - interrupted, "3" - paused.
- command_count: string [] - The number of SceneCommand objects in this scene. Each command is set into the scene as an "index" property with key from "0" to (command_count-1).
- 0..n: SceneCommand - SceneCommand is an object defining a reference to a command which will be executed by the Scene. It is described in SceneCommand object definition.
|
SceneCommand
|
- delay
- enabled: boolean
- command_type: string
- command_id
|
- delay - The time delay from the previous command execution.
- enabled: boolean - When it is false the command will be skipped.
- command_type: string - The command type, which must be executed by the SceneCommand.
- command_id - The command ID, which must be executed by the SceneCommand.
|
Group (extends Command)
|
- command_count: string []
- 0..n:GroupCommand
|
- command_count: string [] - The number of GroupCommand objects in this group. Each GroupCommand is set into Group as an "index" property with key from "0" to (command_count-1)
- 0..n:GroupCommand - GroupCommand is an object defining a reference to a command which will be executed by the Group. It is described in GroupCommand object definition.
|
GroupCommand
|
- enabled: boolean
- command_type: string
- command_id
|
- enabled: boolean - When it is false the command will be skipped.
- command_type: string - The command type which must be executed by the Group.
- command_id - The command ID which must be executed by the Group.
|
Timer (extends Condition)
|
|
- startTime: number - This is the configuration property that stores the start time. It's type is long and stores the time in milliseconds.
|
AbsoluteTimer (extends Timer)
|
|
|
PeriodicTimer (extends Timer)
|
- endTime: number
- repeatCount: number
- hour: number
- minute: number
- seconds: number
|
- endTime: number - Optional property that stores the end time when the condition will be stopped. It's type is long and stores the time in milliseconds.
- repeatCount: number - This property contains the repeat count. It's type is int and shows the number of times, that the timer should be executed.
- hour: number - This property stores the hour that specifies the execution time or interval of the periodic event. It's type is int.
- minute: number - This property stores the minute that specifies the execution time or interval of the periodic event. It's type is int.
- minute: number - This property stores the seconds that specifies the execution time or interval of the periodic event. It's type is int.
|
IntervalTimerCondition (extends PeriodicTimer)
|
|
|
DailyTimer (extends PeriodicTimer)
|
|
- days: boolean[] - Sets the days at which the timer is active. The index in the array means the day of the week: "0" - Sunday, "1" - Monday, "2" - Tuesday, "3" - Wednesday, "4" - Thursday, "5" - Friday, "6" - Saturday.
|
DailyPeriod (extends DailyTimer)
|
- endPeriodHour: number
- endPeriodMinute: number
- endPeriodSeconds: number
|
- endPeriodHour: number - This property stores hour of end timer of DailyPeriod timer.
- endPeriodMinute: number - This property stores the minute of end timer of DailyPeriod timer.
- endPeriodSeconds: number - This property stores the second of end timer of DailyPeriod timer.
|
AstroTimer (extends DailyTimer)
|
- latitude: number
- longitude: number
- tz: string
- before: boolean
- sunset: boolean
|
- latitude: number - This property contains the latitude of AstroTimer.
- longitude: number - This property contains the longitude of AstroTimer.
- tz: string - This property contains the time zone of AstroTimer.
- before: boolean - This property shows is the AstroTimer will be trigger before or after sunrise/sunset.
- sunset: boolean - This property defines if the time of AstroTimer is relative to the sunrise or sunset.
|
NthDayTimer (extends PeriodicTimer)
|
- intevalType: number
- day: number
|
- intevalType: number - The configuration property that is used to store the interval type. It's type is int. Can be "1" - Week, "2" - Month, "3" - Year.
- day: number - Day of week, month or year, depending on the interval type.
|
LogicCondition (extends Condition)
|
- expression: string
- 0..n: object
|
- expression: string - The property contains logic expression of the LogicCondition. The expression must have LDAP syntax where the property names are indexes of participating conditions and values are boolean values corresponding to their satisfied status.
- 0..n: object - Each object contains a condition description. The condition description consists of "condition_type" and "condition_id" properties.
|
EventCondition (extends Condition)
|
- topic: string
- filter: string
|
- topic: string - The event topic.
- filter: string - The event filter.
|
EventCommand (extends Command)
|
- topic: string
- properties: object
- sync: boolean
|
- topic: string - The event topic of the event that will be fired by the Event Command.
- properties: object - The event properties which will be added to the fired event.
- sync: boolean - To publish the events in synchronous (when "true") or asynchronous (when "false") manner.
|
LogCommand (extends Command)
|
- message: string
- log_level:number
- log_print_properties:boolean
- print_on_console:boolean
- print_on_log:boolean
|
- message: string - The log message.
- log_level:number - The log level (0..4) which has to be use to log the message.
- log_print_properties:boolean - When it is true the parameters passed to the LogCommand is logged too.
- print_on_console:boolean - When it is true the message is printed on the system console.
- print_on_log:boolean - When it is true the message is logged on the system log.
|
RuleStateCommand(extends Command)
|
- rule_id: string
- active_state:boolean
|
- rule_id: string - The ID of the rule which state will be changed.
- active_state:boolean - The active state of the selected rule. When it is true the rule will be activated.
|
FilterRuleStateCommand(extends Command)
|
- filter: string
- active_state:boolean
|
- filter: string - An LDAP filter selecting rules to which the command will be applied.
- active_state:boolean - The active state of the selected rules. When it is true the rules will be activated.
|