{"id":2379,"date":"2017-04-04T15:25:47","date_gmt":"2017-04-04T15:25:47","guid":{"rendered":"http:\/\/grodansparadis.com\/wordpress\/?p=2379"},"modified":"2017-04-04T15:25:47","modified_gmt":"2017-04-04T15:25:47","slug":"the-vscp-sync","status":"publish","type":"post","link":"https:\/\/grodansparadis.com\/wordpress\/?p=2379","title":{"rendered":"The #VSCP sync"},"content":{"rendered":"<h4><a href=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2015\/08\/vscp_new_v2.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1009\" data-permalink=\"https:\/\/grodansparadis.com\/wordpress\/?attachment_id=1009\" data-orig-file=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2015\/08\/vscp_new_v2.png?fit=500%2C700&amp;ssl=1\" data-orig-size=\"500,700\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"vscp_new_v2\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2015\/08\/vscp_new_v2.png?fit=500%2C700&amp;ssl=1\" class=\"alignnone  wp-image-1009\" src=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2015\/08\/vscp_new_v2.png?resize=326%2C457\" alt=\"\" width=\"326\" height=\"457\" srcset=\"https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2015\/08\/vscp_new_v2.png?w=500&amp;ssl=1 500w, https:\/\/i0.wp.com\/grodansparadis.com\/wordpress\/wp-content\/uploads\/2015\/08\/vscp_new_v2.png?resize=214%2C300&amp;ssl=1 214w\" sizes=\"auto, (max-width: 326px) 100vw, 326px\" \/><\/a><\/h4>\n<h4><u>Sync<\/u><\/h4>\n<p>To ask for readings (measurements\/sensor values) from nodes one can use <a href=\"http:\/\/www.vscp.org\/docs\/vscpspec\/doku.php?id=class1.control#type_26_0x1a_sync\">CLASS1.CONTROL, Sync<\/a>. 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.<\/p>\n<p>The sync&#8217;s primary use is to synchronize sensor readings from multiple nodes in time but it can obviously also be used\u00a0 just to request data.<\/p>\n<p>You can see that modules from <a href=\"http:\/\/www.grodansparadis.com\">Grodans Paradis AB<\/a> implement the <strong>sync<\/strong> but also have registers the data can be read from and automatically repetitive delivery of sensor data.<\/p>\n<p>For the <a href=\"http:\/\/www.grodansparadis.com\/kelvin1w\/manual\/doku.php?id=start\">Kelvin 1-Wire module<\/a> for example the <a href=\"http:\/\/www.grodansparadis.com\/kelvin1w\/manual\/doku.php?id=events&amp;s[]=sync\">sync has the following description<\/a><\/p>\n<blockquote><p>If a <span class=\"search_hit\">SYNC<\/span> event is received by the module it will check the zone\/subzone parameters of the event and send out <a class=\"urlextern\" title=\"http:\/\/www.grodansparadis.com\/kelvin1w\/manual\/doku.php?id=events#temperature_event\" href=\"http:\/\/www.grodansparadis.com\/kelvin1w\/manual\/doku.php?id=events#temperature_event\" rel=\"nofollow\">temperature measurement event(s)<\/a> for all sensors that match. This can be a handy feature to use of one want synchronized data from several sources.<\/p><\/blockquote>\n<p>But you can also instruct the module to output temperature sensor data with a set time interval (see report interval registers <a href=\"http:\/\/www.grodansparadis.com\/kelvin1w\/manual\/doku.php?id=registers\">here<\/a>) or read the temperature reading in a register (see temperature registers <a href=\"http:\/\/www.grodansparadis.com\/kelvin1w\/manual\/doku.php?id=registers\">here<\/a>).<\/p>\n<p>Periodical events are perfect when the <a href=\"http:\/\/www.vscp.org\/docs\/vscpd\/doku.php\">VSCP daemon<\/a> is part of a system. Tables and remote variables is two features it have that is well suited for this type of sensor data.<\/p>\n<p>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. <a href=\"http:\/\/www.vscp.org\/docs\/vscpd\/doku.php?id=vscp-tables\">There is a description here<\/a>. 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&#8230;<\/p>\n<p>If one want the x last readings the <a href=\"http:\/\/www.vscp.org\/docs\/vscpd\/doku.php?id=vscp-tables\">static table<\/a> is perfect as it works in a round robin fashion.<\/p>\n<p>One can also use <a href=\"http:\/\/www.vscp.org\/docs\/vscpd\/doku.php?id=decision_matrix_varaibles\">remote variables<\/a> 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 <a href=\"http:\/\/www.vscp.org\/docs\/vscpd\/doku.php?id=vscp_daemon_decision_matrix#store_in_variable\">store the value in a variable <\/a>with a DM entry when it is received. This way one have the sensor value accessible all the time and\u00a0 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 <a href=\"http:\/\/www.vscp.org\/docs\/vscpspec\/doku.php?id=class2.vscpd#type_6_0x0006_minute\">minute event<\/a> and send the value there calling an external script or using one of the internal actions such as the <a href=\"http:\/\/www.vscp.org\/docs\/vscpd\/doku.php?id=vscp_daemon_decision_matrix#http_get_post_put\">http put\/get\/post action<\/a> or even the run internal <a href=\"http:\/\/www.vscp.org\/docs\/vscpd\/doku.php?id=vscp_daemon_decision_matrix#run_javascript\">JavaScript action<\/a> (soon LUA to).<\/p>\n<p>Well that&#8217;s power for you!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[13],"tags":[],"class_list":["post-2379","post","type-post","status-publish","format-standard","hentry","category-vscp"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p4raCZ-Cn","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/2379","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2379"}],"version-history":[{"count":1,"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/2379\/revisions"}],"predecessor-version":[{"id":2381,"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/2379\/revisions\/2381"}],"wp:attachment":[{"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2379"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2379"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/grodansparadis.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2379"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}