Skip to main content

optiCLOUD Dashboard module "opticloud"

Description​

The "opticloud" module provides an interface to the optiCLOUD dashboard. Both telemetry data and client attributes can be transferred from the measuring device to the dashboard. It is also possible to feed so-called shared attributes from the dashboard to the measuring device. It is also possible to communicate from the dashboard to the device via an RPC interface.

Interfaces & protocols used​

  • MQTT

JSON configuration​

The following section describes the entire JSON configuration of the module and explains the individual parameters.

Example configuration (minimum)​

The following is a minimal example configuration:

{
"module": "Opticloud",
"factory": "opticloud",
"config":{
"channels":[
{
"name": "*"
}
]
}
}

Example configuration (typical)​

{
"module": "Opticloud",
"factory": "opticloud",
"config":{
"pollingIntervalMs":1000,
"channels":[
{
"name": "*",
"refreshIntervalMs":60000,
"minimumSendIntervalMs":0
}
]
}
}

Example configuration (maximum)​

{
"module": "Opticloud",
"factory": "opticloud",
"config":{
"transmitBoolAsInt": false,
"transmitStatusChannels": false,
"channelnameTransmitData": "TransmitData",
"connectTimeoutS": 10,
"disconnectTimeoutS": 10,
"keepaliveIntervalS": 10,
"completionIntervalS": 10,
"sendingIntervalS": 10,
"maxBufferedMessages": 10,
"channels":[
{
"name": "can*",
"messageType": "telemetry,clientAttribute",
"sendOnlyOnChange":true,
"refreshIntervalMs":60000,
"minimumSendIntervalMs":0,
"useTrueTimestamps":false
}
],
"splitGpsLocationChannels":[
{
"gpsLocationChannelName": "GPS.Location",
"gpsLatitudeChannelName": "GPS.Latitude",
"gpsLongitudeChannelName": "GPS.Longitude",
"gpsAltitudeChannelName": "GPS.Altitude"
}
],
"pollingIntervalMs":1000,
"sharedAttributes":[
{
"name": "dataFromDashboardChannel",
"type": "double",
"persistent":true,
"requestInitialValue":true,
"bufferSize":1024,
"physicalDimension": "temperature",
"physicalUnit": "K"
}
],
"brokerAddress": "ssl://dashboard.opticloud.io:8883",
"brokerUserId": "",
"brokerUserPassword": "",
"brokerAuthentication": true,
"trustStore": "/etc/ssl/certs/ca-certificates.crt",
"clientCertificate": "notImplementedYet"
}
}

The "splitGpsLocationChannels" JSON array only needs to be specified if GPS locations are actually transferred to the dashboard, e.g. from the GPS module, are actually transmitted to the dashboard AND the splitting of this data is to be freely configured. In this case, the split channels are automatically named as follows, either by

  • Append ".Latitude", ".Longitude", ".Altitude" to the GPS location channel name, or
  • Remove the ".Location" suffix and append ".Latitude", ".Longitude", ".Altitude" to the GPS location channel name if this suffix exists in the GPS location channel name.

Global swapping of device-specific parameters​

The connection-specific parameters can be outsourced to the following global section of the static smartCORE configuration (smartcore.json), i.e:

"device_based":{
"instances":{
"opticloudInstance1":{
"brokerAddress": "ssl://awe.some.io:8883",
"brokerUserId": "",
"brokerUserPassword": "",
"brokerAuthentication": true,
"clientCertificate": "notImplementedYet"
}
}
},

These global parameters have priority over the module-specific configured parameters. This makes it easier to roll out the same new dynamic measurement configuration (smartcore_dynamic.json) to several devices.

(Global) connection-specific module parameters​

