File tree 1 file changed +5
-0
lines changed
custom_components/localtuya
1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -294,6 +294,8 @@ async def _make_connection(self):
294
294
await self .abort_connect ()
295
295
if not retry < self ._connect_max_tries and not self .is_sleep :
296
296
self .warning (f"Failed to connect to { host } : { str (ex )} " )
297
+ if "key" in str (ex ):
298
+ await self .update_local_key ()
297
299
298
300
if self ._interface is not None :
299
301
try :
@@ -435,9 +437,12 @@ async def update_local_key(self):
435
437
# Update Gateway ID and IP
436
438
new_gw = get_gateway_by_deviceid (dev_id , cloud_devs )
437
439
new_data [CONF_DEVICES ][dev_id ][CONF_GATEWAY_ID ] = new_gw .id
440
+ self .info (f"{ dev_id } new gateway ID: { new_gw .id } " )
438
441
if discovery and (local_gw := discovery .devices .get (new_gw .id )):
439
442
new_ip = local_gw .get (CONF_TUYA_IP , self ._device_config .host )
440
443
new_data [CONF_DEVICES ][dev_id ][CONF_HOST ] = new_ip
444
+ self .info (f"Updated { dev_id } IP: { new_ip } " )
445
+
441
446
self .info (f"Updated informations for sub-device { dev_id } ." )
442
447
443
448
new_data [CONF_DEVICES ][dev_id ][CONF_LOCAL_KEY ] = self ._local_key
You can’t perform that action at this time.
0 commit comments