@@ -341,6 +341,11 @@ async def monitor_connection(self):
341
341
self ._metrics [cstat .latency_pong .value ].unit = "ms"
342
342
connection = self ._connection
343
343
timeout_counter = 0
344
+ # Add backstop to start post connect for non-compliant chargers
345
+ # after 10s to allow for when a boot notification has not been received
346
+ await asyncio .sleep (10 )
347
+ if not self .post_connect_success :
348
+ self .hass .async_create_task (self .post_connect ())
344
349
while connection .state is State .OPEN :
345
350
try :
346
351
await asyncio .sleep (self .cs_settings .websocket_ping_interval )
@@ -388,6 +393,7 @@ async def _handle_call(self, msg):
388
393
389
394
async def start (self ):
390
395
"""Start charge point."""
396
+ # post connect now handled on receiving boot notification or with backstop in monitor connection
391
397
await self .run ([super ().start (), self .monitor_connection ()])
392
398
393
399
async def run (self , tasks ):
@@ -424,10 +430,8 @@ async def reconnect(self, connection: ServerConnection):
424
430
self .status = STATE_OK
425
431
self ._connection = connection
426
432
self ._metrics [cstat .reconnects .value ].value += 1
427
- if self .post_connect_success is True :
428
- await self .run ([super ().start (), self .monitor_connection ()])
429
- else :
430
- await self .run ([super ().start (), self .monitor_connection ()])
433
+ # post connect now handled on receiving boot notification or with backstop in monitor connection
434
+ await self .run ([super ().start (), self .monitor_connection ()])
431
435
432
436
async def async_update_device_info (
433
437
self , serial : str , vendor : str , model : str , firmware_version : str
@@ -453,7 +457,8 @@ async def async_update_device_info(
453
457
def _register_boot_notification (self ):
454
458
if self .triggered_boot_notification is False :
455
459
self .hass .async_create_task (self .notify_ha (f"Charger { self .id } rebooted" ))
456
- self .hass .async_create_task (self .post_connect ())
460
+ if not self .post_connect_success :
461
+ self .hass .async_create_task (self .post_connect ())
457
462
458
463
async def update (self , cpid : str ):
459
464
"""Update sensors values in HA."""
0 commit comments