Parameter NameRequiredData TypeMeaningful Value RangeDefaultDescription
brokerAddressNoSTRINGvalid dashboard URL"ssl://dashboard.opticloud.io:8883" , "tcp://awe.some.io:1883" (not recommended)
brokerUserIdNoSTRINGSerial numberPassword of the device
brokerUserPasswordNoSTRING""""Password of the dashboard server
brokerAuthenticationNoBOOLtrue, falsetrueDashboard server authentication
trustStoreNoSTRING/etc/ssl/certs/ca-certificates.crtTrust Store for dashboard server authentication
clientCertificateNoSTRING BASE64valid certificatecertificate for device authentication (not supported)

Module parameters​

Parameter nameRequiredData typeMeaningful value rangeDefaultDescription
pollingIntervalMsNoINT1000 -1000Module-related channel data acquisition interval [ms]
transmitBoolAsIntNoBOOLfalse, truefalsetransmit Boolean values (false,true) as integers (0,1)
transmitStatusChannelsNoBOOLfalse, truefalseDetermines whether STATUS signals should be created and transmitted
channelnameTransmitDataNoSTRINGvalid channel name""Channel used to suspend and resume the transmission of measurement data, see below (from smartCORE 2.12)
connectTimeoutSNoINT1 -10Timeout regarding connection establishment
disconnectTimeoutSNoINT1 -10Timeout regarding disconnection after request
keepaliveIntervalSNoINT1 -10Timeout regarding detection of a disconnected connection
completionIntervalSNoINT1 -10Timeout regarding acknowledgement receipt after sending an MQTT message
sendingIntervalSNoINT1 -10Timeout for sending an MQTT message
maxBufferedMessagesNoINT1 -10Maximum number of buffered MQTT messages within the MQTT client
channelsYESJSON Arraysee below
splitGpsLocationsoptional for GPS channelsJSON arraysee below
sharedAttributesNoJSON Arraysee below

Channel configuration "channels"​

The telemetry/client attribute channels transmitted to the dashboard are each configured as a JSON object with the following parameters

Parameter NameRequiredData TypeMeaningful Value RangeDefaultDescription
nameYESSTRINGvalid channel namechannel name, simplified wildcards "*" and "?" are supported
messageTypeNoSTRING"telemetry", "clientAttribute""telemetry"Type of transmission to the dashboard. "telemetry,clientAttribute" is also possible
sendOnlyOnChangeNoBOOLtrue, falsetrueData reduction of unchanged channel values
refreshIntervalMsNoINT1 -60000 (60 s)Resend the same values after an interval has expired if their associated trusted timestamp has been updated
minimumSendIntervalMsNoINT0 -0 (0 s)Channel-related minimum transmission interval
useTrueTimestampsNoBOOLfalse, truefalseTransmission using the production timestamps, if set (otherwise timestamp of the processing cycle)

Splitting the GPS location channels "splitGpsLocationChannels"​

The GPS location channels must be split before being sent to the dashboard. The split can be defined in the form of a JSON object for each channel

Parameter nameRequiredData typeMeaningful value rangeDefaultDescription
gpsLocationChannelNameYESSTRINGvalid GPS location channel nameinput channel from the smartCORE
gpsLatitudeChannelNameNoSTRINGsee aboveChannel name for transmission of geo. Latitude to the dashboard
gpsLongitudeChannelNameNoSTRINGsee aboveChannel name for transmitting the geo. Longitude to the dashboard
gpsAltitudeChannelNameNoSTRINGsee aboveChannel name for transmitting the geo. Altitude above sea level to the dashboard

Channel configuration "sharedAttributes"​

Attributes created by the dashboard can be loaded onto the device via "sharedAttributes" and produced in corresponding channels. The configuration is carried out via the following JSON object for each channel.

Parameter nameRequiredData typeMeaningful value rangeDefaultDescription
nameYESSTRINGvalid channel namechannel name
typeYESSTRINGvalid data type"bool", "double", "float", "string", "[u]int8"
persistentnoBOOLfalse, truetrueshould the last value of the channel be persistent across a smartCORE restart
requestInitialValueNoBOOLfalse, truetrueadditional reference to the sharedAttribute directly after the start of measurement operation
bufferSizeNoINT1 -1024Buffer size of the created channel
physicalDimensionNoSTRINGPhysical dimension
physicalUnitNoSTRINGPhysical unit

Controlling the data transmission "channelnameTransmitData"​

info

This parameter is available from smartCORE 2.12 onwards.

The optional parameter "channelnameTransmitData" suspends and resumes the transmission of measurement data at runtime without dropping the connection to the dashboard. It takes the name of a timestamped channel of data type "bool".

While that channel reads false, the module holds the measurement data back. Everything that keeps the device reachable continues unchanged:

Kind of dataBehaviour while the control channel reads false
Telemetryheld back
Client attributesheld back
STATUS values of this modulenot transmitted, but still written to the local STATUS channels
The control channel itselfstill transmitted, provided it is part of the "channels" configuration
Alarmsunaffected
Shared attributes (dashboard → device)unaffected
RPCunaffected
Serial numberunaffected

The control channel itself is deliberately exempt from the block, so that the dashboard can tell a deliberate silence from a lost connection. And because the connection stays up, the transmission can be switched back on from the dashboard at any time.

The state of the control channel is evaluated once per acquisition cycle ("pollingIntervalMs"); every change of state is written to the log.

When in doubt, data is transmitted. Transmission stays enabled in all of the following cases:

  • the parameter is absent or empty,
  • the configured channel does not exist,
  • the configured channel is not timestamped or not of data type "bool",
  • the channel does not carry a value yet.

A typo in the channel name can therefore not silence a device. The three channel-related cases are written to the log as a warning when the measurement starts.

The typical use case is control from the dashboard by way of a shared attribute:

"channelnameTransmitData":"TransmitData",
"sharedAttributes":[
{
"name":"TransmitData",
"type":"bool",
"persistent":true,
"requestInitialValue":true
}
]

A shared attribute created this way is a timestamped channel of the configured data type and therefore meets the requirements of the control channel. The module itself does not store the state: after a restart, data is transmitted until the control channel carries a value. "persistent" and "requestInitialValue" make the last value set available again.

The control channel does not have to come from the dashboard. A digital input or a calculated channel from the "math" module works just as well; all that is required is a timestamped channel of data type "bool".

Module information​

InformationValue
AuthorsoptiMEAS GmbH
since smartCORE0
Module typeConsumer, (optional) Producer
DependenciesoptiCLOUD Dashboard