mO SharemO Share

Upload Strategy

Sensor events are always sent to cloud. There is no way to restrict this.

There is the possibility to configure specific for each sensor if or when its data (its calibrated results) are sent to the cloud.

upload strategydescription
nevermeans never.
on_changemeans first and on change only. - If there is no change in the sensor value for lifetime then the value is sent only once.
intervalmeans first 1, on change and on interval (if any new in between), like a heartbeat. The interval is the upload interval to cloud. If there is no new incoming sensor result in the interval ("dead" sensor), then no value will be sent to cloud (no heartbeat).
alwaysEach calibrated result of a sensor is uploaded, regardless its previous values.

1 First means the first value of a sensor available on start of data_store.

In case of a value change for sensors with 'on_change' flag or with 'interval' flag the latest old value (with latest old timestamp) and the new value (with the new timestamp) is sent to the cloud. 

The default upload strategy can be set in the SiteController.cfg, which is by default 'interval'.

The interval of 'interval' is equal to the upload_interval, which can be also set in the SiteController.cfg. The default is 60 seconds.

The upload_interval has a high influence to the overall performance of the data upload to the cloud. The default of 60 seconds is a good value. It is recommended to set the upload_interval not less then 15 seconds. All sensor data do have their individual time stamp about their acquisition. The upload of the sensor data (hd - historical data) does have a delay on principle.

Example snippet of the SiteController.cfg
[data_store]
...
# default upload strategy (never, on_change, interval, always)
upload_strategy = interval
# upload interval to server in seconds
upload_interval = 60
...

The default upload strategy, defined in the SiteController.cfg is valid for all sensors, which have no specific upload strategy configured. The upload interval cannot be changed specifically for a sensor in the sensor configuration.

A change of the SiteController.cfg is active after the restart of the SiteController.

The upload strategy can be configured specific for a sensor:

example sensor configuration snippet
<sensor sensor_id="Battery_Voltage">
	<sensor_class>voltage</sensor_class>
	<upload>never</upload>
</sensor>

If a sensor is configured to be never uploaded but events are configured for that sensor, which will be uploaded, then you find a warning in log whilst processing the sensor configuration:

2016-07-01 09:44:24,786:1010:[data_store.py:745]:WARNING:Upload to server switched off for a sensor with events! sensor: Battery_Voltage