Description of the template elements and attributes#
XML-header#
The header of the file is currently fixed to
Mandatory header
It has to be the first line of the file!
attribute | value | note |
---|---|---|
version | "1.0" | required / fixed value |
encoding | "UTF-8" | required / fixed value |
Root element <Device>#
The root element of the file is currently fixed to
Mandatory element
It must be positioned directly below of the <?xml> header
Allowed Position and Usage:\ Mandatory element. It must be positioned directly below of the Header <?xml> (4.1).
attribute | value | note |
---|---|---|
name | "" | required / fixed value |
template_version | "1.1" | required / fixed value |
<IPBox> element#
This element describes the device type IP relay with http command interface.
Mandatory element
sub-element of the root element <Device>
attribute | value | note |
---|---|---|
template_version | "0" | required / fixed value |
ip_box_is_set | "true" | required / fixed value |
max_relais | Defines the total number of relays embedded into this device. If you do not want to use all of the relays, they can be deactivated later in the Web UI by the user. |
<IP_Adresse> element#
This element describes the IP address of the device.
Mandatory element
Is a required sub-element of the element <IPBox>.
attribute | value | note |
---|---|---|
editable | "true" | Must be set to "true". The user has to enter the correct address. |
gui_is_optional | "false" | Must be "false". This field must not be empty. |
<Port> element#
This element describes the IP port of the device.
Mandatory element
Is a required sub-element of the element <IPBox>.
attribute | value | note |
---|---|---|
editable | "true" | Must be set to "true". The user has to enter the correct address. |
gui_is_optional | "false" | Must be "false". This field must not be empty. |
<Model> element#
This element describes the model name of the device. It will be visible in Devices -> Device wizard in the column “Device Template” and will be copied into the column “Name”. Under “Name”, the copy can be edited by the user.
Mandatory element
Is a required sub-element of the element <IPBox>.
|attribute | note| |---|---|---| |editable | May be set to "true" or "false", Will be ignored! Has no effect in the Web UI. | |gui_is_optional| May be set to "true" or "false", Will be ignored! Has no effect in the Web UI. |
<Company> element#
This element describes the vendor name of the device. It will be visible in Devices -> Device wizard in the column “Device Template”.
Mandatory element
Is a required sub-element of the element <IPBox>.
attribute | note |
---|---|
editable | May be set to "true" or "false", Will be ignored! Has no effect in the Web UI. |
gui_is_optional | May be set to "true" or "false", Will be ignored! Has no effect in the Web UI. |
<Username> element#
This element describes the username used for authentication. Will be used by the functionality of elements <basic_auth> and <digest_auth>. In an url string it can be used by the variable $Username$.
Mandatory element
Is a required sub-element of the element <IPBox>.
attribute | value | note |
---|---|---|
editable | "true" | Must be set to "true". The user has to enter the correct address. |
gui_is_optional | "true" or "false" | May be set to "true", if the device does not require a username. Must be set to "false", if a username is needed by the device. |
<Passwort> element#
This element describes the username used for authentication. Will be used by the functionality of elements <basic_auth> and <digest_auth>. In an url string it can be used by the variable $Passwort$.
Mandatory element
Is a required sub-element of the element <IPBox>.
attribute | value | note |
---|---|---|
editable | "true" | Must be set to "true". |
gui_is_optional | "true" or "false" | May be set to "true", if the device does not require a password. Must be set to "false", if a password is needed by the device. |
<Relays> element#
This element enables the editing of the relay names.
Mandatory element
Is a required sub-element of the element <IPBox>.
attribute | value | note |
---|---|---|
editable | "true" | Must be set to "true". The user may rename the relays. |
gui_is_optional | "false" | Must be set to "false". Every relay needs a name, the field must not be empty. |
<Relay> element#
This element defines the relay position in the data structure and predefines a relay name. <Relay> has to occur several times, until it matches with the number of relays defined in the attribute max_relais of element <IPBox>.
<Relay position="1" status="true">Example Relay 1</Relay>
<Relay position="2" status="true">Example Relay 2</Relay>
<Relay position="3" status="true">Example Relay 3</Relay>
<Relay position="4" status="true">Example Relay 4</Relay>
Mandatory element
Is a required sub-element of the element <Relays>.
attribute | value | note |
---|---|---|
position | Defines the relay enumeration for usage in the url strings later. | |
status | "true" | required / fixed value |
It is recommended to enter a predefined relay name in the element structure!
<Relaytype_CGI> element#
This element defines, that the relay accepts control or/and status commands by an http interface.
Mandatory element
Is a required sub-element of the element <IPBox>.
attribute | value | note |
---|---|---|
is_simple | "true" or "false" | If set to "true", the IP relay has limited capabilities: It has only one embedded relay (max_relais="1") It has one specific url to switch it on (see <http_request name="relay_on"…>) It has another specific url to switch it off (see <http_request name="relay_off"..>) It does not answer to a status query (no element <http_response>). It must not be used with <http_request name="schalte_relay"…> |
editable | "true" or "false" | Must be set to "true" only together with the attribute is_simple="true", if the user is allowed or required to edit the url strings <http_request name="relay_on"…> or <http_request name="relay_off"..>. Otherwise, set to "false" |
gui_is_optional | "true" or "false" | Must be set to "false" only together with the attribute is_simple="true", if the user is allowed or required to edit the url strings <http_request name="relay_on"…> or <http_request name="relay_off"..>. Otherwise, set to "true" |
<basic_auth> element#
This element enables the basic authentication method specified in RFC 7617 before sending commands to the IP relay.
This is a very simple method using standard fields in the HTTP header. If enabled, it uses Username (4.8) and Passwort (4.9) as credentials.
Optional element
- default is "false", if not present.
- sub-element of element <Relaytype_CGI>
Limitation
Must not be used together with the element <Relaytype_CGI> and attribute is_simple="true"!
<digest_auth> element#
This element enables digest authentication method specified in RFC 2617 before sending commands to the IP relay. If enabled, it uses Username and Passwort as credentials.
Optional element
- default is "false", if not present.
- sub-element of element <Relaytype_CGI>
Limitation
Must not be used together with the element <Relaytype_CGI> and attribute is_simple="true"!
<http_request> element#
This element defines the functionality and http method used to send commands to the relay.\
<http_request name="schalte_relay" method="PUT" response_is_in_http_body="false" relay_turn_value_on="true" relay_turn_value_off="false" />
Mandatory element
Is a required sub-element of the element <Relaytype_CGI>.
attribute: name#
Mandatory element
With the definitions here in this field the following http request in the Element
-
Switch the relay on
-
Switch the relay off
-
Retrieve the relay status
name="relay_on" | Limitation: Must be used only together with the <Relaytype_CGI> element and attribute is_simple="true". The following <url_string> is switching the relay on. |
name="relay_off" | Limitation: Must be used only together with the <Relaytype_CGI> element and attribute is_simple="true". The following <url_string> is switching the relay off. |
name="schalte_relay" | Limitation: Must not be used together with the <Relaytype_CGI> element and attribute is_simple="true". The following <url_string> is switching the relay on or off. |
This is triggered in the PBX by a configuration switch or a user request from a telephone.
Before invoking this function, the PBX is updating the future relay status into the variables $Relay_STATUS$ or $Relay_STATUS_X$.
name="relay_status" | Limitation: Must not be used together with the <Relaytype_CGI> element and attribute is_simple="true". The following <url_string> is requesting the current switch status from the relay. |
This function is invoked every 5 seconds. The PBX is updating the relay status into the variables $Relay_STATUS$ or $Relay_STATUS_X$.
attribute: response_is_in_http_body#
Optional element
Default is "true", if not present.
If set to "true", the IP relay replies with the status in the body of the http reply answer.
It is then necessary to add a <http_response> entry with the variables $Relay_STATUS_1$, etc..
If set to "false", the IP relay does not reply with the status. "false" is not allowed in combination with name="relay_status".
attribute: method#
Optional element
Default is "GET", if not present.
The http method to send the url string to the IP relay. Values may be:
- GET
- PUT
- POST
attribute: relay_turn_value_on#
Optional element
Default is "1", if not present. Accepts any string value.
Limitation
Must only be used together with name="schalte_relay" or with name="relay_status".
The string replaces the string "1" from the variables $Relay_STATUS$ or $Relay_STATUS_X$ for switching the relay on when sending the url string to the relay.
And also replaces the string "1" representing the on-state when receiving the relay status.
attribute: relay_turn_value_off#
Optional element
Default is "0", if not present.
Accepts any string value.
Limitation
Must only be used together with name="schalte_relay" or with name="relay_status".
The string replaces the string "0" from the variables $Relay_STATUS$ or $Relay_STATUS_X$ for switching the relay off when sending the url string to the relay.
And also replaces the string "0" representing the off-state when receiving the relay status.
<url_string> element#
This element defines a URL string to send to the IP relay when switching or querying the status.
Mandatory element
Is a required sub-element of the element <http_request>.
This URL string may contain variables:
-
$Username$: the username as defined in the <Username> element
-
$Passwort$: the password as defined in the <Passwort> element
-
$Relay_STATUS$: The status of the relay. When sending a switch commend, this is the desired status. After a status query, this is the actual status. Limitation: Must only be used together with <request_type>just_one_relay_at_a_time</request_type>. The position is then determined by the loop counter.
-
$Relay_STATUS_x$: The status of the relay. When sending a switch commend, this is the desired status. After a status query, this is the actual status. x represents the relay position as defined in the <Relay> element
attribute | value | note |
---|---|---|
editable | "true" or "false" | Must be set to "true" only together with the attribute is_simple="true", if the user is allowed or required to edit the url strings <http_request name="relay_on"…> or <http_request name="relay_off"..>. Otherwise, set to "false" |
gui_is_optional | "true" or "false" | Must be set to "false" only together with the attribute is_simple="true", if the user is allowed or required to edit the url strings <http_request name="relay_on"…> or <http_request name="relay_off"..>. Otherwise, set to "true" |
<request_type> element#
This element defines some special handling, when sending URL strings to certain types of IP relays.
Optional element
- if not present: Default is no special handling enabled.
- sub-element of <http_request>
Limitation
Must not be used together with the <Relaytype_CGI> element and attribute is_simple="true.
content "just_one_relay_at_a_time"#
Some devices with multiple relays allow only to switch or request the status from one relay at a time (e.g. Phillips Hue).
This flag enables to run through <http_request name=”relay status”> in a loop, until the status of all relays is requested.
In this loop, the variables $Relay$ and $Relay_STATUS$ are increased by one to reflect the relay position.
content "just_one_relay_at_a_time_no_fill_ups:#
Special handling implemented initially for Energenie PMS LAN devices. This device is able to receive a switching command for all 4 relays, but not more than one relay at a time may be switched.
These devices require to leave the status of the relays, that are not switched, empty.
Example for Energenie PMS LAN devices. The xml template contains this definition:
<request_type>just_one_relay_at_a_time_no_fill_ups</request_type>
<http_body_request>cte1=$Relay_STATUS_1$&cte2=$Relay_STATUS_2$&cte3=$Relay_STATUS_3$&cte4=$Relay_STATUS_4$</http_body_request>
To switch relay 2 on, this http request string will be sent: cte1;cte2=1;cte3=;cte4=
Info
The status values of the relays, that are not currently switched, are left empty. The previous status of these unchanged relays is not sent in the string!
<http_body_request> element#
This element is enabling the sending of content in the http BODY to the IP relay.
<http_body_request>{
"hue": 50000,
"on":$Relay_STATUS$,
"bri": 200
}
</http_body_request>
Optional element
- default if not present: no http BODY content will be send.
- sub-element of <http_request>
Limitation
- Must not be used together with the <Relaytype_CGI> and attribute is_simple="true".
- Must only be used with <http_request> and method="PUT" or method="POST". method="GET" is not supported!
This content may contain variables:
-
$Username$: the username as defined in the <Username> element
-
$Passwort$: the password as defined in the <Passwort> element
-
$Relay$: the relay position as defined in <Relay> Limitation: Must only be used together with <request_type>just_one_relay_at_a_time</request_type>. The position is then determined by the loop counter.
-
$Relay_STATUS$: The status of the relay. When sending a switch commend, this is the desired status. After a status query, this is the actual status. Limitation: Must only be used together with <request_type>just_one_relay_at_a_time</request_type>. The position is then determined by the loop counter.
-
$Relay_STATUS_x$: The status of the relay. When sending a switch commend, this is the desired status. After a status query, this is the actual status. x represents the relay position as defined in the <Relay> element
<http_response> element#
This element is enabling the receiving of content in the http reply BODY of the IP relay. The reply reflects the status of the relay after switching or a status request. The string in front of the variables is searched for in the response and the variables are expected thereafter. If additional strings are in between of the variables, these strings have to be entered in to the response definition, too.
<http_response use_body="true"><html> $Relay_STATUS_1$ $Relay_STATUS_2$ $Relay_STATUS_3$ $Relay_STATUS_4$ </html></http_response>
Optional element
- default if not present: the reply will be discarded
- sub-element of <http_request>
Limitation
- Must not be used together with the <Relaytype_CGI> and attribute is_simple="true".
- Must only be used with <http_request> and name="schalte_relay" or name="relay_status".
This content may contain these variables:
-
$Relay$: the relay position as defined in <Relay> Limitation: Must only be used together with <request_type>just_one_relay_at_a_time</request_type>. The position is then determined by the loop counter.
-
$Relay_STATUS$: The status of the relay. When sending a switch commend, this is the desired status. After a status query, this is the actual status. Limitation: Must only be used together with <request_type>just_one_relay_at_a_time</request_type>. The position is then determined by the loop counter.
-
$Relay_STATUS_x$: The status of the relay. When sending a switch commend, this is the desired status. After a status query, this is the actual status. x represents the relay position as defined in the <Relay> element
attribute | value | note |
---|---|---|
use_body | "true" or "false" | Must be set to "true" to evaluate and update the status of the relays. A string with variables must be entered to do this. If set to "false" the information in the reply will be discarded. |