diff --git a/kumisensors.py b/kumisensors.py index f01f42c..8226e8d 100644 --- a/kumisensors.py +++ b/kumisensors.py @@ -15,8 +15,11 @@ class KumiSensors: self.host = host self.hass = hass + def fetch_data(self) -> dict: + return json.load(urlopen(self.host)) + async def get_data(self) -> dict: - return await self.hass.async_add_executor_job(json.load(urlopen(self.host))) + return await self.hass.async_add_executor_job(self.fetch_data) async def connect(self) -> bool: """Test if we can connect to the host."""