Measurement events is a central part of any VSCP system of course. The standardisation of measurement makes it possible to hook in parts to a system and read write measurement values in a deterministic way.
The VSCP server can collect measurements from many sources, it can convert them, send them further to other destinations, save them in databases, diagram data, well, do a lot with the values of measurements.
I show the XML format for setting this up here but the database can be used in the same way.
Every DM configuration row can have a measurement part that looks something like this
<measurement compare="eq" unit="1" value="5.014567" />
If this tag is in a DM row additional checks will be performed on an event before an action is triggered. Here the value of the measurement will be compared to the value 5.014567 for equality and if they are equal AND the unit is the same (here 1) the action will be triggered.
A typical full row for a temperature check will look like
<row enable="true" groupid="measurement_compare_test" > <comment> Test measurement compare: eq </comment> <mask priority="0" class="0xFFFF" type="0xFFFF" GUID=" 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00" /> <filter priority="0" class="10" type="6" GUID=" 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00" /> <action>0x10</action> <param> scripts/alarm.sh "match"%event </param> <index measurementindex="true">1</index> <!-- eq|neq|gt|gteq|lt|lteq --> <measurement compare="eq" unit="1" value="5.014567"/> </row>
Here we have a row that will execute the external script alarm.sh when a temperature event with a temperature given in degrees Celsius (unit=1) is received and the measurement value is equal to 5.014567
As you probably have expected you can do other compares to, like greater than, less than and so on. They are all listed here.
If you want to play further with this you have some test setups here.
More info about the decision matrix in the VSCP server is here and info about general decision matrix logic in VSCP is here.
Stay Hungry, stay foolish!
One reply on “#VSCP howto: Compare values without coding”
[…] Howto we looked at the measurement compares that are available in the decision matrix (DM) record (VSCP HOWTO: COMPARE VALUES WITHOUT CODING). Here we will look at an action that work in a similar equal […]