Product/components used and version/fix level:
Detailed explanation of the problem:
I have a use case where i am Listening for Manage Object and based on Received Json extract deviceId,fragement,alarmText ,Thresholds From
this and Then Listen for Measurement based on deviceId and get the Latest Received Value .
Use that Received value to check whether Value is above Thresholds or Below .If above then create alarm .
I am facing issues as Previous alarm also creating even if i update the alarm Text from Manage Object
Received ManageObject Json:
{
“alarm_text”: “Range_50_25500 Greater than 0.53 na and active less then 0.30”,
“alarm_type”: “Flow”,
“alarm_severity”: {
“name”: “Major”
},
“threshold_value”: “0.30”,
“rule_id”:“5432”
}
Send for Listen for Measurement
‘’’
result = thresoldValue > Recieved Measurement Value
if(result) {
contextService.runWithinContext(microserviceCredentials, () -> {
try {
AlarmRepresentation alarm = new AlarmRepresentation();
var source = new ManagedObjectRepresentation();
source.setId(GId.asGId(deviceId));
alarm.setSource(source);
alarm.setSeverity(alarmseverity);
alarm.setType(alarmType+"_"+rule_id);
alarm.setStatus("ACTIVE");
alarm.setText(flowText);
alarm.setDateTime(DateTime.now());
alarm.setProperty("rule_id", rule_id);
alarm.setProperty("alarm_type",alarmFlowType);
alarmApi.create(alarm);
'''
My Problem is when i am updating alarm Text Old alarm Text also appeared in cumulocity alarm ,even if i updated the Alarm Text