More strict boolean checks
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 2 Oct 2022 17:45:10 +0000 (19:45 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 2 Oct 2022 17:45:10 +0000 (19:45 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStation.ts

index 7853d10ed8fc6b5d3bc58737bd3172c20fb581c9..7078641b8837edfa55e13495b108dd0473c4de6f 100644 (file)
@@ -953,7 +953,7 @@ export default class ChargingStation {
         this.handleUnsupportedVersion(this.getOcppVersion());
         break;
     }
-    if (this.stationInfo?.autoRegister) {
+    if (this.stationInfo?.autoRegister === true) {
       this.bootNotificationResponse = {
         currentTime: new Date().toISOString(),
         interval: this.getHeartbeatInterval() / 1000,
@@ -1745,7 +1745,7 @@ export default class ChargingStation {
   }
 
   private async startMessageSequence(): Promise<void> {
-    if (this.stationInfo?.autoRegister) {
+    if (this.stationInfo?.autoRegister === true) {
       await this.ocppRequestService.requestHandler<
         BootNotificationRequest,
         BootNotificationResponse
@@ -1923,7 +1923,7 @@ export default class ChargingStation {
     if (HeartBeatInterval) {
       return Utils.convertToInt(HeartBeatInterval.value) * 1000;
     }
-    !this.stationInfo?.autoRegister &&
+    this.stationInfo?.autoRegister === false &&
       logger.warn(
         `${this.logPrefix()} Heartbeat interval configuration key not set, using default value: ${
           Constants.DEFAULT_HEARTBEAT_INTERVAL