From e8c2c4bd1e7e06963502a68cd5e6a6c4336f10cd Mon Sep 17 00:00:00 2001 From: tomaae <23486452+tomaae@users.noreply.github.com> Date: Mon, 28 Dec 2020 12:46:43 +0100 Subject: [PATCH] Moved system health query to regular loop #81 --- custom_components/mikrotik_router/mikrotik_controller.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/custom_components/mikrotik_router/mikrotik_controller.py b/custom_components/mikrotik_router/mikrotik_controller.py index 053e52c..0f1d14c 100644 --- a/custom_components/mikrotik_router/mikrotik_controller.py +++ b/custom_components/mikrotik_router/mikrotik_controller.py @@ -404,9 +404,6 @@ class MikrotikControllerData: if self.api.connected(): await self.hass.async_add_executor_job(self.get_system_resource) - if self.api.connected(): - await self.hass.async_add_executor_job(self.get_system_health) - if self.api.connected() and self.option_sensor_scripts: await self.hass.async_add_executor_job(self.get_script) @@ -571,6 +568,9 @@ class MikrotikControllerData: if self.api.connected() and self.option_sensor_environment: await self.hass.async_add_executor_job(self.get_environment) + if self.api.connected(): + await self.hass.async_add_executor_job(self.get_system_health) + async_dispatcher_send(self.hass, self.signal_update) self.lock.release()