2016-10-24 3 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 선호) 다른 시간대가 해당 데이터를 사용하는 클라이언트에서 문제를 만들 수 있기 때문입니다.

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

대신 CEP 규칙에

current_timestamp().toDate() as time 

의 :

내가 사용하십시오

current_timestamp().toDate() as time 

답변

1

와 CEP의 '시간'을 만들 수 있습니다.

안부,
ARKADIUSZ
Cumulocity 지원 팀