Introduction
A sensor can be any type of sensor ranging from a temperature measurer to an snmp device.
Here we will give a small overview of a couple of sensors and how these sensors are being configured through the XML. If you would like to use the Dashboard, then please refer to the following article Sensor Configuration from Scratch.
Furthermore, for a sensor to work, it needs a gateway device to function. If no gateway has been configured, please refer to the Devices page.
We do have a List of approved Sensors, where we will take the examples from.
A physical interface that connects to our system. Depending of its technology, it will be managed by a specific module (for example, a modbus device and a snmp sensor are configured in a different way). When we configure a device, we detail the way in which we connect to it (baud rate, IP, passwords, or whatever information is necessary to connect to it).
Example of a digital input (DI)
Here we have an example of an DI. This snippet has been taken from a configuration of an ADAM-4051, which has 16 DI's and is accessed via ModBusRTU. For the device configuration, please click here.
<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>OFF</true> # the state of the sensor will be OFF. </state_evaluation_expression> <state_evaluation_expression> <expression>value == 1</expression> # If the value equals 1, then <true>ON</true> # the state of the sensor will be ON. </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.
<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>
Next Steps
- Link to Sensor Configuration from Scratch
- Link to Devices
- and more links