query dns data point less often

This commit is contained in:
tomaae 2020-04-13 07:02:10 +02:00
parent 3129af46b8
commit 17cb7c6ee8

View file

@ -254,6 +254,7 @@ class MikrotikControllerData:
await self.hass.async_add_executor_job(self.get_system_resource) await self.hass.async_add_executor_job(self.get_system_resource)
await self.hass.async_add_executor_job(self.get_script) await self.hass.async_add_executor_job(self.get_script)
await self.hass.async_add_executor_job(self.get_dhcp_network) await self.hass.async_add_executor_job(self.get_dhcp_network)
await self.hass.async_add_executor_job(self.get_dns)
self.lock.release() self.lock.release()
# --------------------------- # ---------------------------
@ -361,7 +362,6 @@ class MikrotikControllerData:
await self.hass.async_add_executor_job(self.get_interface) await self.hass.async_add_executor_job(self.get_interface)
await self.hass.async_add_executor_job(self.get_bridge) await self.hass.async_add_executor_job(self.get_bridge)
await self.hass.async_add_executor_job(self.get_arp) await self.hass.async_add_executor_job(self.get_arp)
await self.hass.async_add_executor_job(self.get_dns)
await self.hass.async_add_executor_job(self.get_dhcp) await self.hass.async_add_executor_job(self.get_dhcp)
await self.async_process_host() await self.async_process_host()
await self.hass.async_add_executor_job(self.get_interface_traffic) await self.hass.async_add_executor_job(self.get_interface_traffic)
@ -776,7 +776,6 @@ class MikrotikControllerData:
# --------------------------- # ---------------------------
def get_dns(self): def get_dns(self):
"""Get static DNS data from Mikrotik""" """Get static DNS data from Mikrotik"""
# TODO: run less often or on demand
self.data["dns"] = parse_api( self.data["dns"] = parse_api(
data=self.data["dns"], data=self.data["dns"],
source=self.api.path("/ip/dns/static"), source=self.api.path("/ip/dns/static"),