The #VSCP sync

Sync

To ask for readings (measurements/sensor values) from nodes one can use CLASS1.CONTROL, Sync. One can use sensor index, zone, subzone as a way to tell which readings are of interest. A node should send the requested value immediately when it get a sync. For cashing, use tables or variables to store the readings.

The sync’s primary use is to synchronize sensor readings from multiple nodes in time but it can obviously also be used  just to request data.

You can see that modules from Grodans Paradis AB implement the sync but also have registers the data can be read from and automatically repetitive delivery of sensor data.

For the Kelvin 1-Wire module for example the sync has the following description

If a SYNC event is received by the module it will check the zone/subzone parameters of the event and send out temperature measurement event(s) for all sensors that match. This can be a handy feature to use of one want synchronized data from several sources.

But you can also instruct the module to output temperature sensor data with a set time interval (see report interval registers here) or read the temperature reading in a register (see temperature registers here).

Periodical events are perfect when the VSCP daemon is part of a system. Tables and remote variables is two features it have that is well suited for this type of sensor data.

Tables is being rewritten and extended from the functionality available in the last release at the moment and is mostly into place in the head code right now. There is a description here. One can do many things with sensor data in them and actually create user defined SQL databases if one like that which can have its data requested over REST/TCP/IP/websockets…

If one want the x last readings the static table is perfect as it works in a round robin fashion.

One can also use remote variables to store certain sensor data. In many of my setups I use them all the time. A typical sample is a sensor value that should be sent on specific intervals to a cloud service but where internal systems need this sensor value at a much higher rate than the cloud service need it. The easiest way to do this is to store the value in a variable with a DM entry when it is received. This way one have the sensor value accessible all the time and  request the latest value over any of the interfaces. To send the value to a cloud service one use one of the internal events for example the minute event and send the value there calling an external script or using one of the internal actions such as the http put/get/post action or even the run internal JavaScript action (soon LUA to).

Well that’s power for you!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.