2016-10-24 2 views
1

すべての測定には、測定が作成されたタイムスタンプ(イベント時間)が付属しています。これらの測定値の中には人工的なものもあります。つまり、デバイス自体ではなく、CoT内で実行されるCEPルールによって作成されます。ローカル時刻とCEPはUTC時間ではなくローカルで測定/イベントを生成します

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" 
}] 

つのデバイスからの測定値は、常に同じタイムゾーン(UTCが好ましい)で符号化されるべきです異なるタイムゾーンがそのデータを使用するクライアントに問題を引き起こす可能性があるからです。

私が使用してください

current_timestamp().toDate() as time 

答えて

1

でCEPの '時間' を作成します。あなたのCEPルールで

com.cumulocity.model.util.DateTimeUtils.newUTC(current_timestamp().toDate()) as dateTime, 

代わりの

current_timestamp().toDate() as time 

を。

敬具、
はArkadiusz
Cumulocityサポートチーム

関連する問題