@@ -71,7 +71,7 @@ async def running(self):
7171 heartbeat = 15 ,
7272 auth = auth ,
7373 ) as ws_client :
74- self .state = STATE_CONNECTED
74+ await OpenEVSEWebsocket .state . fset ( self , STATE_CONNECTED )
7575 self .failed_attempts = 0
7676
7777 async for message in ws_client :
@@ -102,7 +102,7 @@ async def running(self):
102102 except (aiohttp .ClientConnectionError , asyncio .TimeoutError ) as error :
103103 if self .failed_attempts >= MAX_FAILED_ATTEMPTS :
104104 self ._error_reason = ERROR_TOO_MANY_RETRIES
105- self .state = STATE_STOPPED
105+ await OpenEVSEWebsocket .state . fset ( self , STATE_STOPPED )
106106 elif self .state != STATE_STOPPED :
107107 retry_delay = min (2 ** (self .failed_attempts - 1 ) * 30 , 300 )
108108 self .failed_attempts += 1
@@ -117,10 +117,10 @@ async def running(self):
117117 if self .state != STATE_STOPPED :
118118 _LOGGER .exception ("Unexpected exception occurred: %s" , error )
119119 self ._error_reason = ERROR_UNKNOWN
120- self .state = STATE_STOPPED
120+ await OpenEVSEWebsocket .state . fset ( self , STATE_STOPPED )
121121 else :
122122 if self .state != STATE_STOPPED :
123- self .state = STATE_DISCONNECTED
123+ await OpenEVSEWebsocket .state . fset ( self , STATE_DISCONNECTED )
124124 await asyncio .sleep (5 )
125125
126126 async def listen (self ):
0 commit comments