Category Archives: VSCP

#VSCP HOWTO: DM Using timers

Timers. One can wonder what they do in the decision matrix? They even have their own events defined in the CLASS2.VSCP class.

First let us define what a VSCP timer is.

A VSCP timer is a free running 32-bit timer with millisecond resolution.  That is they can hold  0xffffffff = 4294967295 milliseconds which mens they will roll over in about 50 days.

There are actions defined to

There is the following  internal events defined related to timers

To create and start a timer

<row enable="true" groupid="timers" >

  <comment>
    Create timer
  </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="65535"
          type="23"
 GUID="00:01:02:03:04:05:06:07:08:09:0A:0B:0C:0D:0E:0F" />

  <action>0x60</action>
  <param>
    1;10;timer1flag;true
  </param>

</row>

Here a timer with id = 1 is created. The timer has an initial time set to 10 seconds. When this timer elapses it will set the variable //timer1flag// to true. The last argument is the reload flag. Here it is set to true so when the time has elapsed the initial value will be loaded again and the timer will start again.

In the example above we could have added “;4” at the end of the parameter which would have the effect that the reload would stop after four runs. Default is thus forever.

When the timer is started a CLASS2.VSCPD, Type = 25 (0x0019) Timer started event is generated. When the ten seconds has gone and the timer elapses the  CLASS2.VSCPD, Type = 29 (0x001D) Timer Elapsed event is generated.

We can use either one of these two generated events to do any action periodically like this.

<row enable="true" groupid="timers" >

  <comment> 
    Handle timer elapsed
  </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="65535"
          type="29"
 GUID="00:01:02:03:04:05:06:07:08:09:0A:0B:0C:0D:0E:0F" />

  <action>0x70</action>
  <param>
    /srv/vscp/timefile;1;%isoboth: Timer with  id=%event.data.int32[0] elapsed %lf
  </param>

</row>


<row enable="true" groupid="timers" > 

   <comment> Handle timer elapsed </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="65535" 
            type="25" GUID="00:01:02:03:04:05:06:07:08:09:0A:0B:0C:0D:0E:0F" /> 

    <action>0x70</action> 
    <param> 
      /srv/vscp/timefile;1;%isoboth: Timer with id=%event.data.int32[0] elapsed counter=%event.data.uint32[0]ms %lf </param> </row>

Here some info is just written to a file when the timer is started and when it elapses.   But if you want to send an event periodically instead or do other actions this is the way to do it.

You don’t have to give a variable nor a reload flag when you start a timer. If no variable is given (use ;;) it is just ignored. The reload value will be set to false as default  value, that is the timer will run only once. As the last parameter you can set the number of times the timer should reload before it should stop.  The full documentation is here and here.

One useful use of timers is to handle resend of events. The working is like this

Send the event you expect a reply event from another node.

  1. Create/start a timer that have  period equal to resend intervals for the event you want to send. The timer should  have true for autoloading and the number of autoloads set to the number of resend that are allowed.  You can trigger the creation of the timer  by make a DM entry that triggering on one of the reserved events for example,  CLASS1.LOCAL  or CLASS1.LABORATORY so that when you send this local event  the actual event will be sent (see next point)
  2. In the timer started event send  the event you want to send.
  3. When/If the expected reply  is received pause the timer.
  4. Now if the timer the timer stopped event is detected the reply wait timeout has expired so do timeout handling there by sending another local event or CLASS1.ERROR, Type = 32 Time out.

Can be used for much more of course. Just useful and simple.

#VSCP HOWTO: DM write/append to file

The Level I logger and the Level II logger are great tools for logging events in a VSCP based system.  Useful also for debugging etc. Another method is to use the execute external program action and execute a script and write to a file there. We have seen this method being used in other howtos.  Also while running a JavaScript or a Lua script files can be written.

But…

file writing is also available as an action.  It is documented here. This action allows writing or appending a string with output to a named file that is created if it does not exist. With the VSCP escapes a lot of dynamic information can go into this file.

Suppose that we want to  log events of a certain type to a file, here CLASS1.DATA, Type=2 A/D values form a specific device. We then write a decision matrix (DM) row

