String channelType = channel.getChannelTypeUID().getId(); switch (channelType) { case "alarm_raw": Map object = new HashMap(); object.put("type", eventAlarm.getAlarmType()); object.put("event", eventAlarm.getAlarmEvent()); object.put("status", eventAlarm.getAlarmStatus()); object.put("level", eventAlarm.getV1AlarmLevel()); NotificationEvent notificationEvent = NotificationEvent.getEvent(eventAlarm.getAlarmType().toString(), eventAlarm.getAlarmEvent()); if (notificationEvent != null) { object.put("notification", notificationEvent.toString()); if (eventAlarm.getParameters() != null) { // Include any parameters present. // Expand array since propertiesToJson does not support arrays. int[] params = eventAlarm.getParameters(); for (int i = 0; i < params.length; i++) { object.put("parameter-" + (i + 1), params[i]); } // Special cases kept for backwards compatibility. switch (notificationEvent) { case ACCESS_CONTROL__KEYPAD_LOCK: case ACCESS_CONTROL__KEYPAD_UNLOCK: object.put("code", eventAlarm.getParameters()[0]); break; default: break; } } } return new StringType(propertiesToJson(object)); case "alarm_number": case "notification_access_control": case "notification_power_management": return new DecimalType(eventAlarm.getAlarmEvent()); default: Map events = notifications.get(channelType); if (events == null) { logger.debug("NODE {}: Alarm converter NOTIFICATION event is {}, channel {} is not implemented.", eventAlarm.getNodeId(), event, channelType); return null; } return events.get(notification); } }