File tree Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -128,12 +128,7 @@ export class ChargePoint {
128
128
129
129
public connect ( ) : void {
130
130
this . _webSocket . connect (
131
- ( ) => {
132
- this . _messageHandler . sendBootNotification ( this . _bootNotification ) ;
133
- this . status = OCPPStatus . Available ;
134
- this . updateAllConnectorsStatus ( OCPPStatus . Available ) ;
135
- this . error = "" ;
136
- } ,
131
+ ( ) => this . boot ( ) ,
137
132
( ev : CloseEvent ) => {
138
133
this . status = OCPPStatus . Unavailable ;
139
134
this . updateAllConnectorsStatus ( OCPPStatus . Unavailable ) ;
@@ -147,12 +142,24 @@ export class ChargePoint {
147
142
) ;
148
143
}
149
144
145
+ public boot ( ) : void {
146
+ this . _messageHandler . sendBootNotification ( this . _bootNotification ) ;
147
+ this . status = OCPPStatus . Available ;
148
+ this . updateAllConnectorsStatus ( OCPPStatus . Available ) ;
149
+ this . error = "" ;
150
+ }
151
+
150
152
public disconnect ( ) : void {
151
153
this . _logger . info ( "Disconnecting from WebSocket" ) ;
152
154
this . _status = OCPPStatus . Unavailable ;
153
155
this . _webSocket . disconnect ( ) ;
154
156
}
155
157
158
+ public reset ( ) : void {
159
+ this . disconnect ( ) ;
160
+ this . connect ( ) ;
161
+ }
162
+
156
163
public authorize ( tagId : string ) : void {
157
164
this . _messageHandler . authorize ( tagId ) ;
158
165
}
Original file line number Diff line number Diff line change @@ -357,6 +357,14 @@ export class OCPPMessageHandler {
357
357
358
358
private handleReset ( payload : request . ResetRequest ) : response . ResetResponse {
359
359
this . _logger . log ( `Reset request received: ${ payload . type } ` ) ;
360
+ setTimeout ( ( ) => {
361
+ this . _logger . log ( `Reset chargePoint: ${ this . _chargePoint . id } ` ) ;
362
+ if ( payload . type === "Hard" ) {
363
+ this . _chargePoint . reset ( ) ;
364
+ } else {
365
+ this . _chargePoint . boot ( ) ;
366
+ }
367
+ } , 5_000 ) ;
360
368
return { status : "Accepted" } ;
361
369
}
362
370
You can’t perform that action at this time.
0 commit comments