...
Code Block |
---|
<component_template config_version="1.0" schema_version="1.0"> <description>template_Adam_4051</description> # This is the general description respectivly the name of the Template. <vendor>azeti</vendor> <version>2</version> <class>multi-sensor</class> <sensors> <sensor sensor_id="DI00"> # This is the name of the sensor as it will be shown in the Dashboard. <sensor_class>boolean</sensor_class> # Sensor class describes the type of measurement, for example boolean, power or temperature. <state_evaluation_expressions> # The etate evaluation allows the definition of differents states which the sensor can get. <state_evaluation_expression> <expression>value == 0</expression> # If the value equals 0, then <true>OK<<true>OFF</true> # the state of the sensor will be OKOFF. </state_evaluation_expression> <state_evaluation_expression> <expression>value == 1</expression> # If the value equals 1, then <true>CRITICAL<<true>ON</true> # the state of the sensor will be CRITICALON. </state_evaluation_expression> </state_evaluation_expressions> <sensor_gateway sensor_gateway_id="ADAM-4051"> # Here the gateway is defined, wwhich is configured under the device section of the XML. <demux> # See the device page for more information. <keys> <key>1</key> # Under demux we define which register from the gateway has to be read. </keys> </demux> </sensor_gateway> </sensor> <sensor sensor_id="DI01"> <sensor_class>boolean</sensor_class> <state_evaluation_expressions> <state_evaluation_expression> <expression>value == 0</expression> <true>OK</true> </state_evaluation_expression> <state_evaluation_expression> <expression>value == 1</expression> <true>CRITICAL</true> </state_evaluation_expression> </state_evaluation_expressions> <sensor_gateway sensor_gateway_id="ADAM-4051"> <demux> <keys> <key>2</key> </keys> </demux> </sensor_gateway> </sensor> . . . <devices> <device device_id="ADAM-4051"> . . . </device> </devices> </component_template> |
Example of reading a holding register, whoose value need to be converted to Bit
Here we have an example of an holding register, which holds an Interger16 (Int16) and thus need to be converted to Bit. This snippet has been taken from a configuration of an AY1020 IO-Link Master, which has 6 IO-Link ports, who retrospecively can hold 16 digital sensors. For the device configuration, please click here.
Code Block |
---|
<component_template config_version="1.0" schema_version="1.0">
<description>template_AY1020</description> # This is the general description respectivly the name of the Template.
<vendor>azeti</vendor>
<version>2</version>
<class>multi-sensor</class>
<sensors>
<sensor sensor_id="AY1020-Port1-Bit0"> # This is the name of the sensor as it will be shown in the Dashboard.
<sensor_class>boolean</sensor_class>
<state_evaluation_expressions>
<state_evaluation_expression>
<expression>value != 1</expression> # If the value does not equal 1, then
<true severity="100">WARNING</true> # change the severity to 100 and change the state to WARNING
<false severity="0">NORMAL</false> # If the statement is false, then change the severity to 0 and change the state to NORMAL
</state_evaluation_expression>
</state_evaluation_expressions>
<sensor_gateway sensor_gateway_id="gw_gw_AY1020-Port1"> # Sensor gateway as defined in the device configuration.
<demux method="int16_to_bool"> # Here we choose the demuxing method, which we will convert from Int16 to boolean.
<keys>
<key>1002</key> # Here we choose the holding register to read from. The AY1020 starts for every port at 1000, 2000, etc.
</keys>
<method_params>
<param id="bit"><![CDATA[0]]></param> # Now we choose which Bit we want to read (In this case Bit 1). Since we have an Int16, we have a maximum of 16 Bits to read from.
</method_params>
</demux>
</sensor_gateway>
</sensor>
<sensor sensor_id="AY1020-Port1-Bit1"> # This is the name of the sensor as it will be shown in the Dashboard.
<sensor_class>boolean</sensor_class>
<state_evaluation_expressions>
<state_evaluation_expression>
<expression>value</expression>
<true severity="100">ON</true>
<false severity="0">OFF</false>
</state_evaluation_expression>
</state_evaluation_expressions>
<sensor_gateway sensor_gateway_id="gw_port1">
<demux method="int16_to_bool">
<keys>
<key>1002</key>
</keys>
<method_params>
<param id="bit"><![CDATA[1]]></param> # Here we choose the second Bit.
</method_params>
</demux>
</sensor_gateway>
</sensor>
</sensors>
.
.
.
<devices>
<device device_id="AY1020-IOLink-Master">
.
.
.
</device>
</devices>
</component_template> |
...