<row enable="true" groupid="" >

<comment>
 Collect A/D values from node X
</comment>

<mask priority="0"
 class="0xFFFF"
 type="0xFFFF"
 GUID="FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF:FF" />

<filter priority="0"
 class="15"
 type="2"
 GUID="00:01:02:03:04:05:06:07:08:09:0A:0B:0C:0D:0E:0F" />

<action>0x70</action>
 <param>
 /tmp/addata;1;%isoboth: %measurement.string %lf 
 </param>

</row>

will generate output content like this

With the other VSCP escapes and literals you have many options to generate meaningful output.

 

#VSCP HOWTO: DM Send events

In a previous howto we looked at how to link server interfaces. Sometimes it is not necessary to establish a full link but just send an event to the rest of the system.  A typical example on this can be when an event comes in that signals a special state and you what the system to go perform other steps. Here you can send out the events needed to perform those steps.

There are currently three actions defined for this in the VSCP server

Send event

VSCP_DAEMON_ACTION_CODE_SEND_EVENT    0x40/64

This actions sends out a specified event and optionally set a boolean variable to true if the send was successful.  The full documentation is here.

If for example you want to send the event CLASS1.INFORMATION, Type=3, ON every second you can use

<row enable="true" groupid="Send event">

<comment>
 Periodic event
 Send CLASS1:INFORMATION, Type=3 ON event every second
 </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="65535"
 type="5"
 GUID=" 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00" />

<action>0x40</action>
 <param>
 0,20,3,0,,,0:1:2:3:4:5:6:7:8:9:10:11:12:13:14:15,0,1,35
 </param>

</row>

Send event conditional

VSCP_DAEMON_ACTION_CODE_SEND_EVENT_CONDITIONAL    0x41/65

This action works much as the previous action. The difference is that it just send the event if a named VSCP remote variable is true.  The full documentation is here.

If you like in the example above want to send the event CLASS1.INFORMATION, Type=3, ON every second you can use

<row enable="true" groupid="Send event conditional" >

<comment>
 Create variable that hold flag for sent event
 when the server is started ( CLASS2.VSCPD, Type=23 ).
 </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="65535"
 type="23"
 GUID=" 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00" />

<action>0x50</action>
 <param>
 bsent;bool;false;0;0x777;false
 </param>

</row>
 
 <row enable="true" groupid="Send event conditional" >

<comment>
 Create variable that hold flag send conditional event
 when the server is started ( CLASS2.VSCPD, Type=23 ).
 </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="65535"
 type="23"
 GUID=" 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00" />

<action>0x50</action>
 <param>
 bevent;bool;false;0;0x777;false
 </param>

</row>
<row enable="true" groupid="Send event conditional">

<comment>
Send event conditional
Send CLASS1:INFORMATION, Type=3 ON event
</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="65535"
type="5"
GUID="00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00" />

<action>0x41</action>
<param>
bevent;0,20,3,0,,,0:1:2:3:4:5:6:7:8:9:10:11:12:13:14:15,0,1,35;bsent
</param>

</row>

The difference from the previous example is the introduction of the bEvent remote variable. This variable is initialized to false so before it is set to true no events will be sent.  We can look at the variable sin the admin web interface

Setting it to true

make the action trigger and the event is sent once a second while the bEvent variable is set to true.

 

 

Send event(s) from file

The last send event action send one or more events from a file instead of having them specified in the action parameter. This makes it possible to send several events from one trigger.  A typical scenario could be to trigger on button press and set a scene by presetting lamps and other things which will be set by the sent out list of events,

This action is fully specified here.  The file for the events to send out is XML based.  Apart from that it should be easy to set up from the documentation.

The events defined here in a file called sendevents simulate setting a scenario.

<events>

<event>
 <!-- 
 CLASS1.CONTROL, Type=5 TurnOn
 Turn on lamps in zone=1, subzon=0
 -->
 <head>0</head>
 <class>30</class>
 <type>5</type>
 <guid>00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00</guid> 
 <data>0,1,0</data>
 </event>

