@EventHandler public void handle(ChargingStationStatusNotificationReceivedEvent event) { LOG.info("ChargingStationStatusNotificationReceivedEvent for {} received", event.getChargingStationId()); ChargingStation chargingStation = getChargingStation(event.getChargingStationId()); if (chargingStation != null) { chargingStation.setState(ComponentStatus.fromApiComponentStatus(event.getStatusNotification().getStatus())); chargingStationRepository.createOrUpdate(chargingStation); subscriberService.updateSubscribers(chargingStation, event.getStatusNotification().getTimeStamp()); } }
@Override public StatusNotificationResponse statusNotification(StatusNotificationRequest request, String chargeBoxIdentity) { ChargingStationId chargingStationId = new ChargingStationId(chargeBoxIdentity); EvseId evseId = new EvseId(request.getConnectorId()); ComponentStatus componentStatus = getComponentStatusFromChargePointStatus(request.getStatus()); String errorCode = request.getErrorCode() != null ? request.getErrorCode().value() : null; Date timestamp = new Date(); AttributeMap<String, String> attributes = new AttributeMap<>(); attributes.putIfValueNotNull(AttributeMapKeys.STATUS_NOTIFICATION_ERROR_CODE_KEY, errorCode); domainService.statusNotification(chargingStationId, evseId, new StatusNotification(componentStatus, timestamp, attributes), addOnIdentity); return new StatusNotificationResponse(); }
/** * Handles the {@link ChargingStationStatusNotificationReceivedEvent}. * * @param event the event to handle. */ @EventHandler public void handle(ChargingStationStatusNotificationReceivedEvent event) { ChargingStation chargingStation = repository.findOne(event.getChargingStationId().getId()); if (chargingStation != null) { chargingStation.setStatus(event.getStatusNotification().getStatus()); repository.createOrUpdate(chargingStation); } }
@Override public void handleRequest(ChargingStationId chargingStationId, String callId, String payload, WebSocketWrapper webSocketWrapper) { Statusnotification request = gson.fromJson(payload, Statusnotification.class); String errorCode = request.getErrorCode() != null ? request.getErrorCode().toString() : null; Date timestamp = request.getTimestamp(); if(timestamp == null) { timestamp = new Date(); } AttributeMap<String, String> attributes = new AttributeMap<String, String>(). putIfValueNotNull(AttributeMapKeys.STATUS_NOTIFICATION_VENDOR_ERROR_CODE_KEY, errorCode). putIfValueNotNull(AttributeMapKeys.STATUS_NOTIFICATION_INFO_KEY, request.getInfo()). putIfValueNotNull(AttributeMapKeys.VENDOR_ID, request.getVendorId()). putIfValueNotNull(AttributeMapKeys.STATUS_NOTIFICATION_VENDOR_ERROR_CODE_KEY, request.getVendorErrorCode()); domainService.statusNotification(chargingStationId, new EvseId(request.getConnectorId()), new StatusNotification(getComponentStatusFromChargePointStatus(request.getStatus()), timestamp, attributes), addOnIdentity); writeResponse(webSocketWrapper, new StatusnotificationResponse(), callId, MessageProcUri.STATUS_NOTIFICATION); }
/** * Handles the {@link ComponentStatusNotificationReceivedEvent}. * * @param event the event to handle. */ @EventHandler public void handle(ComponentStatusNotificationReceivedEvent event) { if (event.getComponent() == ChargingStationComponent.EVSE) { ChargingStation chargingStation = repository.findOne(event.getChargingStationId().getId()); if (chargingStation != null) { updateEvseStatus(chargingStation, event.getComponentId().getId(), event.getStatusNotification().getStatus()); repository.createOrUpdate(chargingStation); } } }
@Override public StatusNotificationResponse statusNotification(StatusNotificationRequest request, String chargeBoxIdentity) { ChargingStationId chargingStationId = new ChargingStationId(chargeBoxIdentity); EvseId evseId = new EvseId(request.getConnectorId()); ComponentStatus componentStatus = getComponentStatusFromChargePointStatus(request.getStatus()); String errorCode = request.getErrorCode() != null ? request.getErrorCode().value() : null; Date timestamp = request.getTimestamp(); if (timestamp == null) { timestamp = new Date(); } Map<String, String> attributes = new AttributeMap<String, String>(). putIfValueNotNull(AttributeMapKeys.STATUS_NOTIFICATION_ERROR_CODE_KEY, errorCode). putIfValueNotNull(AttributeMapKeys.STATUS_NOTIFICATION_INFO_KEY, request.getInfo()). putIfValueNotNull(AttributeMapKeys.VENDOR_ID, request.getVendorId()). putIfValueNotNull(AttributeMapKeys.STATUS_NOTIFICATION_VENDOR_ERROR_CODE_KEY, request.getVendorErrorCode()); domainService.statusNotification(chargingStationId, evseId, new StatusNotification(componentStatus, timestamp, attributes), addOnIdentity); return new StatusNotificationResponse(); }
@EventHandler public void handle(ComponentStatusNotificationReceivedEvent event) { LOG.info("ComponentStatusNotificationReceivedEvent for {} received", event.getChargingStationId()); ChargingStation chargingStation = getChargingStation(event.getChargingStationId()); if (chargingStation != null && event.getComponentId() instanceof EvseId) { io.motown.vas.viewmodel.persistence.entities.Evse evse = chargingStation.getEvse(((EvseId) event.getComponentId()).getNumberedId()); if (evse != null) { evse.setState(ComponentStatus.fromApiComponentStatus(event.getStatusNotification().getStatus())); chargingStationRepository.createOrUpdate(chargingStation); } else { LOG.error("Received ComponentStatusNotificationReceivedEvent for unknown component."); } subscriberService.updateSubscribers(chargingStation, event.getStatusNotification().getTimeStamp()); } }