energy.dotvision.com 1
Spoony 1.5 | DataChunkWebPushService
energy.dotvision.com
energy.dotvision.com 2
Spoony 1.5 | DataChunkWebPushService
INTRODUCTION ...................................................................................................................................... 3
1. BASIC REQUIREMENTS ..................................................................................................................... 3
2. MODE OF OPERATION ..................................................................................................................... 3
3. DATA FORMAT ................................................................................................................................ 4
4. TRANSPORT PROTOCOL ................................................................................................................... 5
4.1 RAW JSON DATA ................................................................................................................................. 5
4.2 COMPRESSED JSON DATA....................................................................................................................... 5
5. SERVER IMPLEMENTATION .............................................................................................................. 7
6. DEVICE CONFIGURATION ................................................................................................................. 8
7. AVAILABLE DATAPOINTS ................................................................................................................ 10
ANNEX 1: JSON SCHEMA OF DATACHUNK JSON OBJECTS ...................................................................... 11
ANNEX 2: SAMPLE JSON DATACHUNK OBJECT ....................................................................................... 13
ANNEX 3: SAMPLE GRAFANA DASHBOARDS USING SPOONY DATA (REAL-TIME MONITORING AND DATA
ANALYSIS) ............................................................................................................................................ 18
energy.dotvision.com 3
Spoony 1.5 | DataChunkWebPushService
energy.dotvision.com 4
Spoony 1.5 | DataChunkWebPushService
energy.dotvision.com 5
Spoony 1.5 | DataChunkWebPushService
energy.dotvision.com 6
Spoony 1.5 | DataChunkWebPushService
energy.dotvision.com 7
Spoony 1.5 | DataChunkWebPushService
energy.dotvision.com 8
Spoony 1.5 | DataChunkWebPushService
File: system\services\Device\ODM\ODMDataChunk\serviceSettings.xml <configuration>
<settings>
<add key="sourceAutomationService" value="Automation"/>
<add key="samplingPeriod" value="1"/>
<add key="chunkPoolSize" value="15"/>
<add key="datapoint" value="ade7758/FREQ"/>
<add key="datapoint" value="ade7758/VRMSA"/>
<add key="datapoint" value="ade7758/VRMSB"/>
<add key="datapoint" value="ade7758/VRMSC"/>
<add key="datapoint" value="ade7758/IRMSA"/>
<add key="datapoint" value="ade7758/IRMSB"/>
<add key="datapoint" value="ade7758/IRMSC"/>
</settings>
</configuration>
File: system\services\Device\ODM\ODMWebPush\serviceSettings.xml <WebPushService version="1.0">
<settings>
<add key="uri" value="http://www.yourserver.com:port/push"/>
<add key="shrink" value="false" />
</settings>
<headers size="1024"><!-- size will define the memory footprint to store
the headers values -->
<add key="User-Agent" value="Mozilla/5.0 (Windows; U; Windows NT
6.1; rv:2.2) Gecko/20110201"/> <!-- key HAS to be a known header -->
</headers>
<encoder type="DatapointRecordEncoder_Json_t"/>
</WebPushService>
energy.dotvision.com 9
Spoony 1.5 | DataChunkWebPushService
File: system\services\Device\serviceSettings.xml <configuration version="1.0">
<!-- Service manager part -->
<settings>
<add key="rootPath" value="system/services/device"/>
<add key="fileName" value="serviceSettings.xml"/>
</settings>
<!-- Device declaration -->
<device>
<serialNumber>123456789</serialNumber>
<location>48.8566140,2.3522220,0.0</location><!--PARIS-->
<friendlyName>SpoonyDotVision-VirtualDevice</friendlyName>
<firmwareVersion>1.5.23</firmwareVersion>
<model>
<manufacturer>DotVision</manufacturer>
<manufacturerUrl>dotvision.com</manufacturerUrl>
<name>spoony</name>
<number>1.5</number>
<url/>
<presentationUrl/>
</model>
</device>
<services>
<service>
<type>NtpClient_t</type>
<name>Ntp</name>
<startMode group="2">automatic</startMode>
</service>
[ . . . ]
<service>
<type>ODMService_t</type>
<name>ODM</name>
<startMode group="3">automatic</startMode>
</service>
<service>
<type>CsvLogService_t</type>
<name>CsvLog</name>
<startMode group="3">manual</startMode>
</service>
</services>
</configuration>
energy.dotvision.com 10
Spoony 1.5 | DataChunkWebPushService
energy.dotvision.com 11
Spoony 1.5 | DataChunkWebPushService
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "SpoonyDataChunk",
"type": "object",
"properties":{
"from": {
"description": "Source of Datachunk. Identify source device
and internal unit.",
"type": "object",
"properties":{
"deviceId": {
"description": "Source device identifier. As
configured on device. User is responsible for unicity of devices IDs whitin
the target server.",
"type": "string"
},
"unit": {
"description": "Source of data within the device
(Service name). Always ODMDataChunk in current devices revisions.",
"type": "string"
}
}
},
"t": {
"description": "Timestamp of DataChunk. Date at which the
DataChunk was sent from the device. ISO 8601 format.",
"type": "string"
},
"count": {
"description": "Number of items in the following array
'elements'.",
"type": "number"
},
"elements": {
"description": "Array containing sampled data, organized by
datapoint.",
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"description": "Name of the datapoint.",
"type": "string"
},
"count": {
"description": "Number of items in the
following array 'records'.",
"type": "number"
},
"records": {
"description": "Array of records. A records
is a single datapoint sample",
"type": "array",
"items": {
"type": "object",
"properties": {
"i": {
energy.dotvision.com 12
Spoony 1.5 | DataChunkWebPushService
"description": "Index of
the sample. Index get incremented each time the concerned datapoint is
sampled.",
"type": "number"
},
"t": {
"description": "Timestamp
of the sample. ISO 8601 format.",
"type": "string"
},
"q": {
"description": "Quality
of the sample. Always 'good' in current devices revisions.",
"type": "string"
},
"v": {
"description": "Value of
the sample. All Spoony datapoints are single-precision floating-point
numbers.",
"type": "number"
}
}
}
}
}
}
}
}
}
energy.dotvision.com 13
Spoony 1.5 | DataChunkWebPushService
{
"from": {
"deviceId": "SpoonyDotVisionDev",
"unit": "ODMDataChunk"
},
"t": "2016-07-05T15:13:54.013Z",
"count": 29,
"elements": [{
"n": "TEMP",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": 25.03737
}]
}, {
"n": "FREQ",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": 50.00000
}]
}, {
"n": "VRMSA",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": 220.03842
}]
}, {
"n": "VRMSB",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": 219.70237
}]
}, {
"n": "VRMSC",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": 220.19691
}]
}, {
"n": "IRMSA",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
energy.dotvision.com 14
Spoony 1.5 | DataChunkWebPushService
"q": "good",
"v": -9.85277
}]
}, {
"n": "IRMSB",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": 7.34283
}]
}, {
"n": "IRMSC",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": 2.99373
}]
}, {
"n": "WATTHRA",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": -1250.21447
}]
}, {
"n": "WATTHRB",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": 887.71948
}]
}, {
"n": "WATTHRC",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": 382.72506
}]
}, {
"n": "VARHRA",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": -54.76239
}]
}, {
"n": "VARHRB",
"count": 1,
"records": [{
"i": 2068,
energy.dotvision.com 15
Spoony 1.5 | DataChunkWebPushService
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": 37.80604
}]
}, {
"n": "VARHRC",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": 16.43738
}]
}, {
"n": "VAHRA",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": -1251.86120
}]
}, {
"n": "VAHRB",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": 888.86926
}]
}, {
"n": "VAHRC",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": 383.22750
}]
}, {
"n": "WATTA",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": -2163.50097
}]
}, {
"n": "WATTB",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": 1609.89099
}]
}, {
"n": "WATTC",
"count": 1,
"records": [{
energy.dotvision.com 16
Spoony 1.5 | DataChunkWebPushService
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": 658.52893
}]
}, {
"n": "VARA",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": -139.41661
}]
}, {
"n": "VARB",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": 103.86761
}]
}, {
"n": "VARC",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": 30.00405
}]
}, {
"n": "VAA",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": -2167.98828
}]
}, {
"n": "VAB",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": 1613.23815
}]
}, {
"n": "VAC",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": 659.21209
}]
}, {
"n": "PFA",
"count": 1,
energy.dotvision.com 17
Spoony 1.5 | DataChunkWebPushService
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": 0.99793
}]
}, {
"n": "PFB",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": 0.99792
}]
}, {
"n": "PFC",
"count": 1,
"records": [{
"i": 2068,
"t": "2016-07-05T15:13:53.998Z",
"q": "good",
"v": 0.99896
}]
}]
}