<event>
 <!-- 
 CLASS1.CONTROL, Type=5 TurnOn
 Turn on lamps in zone=1, subzon=0
 -->
 <head>0</head>
 <class>30</class>
 <type>5</type>
 <guid>00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00</guid> 
 <data>0,1,2</data>
 </event>

<event>
 <!-- 
 CLASS1.CONTROL, Type=5 TurnOn
 Turn on lamps in zone=1, subzon=22
 -->
 <head>0</head>
 <class>30</class>
 <type>5</type>
 <guid>00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00</guid> 
 <data>0,1,22</data>
 </event>

<event>
 <!-- 
 CLASS1.CONTROL, Type=5 TurnOn
 Turn on lamps in zone=1, subzon=240
 -->
 <head>0</head>
 <class>30</class>
 <type>5</type>
 <guid>00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00</guid> 
 <data>0,1,240</data>
 </event>

<event>
 <!-- 
 CLASS1.CONTROL, Type=6 TurnOff
 Turn off head light lamps in zone=1, subzon=1
 -->
 <head>0</head>
 <class>30</class>
 <type>6</type>
 <guid>00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00</guid> 
 <data>0,1,1</data>
 </event>

<event>
 <!-- 
 CLASS1.CONTROL, Type=20 Dim lamp(s)
 Dim lamps in zone=1, subzon=0 at 30%
 -->
 <head>0</head>
 <class>30</class>
 <type>20</type>
 <guid>00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00</guid> 
 <data>30,1,0</data>
 </event> 
 
</events>

A DM that sets this scenario every minute looks like this

<?xml version = "1.0" encoding = "UTF-8" ?>

<dm>

<row enable="true" groupid="Send events from file" >

<comment>
 Send events in list sendevents 
 when the server is started ( CLASS2.VSCPD, Type=23 ).
 </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="65535"
 type="6"
 GUID="00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00" />

<action>0x42</action>
 <param>
 /srv/vscp/sendevents
 </param>

</row>
 
 
</dm>

And running it we see in VSCP works that the events get sent

 

You can find sample files for tests here.

#VSCP HOWTO: DM Check measurement

In another 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 manner.

The check measurement action

VSCP_DAEMON_ACTION_CODE_CHECK_MEASUREMENT

is defined to make it possible to check a measurement against a literal value and just as we described in the howto about the check variable actions it stores the logical outcome of the compare in a boolean remote variable.

Also here equal to, less than, greater than etc is available.  A typical parameter row can look like this

0;0;99.5;gt;flag

This says that if a measurement comes in that have a value that is greater than 99.5 the remote variable “flag” will be set to true. In all other cases “flag” will be set to “false”.  The “0;0” that is the first two values of the parameter line is  unit and sensor index. In this case the measurement therefore must have unit=0 and sensor index = 0 as well for the test to be evaluated at all.

A complete example is available in the documentation of the action. You can find pre written samples here.

As a note. Instead of a literal value for the compare you can use another variable.  The parameter above can be rewritten

0;0;%variable:[critical_value];gt;flag

and instead of the literal “99.5” the value of the remote variable 99.5 is used for the compare.  VSCP DM escapes are evaluated before an action is carried out. There is many of them and they can be very useful when you want to make decision matrix rows act in a more dynamic way without go so far as to use full JavaScript or Lua.  You can read more about the VSCP DM escapes here.

It isn’t harder than that actually.

#VSCP HOWTO: DM – Check variables – store result

A common operation handling flowing data and measurements  is to compare results and the decision matrix (DM) has plenty of functionality built-in for this. Here we will look at three of the actions available for this.

They are

Check variable, set variable
VSCP_DAEMON_ACTION_CODE_CHECK_VARIABLE
Check variable, set to true
VSCP_DAEMON_ACTION_CODE_CHECK_VARIABLE_TRUE
Check variable, set to false
VSCP_DAEMON_ACTION_CODE_CHECK_VARIABLE_FALSE

What they all do is to compare (less than, greater than equal etc) a literal value with the content of a remote variable  and they

Check variable, set variable

This action check the value of a variable against a literal and the set the named boolean remote variable to the outcome of the logic operation. So

3.14;eq;pi;myflag

