Skip to content

Commit

Permalink
Fix problem with UI freezing during data update
Browse files Browse the repository at this point in the history
  • Loading branch information
astraliens committed Apr 17, 2023
1 parent be6a457 commit c0af962
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion custom_components/inverter_xpert_king/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ async def _async_update_data(self):
# data retrieved from API.
listening_idx = set(self.async_contexts())
#return await self.hub.fetch_data(listening_idx)
return await self.hub.inverter_client.GetInverterDataByCommand('data')
return await self.hass.async_add_executor_job(self.hub.inverter_client.GetInverterDataByCommandSync,'data') # nedd to avoid problem with UI freezing during data update process
#return await self.hub.inverter_client.GetInverterDataByCommand('data')

except Exception as e:
s = str(e)
Expand Down

0 comments on commit c0af962

Please sign in to comment.