This module allows you to configure Cloud Sync to occur only at a specific time frame by implementing a sensor, naomi:sync-at-time:timesyncsensor
, that enables sync when within a specified timeframe and disables sync when outside that timeframe.
Before configuring your sensor, you must create a machine.
To use the sync-at-time
module you also need to:
- Enable data capture.
- Enable cloud sync.
To use this module, follow these instructions to add a module from the Viam Registry and select the naomi:sync-at-time:timesyncsensor
model from the sync-at-time
module.
Navigate to the Config tab of your machine's page in the Viam app.
Click on the Components subtab and click Create component.
Select the sensor
type, then select the sync-at-time:timesyncsensor
model.
Click Add module, then enter a name for your sensor and click Create.
On the new component panel, copy and paste the following attribute template into your sensor’s Attributes box:
{
"start": "HH:MM:SS",
"end": "HH:MM:SS",
"zone": "<TIMEZONE>"
}
Note
For more information, see Configure a Machine.
The following attributes are available for the naomi:sync-at-time:timesyncsensor
sensor:
Name | Type | Inclusion | Description |
---|---|---|---|
start |
string | Required | The start time for the time frame during which you want to sync, example: "14:10:00" . |
end |
string | Required | The start time for the time frame during which you want to sync, example: "15:35:00" . |
zone |
string | Required | The time zone for the start and end time, for example: "CET" . |
{
"start": "14:10:00",
"end": "15:35:00",
"zone": "CET"
}
To ensure the sensor starts before the data manager, add the sensor to the dependencies of the data manager.
On your machine's Config tab, switch to JSON mode and add a selective_syncer_name
with the name for the sensor you configured to the data manager config. Also add the sensor to the depends_on
field:
{
"attributes": {
"additional_sync_paths": [],
"capture_dir": "",
"capture_disabled": false,
"selective_syncer_name": "<SENSOR-NAME>",
"sync_disabled": false,
"sync_interval_mins": 0.1,
"tags": []
},
"name": "Data-Management-Service",
"type": "data_manager"
}
For an example configuration see example.json.
You have now configured sync to happen during a specific time slot.
To test your setup, configure a webcam or another component and enable data capture on one of the component methods, for example ReadImage
.
The data manager will now capture data.
Go to the Control tab. You should see the sensor.
Click on GetReadings
.
If you are in the time frame for sync, the sensor will return true.
You can confirm that no data is currently syncing by going to the Data tab.
If you are not in the time frame for sync, adjust the configuration of your sensor.
Then check again on the Control and Data tab to confirm data is syncing.
This module is written in Go.
go mod tidy
go build
Copyright 2021-2023 Viam Inc.
Apache 2.0