@@ -41,18 +41,19 @@ async def _async_update_data(self):
41
41
try :
42
42
return await self .hass .async_add_executor_job (self .api .fetch_data )
43
43
except WemPortalError as exc :
44
+ # if isinstance(exc.__cause__, (ServerError, ForbiddenError)):
45
+ _LOGGER .error ("Creating new wemportal api instance" )
46
+ # TODO: This is a temporary solution and should be removed when api cause from #28 is resolved
47
+ try :
48
+ new_api = WemPortalApi (
49
+ self .config_entry .data .get (CONF_USERNAME ),
50
+ self .config_entry .data .get (CONF_PASSWORD ),
51
+ self .config_entry .options ,
52
+ )
53
+ self .api = new_api
54
+ except Exception as exc2 :
55
+ raise UpdateFailed from exc2
44
56
if isinstance (exc .__cause__ , (ServerError , ForbiddenError )):
45
- _LOGGER .error ("Creating new wemportal api instance" )
46
- # TODO: This is a temporary solution and should be removed when api cause from #28 is resolved
47
- try :
48
- new_api = WemPortalApi (
49
- self .config_entry .data .get (CONF_USERNAME ),
50
- self .config_entry .data .get (CONF_PASSWORD ),
51
- self .config_entry .options ,
52
- )
53
- self .api = new_api
54
- except Exception as exc2 :
55
- raise UpdateFailed from exc2
56
57
try :
57
58
return await self .hass .async_add_executor_job (
58
59
self .api .fetch_data
@@ -63,5 +64,7 @@ async def _async_update_data(self):
63
64
)
64
65
raise UpdateFailed from exc2
65
66
else :
66
- _LOGGER .error ("Error fetching data from wemportal" , exc_info = exc )
67
67
raise UpdateFailed from exc
68
+ # else:
69
+ # _LOGGER.error("Error fetching data from wemportal", exc_info=exc)
70
+ # raise UpdateFailed from exc
0 commit comments