Skip to main content

DeclareAction/Event and EndOfList

note

This page has been automatically translated and has not been reviewed in detail yet. Therefore, the translation might not be completely accurate.

After a request from NeuroomNet via GetActions, a component reports back all known actions and events using DeclareAction/Event. Each message is sent in a separate package and the messages are completed by a special EndOfList package. It is entirely permissible not to report any actions and/or events, only EndOfList is always mandatory.

Report action

{
"command": "DeclareAction",
"description": "Turns off the light in the entire hall.",
"displayName": "Turn off",
"id": "de.insynergie.lights-off",
"parameters": [
{
"array": false,
"description": "Delays execution between each lamp.",
"displayName": "Delay",
"id": "delay",
"required": false,
"type": "Float",
"validation": "{min: 0, max: 5}"
}
]
}

Coding String: DeclareAction<TAB>id<TAB>de.insynergie.lights-off<TAB>displayName<TAB>Turn off<TAB>description<TAB>Turns off the list in the entire hall.<TAB> parameters<TAB>id<TAB>delay<TAB>required<TAB>false<TAB>array<TAB>false<TAB>description<TAB>Delays the execution between the individual lamps.<TAB>displayName<TAB>Delay<TAB >type<TAB>Float<TAB>validation<TAB>{min: 0, max: 5}

Note: The order of the fields does not matter except for parameters, which must always come last. If several parameters are specified, they are separated by a single <TAB>. It is also important to ensure that none of the texts contain a tab - this of course applies in particular to the descriptions and the checking rules. In this sense, the following would also be a valid registration in the String encoding:

DeclareAction<TAB>id<TAB>off<TAB>parameters<TAB>id<TAB>p1<TAB>required<TAB>true<TAB>type<TAB>Float<TAB><TAB>id<TAB>p2< TAB>required<TAB>true<TAB>type<TAB>String

displayName, description and parameters are optional. The id of the action must be unique among all actions in the NeuroomNet context. In larger NeuroomNet installations, for example, it is recommended to include the device/component type to guarantee clarity (such as "de.insynergie.EnvironmentalSensorType0815.Activate").

Note: There may be multiple components that have actions with the same action name, but they should be the same action (executed on different components, usually of the same type). Technically, you can't have the same action name with different parameters because this can lead to strange errors at runtime.

For each parameter in parameters, array, description, displayName and validation are optional. In the list, each id can only appear once and denotes the unique name of the parameter, which is also used when executing via DoAction packages that are the Service reports to the component. This id of the parameter only needs to be unique within the scope of the respective action.

Only Int, Float, Boolean and String are supported as elementary data types type. validation can be used to further restrict the values for the parameter; the rules of the fastest-validator library are used as notation. With array, fields based on elementary data types can also be used.

Report event

Analogous to reporting actions, except that here command must always be DeclareEvent. The component can then report events to the service using DoEvent packages.

Complete messages of a type

{
"command": "EndOfList"
}

Encoding String: EndOfList