diff --git a/src/lib/ChargeStation/connection.ts b/src/lib/ChargeStation/connection.ts index 5b7012d..b2ac20d 100644 --- a/src/lib/ChargeStation/connection.ts +++ b/src/lib/ChargeStation/connection.ts @@ -135,7 +135,7 @@ class Connection { const promise = new Promise((resolve, reject) => { const timeoutId = setTimeout(() => { this.inflight = undefined; - reject(new Error(`Call with message id ${messageId} timed out after ${this.inflightTimeoutMs / 1000} seconds`)) + reject(new Error(`Call with message id ${messageId} timed out after ${this.inflightTimeoutMs / 1000} seconds`)); }, this.inflightTimeoutMs); this.inflight = { diff --git a/src/lib/ChargeStation/eventHandlers/ocpp-16/send-status-notification-preparing.js b/src/lib/ChargeStation/eventHandlers/ocpp-16/send-status-notification-preparing.js index 97505e8..ffbde8b 100644 --- a/src/lib/ChargeStation/eventHandlers/ocpp-16/send-status-notification-preparing.js +++ b/src/lib/ChargeStation/eventHandlers/ocpp-16/send-status-notification-preparing.js @@ -2,6 +2,10 @@ export default async function sendStatusNotificationPreparing({ chargepoint, session, }) { + if (chargepoint.currentStatus[session.connectorId] === 'Preparing') { + return; + } + await chargepoint.writeCall( 'StatusNotification', { diff --git a/src/lib/ChargeStation/index.ts b/src/lib/ChargeStation/index.ts index 21ac022..909cf2c 100644 --- a/src/lib/ChargeStation/index.ts +++ b/src/lib/ChargeStation/index.ts @@ -350,6 +350,10 @@ export default class ChargeStation { session, }; } + + sendStatusNotification(connectorId: number, status: string) { + this.writeCall('StatusNotification', { connectorId, status, errorCode: 'NoError', }); + } } /* diff --git a/src/screens/Dashboard/StatusNotificationModal.js b/src/screens/Dashboard/StatusNotificationModal.js index 0cc9264..e324fb5 100644 --- a/src/screens/Dashboard/StatusNotificationModal.js +++ b/src/screens/Dashboard/StatusNotificationModal.js @@ -1,8 +1,6 @@ import React from 'react'; -import { Modal, Button, Form, Header, Divider } from 'semantic'; +import { Modal, Button, Form, Divider } from 'semantic'; import modal from 'helpers/modal'; -import { sessionSettingsList } from 'lib/settings'; -import { HelpTip } from 'components'; function selectDefaultConnector(availableConnectors) { return ['1', '2'].filter((connectorId) => { diff --git a/src/screens/Dashboard/index.js b/src/screens/Dashboard/index.js index fd7097b..819dfba 100644 --- a/src/screens/Dashboard/index.js +++ b/src/screens/Dashboard/index.js @@ -243,14 +243,13 @@ export default class Home extends React.Component { currentStatus={chargeStation.currentStatus} session={session} onSave={async ({ connectorId, status }) => { - await chargeStation.sendStatusNotification(connectorId, status); + await chargeStation.sendStatusNotification(parseInt(connectorId), status); this.nextTick(); }} trigger={