will set the remote variable myflag to true if the remote variable pi is equal to 3.14 (false otherwise) and

32;lt;temp;alarm

will set the boolean remote variable alarm to true when the remote variable alarm have a value that is greater than 32 and to false otherwise.. The last will look like this in its complete form

<row enable="true" groupid="Variable compare" >

<comment>
 Test the variables tamp if its greater than 32 
 every second
</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="65535" 
 type="5" 
 GUID=" 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00" />

<action>0x58</action>
 <param>
 32;lt;temp;alarm
 </param>

</row>

Check variable, set to true

This is just a variant of the above. Instead of the result of the logical compare true is always stored when the calculated result is true.

So the example above

32;lt;temp;alarm

will no actually do the same as before. If the result is true it stores true and false if not.

Check variable, set to false

Another variant of the same. Instead of the result of the logical compare false is always stored when the calculated result is true.

So for the example above

32;lt;temp;alarm

alarm will be false when temp is greater than 32 and vice versa.

————————————————————————————

Some ready-made test code is available here.

 

.

#VSCP HOWTO: Min/max

Quite often one want to store min and max for measurement values  So of course you can do that with the VSCP server just by adding a row to the decision matrix.

The first thing you need is a remote variable to store the min/max in. You can add this remote variable to the variable xml file so it is created when the system starts or add it as a persistent variable to the database. Another way is to create the variable when the server starts right is the DM. We  use the last method here as it is makes things clearer in this how-to.

You can create a remote variable minimum and another maximum with the following two DM rows which triggers on the CLASS2.VSCPD, Type=23 Starting up  which is feed to the DM once when the VSCP server is started. .

<row enable="true" groupid="Min/max" >

<comment>
 Create variable that hold min
 when the server is started 
 ( CLASS2.VSCPD, Type=23 ).
 </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="65535"
 type="23"
 GUID=" 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00" />

<action>0x50</action>
 <param>
 minimum;float;false;0;0x777;9999999;BASE64:test min
 </param>

</row>
 
 <row enable="true" groupid="Min/max" >

<comment>
 Create variable that hold min
 when the server is started ( CLASS2.VSCPD, Type=23 ).
 </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="65535"
 type="23"
 GUID=" 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00" />

<action>0x50</action>
 <param>
 maximum;float;false;0;0x777;-999999;BASE64:test max
 </param>

</row>

Here the  minimum variable is created as a non-persistent variable (it will not hold its value between sessions), it is created as a float and initiated to a “very high” value (9999999), The maximum variable is also created as a float and initiated to a “very low” number (-999999).

You can read more about the store remote variable action here.

The values for the minimum and maximum variables is selected so that minimum is initiated to a value that is higher than what is expected to be a lowest value that will be received by the system and the same for the maximum but the other way around.

So no we have the two variables. Suppose we now want to check the maximum and minimums for a temperature.  This means that we will look for a measurement event  with type = 6 temperature.  I write “measurement event” here as they come in a couple of flavors.  A DM row  like the following will handle the collection of minimum data

<row enable="true" groupid="Min/max" >

<comment>
 Test for minimum
 </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>0x71</action>
 <param>
 minimum;1;1
 </param>

</row>

Here we filter on CLASS1.MEASUREMENT, Type=6 temperature (class=10, type=6) from any sensor (we normally should have selected on by entering a GUID for it).  The action 0x71 is the

VSCP_DAEMON_ACTION_CODE_STORE_MIN

and it will store the temperature value of the incoming VSCP event if it is lower than the value currently stored in the remote variable minimum. The 1,1 after the variable name  in the parameter says that the measurement should have unit=1 (Celsius in this case) and originate from sensor with index=1 on the remote node,

For the maximum the DM row looks like

<row enable="true" groupid="Min/max" >

<comment>
 Test for maximum
 </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>0x72</action>
 <param>
 maximum;1;1
 </param>

</row>

The functionality is the same except that the

VSCP_DAEMON_ACTION_CODE_STORE_MAX

action is used here which compares the names variable for a highest value instead of a lowest value.

