From 6ded929af12f562fcf11c543a5c3b9bd740282ef Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Sun, 23 May 2021 10:13:53 +0200 Subject: [PATCH] Fix executor job --- kumisensors.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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."""