すべての測定には、測定が作成されたときのタイムスタンプ (イベント時間) が付いていました。これらの測定値の一部は人為的なものであり、デバイス自体によって作成されたものではなく、CoT 内で実行される CEP ルールによって作成されたものです。
The "normal" measurements have the time format coded as UTC
[{
"id": "12704547",
"data": {
"data": {
"time": "2016-07-25T15:24:11.000Z",
"id": "1152930",
"self": "http://testTenant.c8y.com/measurement/measurements/1152930",
"source": {
"id": "222812",
"self": "http://testTenant.c8y.com/inventory/managedObjects/222812"
},
"type": "tsystems_cumulocity_energymeter_digital_ping",
"Energieverbrauch": {
"Ping": {
"unit": "Wh",
"value": 1
}
}
},
"realtimeAction": "CREATE"
},
"channel": "/measurements/222812"
}, {
"successful": true,
"channel": "/meta/connect"
}]
しかし、「人工的な」測定値 (CEP ルールによって作成されたもの) は、現地時間のタイムスタンプを使用します。
[{
"id": "12704578",
"data": {
"data": {
"time": "2016-07-25T17:24:00.952+02:00",
"id": "1152931",
"self": "http://testTenant.c8y.com/measurement/measurements/1152931",
"source": {
"id": "222812",
"self": "http://testTenant.c8y.com/inventory/managedObjects/222812"
},
"type": "tsystems_cumulocity_energymeter_power_consumption",
"Leistung": {
"Aggregation_1min": {
"unit": "W",
"value": 900
}
}
},
"realtimeAction": "CREATE"
},
"channel": "/measurements/222812"
}]
異なるタイムゾーンがそのデータを使用するクライアントで問題を引き起こす可能性があるため、1 つのデバイスからの測定値は常に同じタイムゾーン (UTC を推奨) でエンコードする必要があります。
CEPで「時間」を作成します
current_timestamp().toDate() as time