That it. We now have to variables maximum and minimum that  holds the maximum and minimum values for the temperature. We can read (and write) this value in all the interfaces, tcp/op, websocket, mqtt, REST etc and use it for other calculations or present it in a UI. With websocket this presentation is actual trivial using one of the ready-made widgets.

Also not that this work s for all measurement units (that is all SI defined and derived units)  in the same way.  No coding needed.

One last thing. Suppose you want to daily maximum/minimum instead of an all time maximum/minimum.  Easy

Add a DM row that triggers on

CLASS2.VSCPD, Type=9 Midnight

and store  the “very low”/”very high” value to the minimum. It is harder than that. In the same way you can do this on a weekly, monthly etc basis.

You can also use the escapes to  create a more dynamic variable that store the daily minimum/maximum. Try a store in variable

minimum-%isodate;float;true;0;0x777;%variable:[minimum]

which is set to trigger just before midnight. What you get here is a remote variable minimum-YYMMDD  where YYMMDD is the current date that is persistent and holds the value of the minimum remote variable collected for that date.

Try that with the rest..

 

#VSCP Howto: Linking server interfaces

The tcp/ip interface

This howto describes linking of VSCP server interfaces. With a server  interface we mean the VSCP tcp/ip control interface and especially the the VSCP link interface which is the required  tcp/ip commands that all VSCP nodes exporting a VSCP interface must make available. You find the full list here.

A VSCP server has an extended command set that can handle many special task needed on a full server. An embedded node however often just need the more limited set of commands but can of course add any other commands it like to export available if needed.

Why link servers

Why link servers one may ask. There can be many reasons for this Security can be one. You may link a VSCP server to a higher end server with just event going upwards not downwards and by that  prevent security threats as it will be impossible for the upward server to send events to the lower server. A typical scenario fr this is a server that show public data to an audience but where the source for the data is a real world system.

You maybe also just want to collect events from many subnets on a higher end server or some type of events on a special server.

Even more common is connections with lower end nodes that implement the tcp/ip interface and where you want to contact them from a server, to collect data, configure, control, instead  of the other way around.

How

There are many ways to do this. You can make a special driver. Make JavaScript or Lua scripts that handle this. Build your own application that acts as middleware. But there are of course read made tools available to.

If you want a connection from/to a remote node that is always active, yes it will be maintained, automatically bring up the link if it falls, the tcp/ip link driver is the solution. It lets you set up a link between two machines where one is a VSCP server and where the other machine also can also be a VSCP server but more usually is a lower end node exporting a VSCP tcp/ip interface.  The driver is extremely simple to use. Just add it, setup user connection data and set filters for outgoing and incoming events.  The tcp/ip link driver is described in full detail here. 

If you need to share a smaller selection of events with a remote node or just want to send events to a remote node when special things happen, or just want to filter events very hard, the decision matrix has an action that let you send events to a tcp/ip remote link interface.

Send event to remote host action

Its is the

VSCP_DAEMON_ACTION_CODE_SEND_TO_REMOTE    0x43/67

action that is used for remote connections. A typical DM entry looks like this

<row enable="true" groupid="send_remote_test" >

<comment>
 Test action send event
 </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>0x43</action>
 <param>
 192.168.1.6;9598;admin;secret;%event
 </param>

<index measurementindex="true">1</index>

 </row>

Here the  temperature event that triggers the action is sent to a remote server (%event). You can of course set up to send any event you like or send an event that is stored in a variable.

This action is described here.

A connection is opened and closed each time an event is sent so the driver is much more efficient to use for setups where a lot of events should be sent to a remote location.  The actual transfer is on its own thread so timing is pretty constant also for a slow remote connection.

 

 

#VSCP howto: Compare values without coding

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.

Many time one want to compare measurement values.  If a certain value is bigger than a set point an alarm may be sounded or some other action may be needed. Usually this is functionality that is handled by program code. This is possible in VSCP also of course. You can even put this code inside the VSCP server using Javascript or Lua or outside in executable files written in any language. But comparing measurement values is also build right into the decision matrix (DM) mechanism of the VSCP server also.

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

You can of course trigger other actions instead. Send another event, run a Javascript or a Lua script, do an http page post…

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!