mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-07-29 15:04:31 +02:00
separated DHCP data point from host processing
This commit is contained in:
parent
af9b653f3c
commit
f0fc6f3c25
1 changed files with 15 additions and 4 deletions
|
@ -60,6 +60,7 @@ class MikrotikControllerData:
|
||||||
"queue": {},
|
"queue": {},
|
||||||
"dhcp-server": {},
|
"dhcp-server": {},
|
||||||
"dhcp": {},
|
"dhcp": {},
|
||||||
|
"host": {},
|
||||||
}
|
}
|
||||||
|
|
||||||
self.listeners = []
|
self.listeners = []
|
||||||
|
@ -197,6 +198,8 @@ class MikrotikControllerData:
|
||||||
await self.hass.async_add_executor_job(self.get_queue)
|
await self.hass.async_add_executor_job(self.get_queue)
|
||||||
await self.hass.async_add_executor_job(self.get_dhcp)
|
await self.hass.async_add_executor_job(self.get_dhcp)
|
||||||
|
|
||||||
|
await self.hass.async_add_executor_job(self.process_host)
|
||||||
|
|
||||||
async_dispatcher_send(self.hass, self.signal_update)
|
async_dispatcher_send(self.hass, self.signal_update)
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
|
|
||||||
|
@ -694,8 +697,16 @@ class MikrotikControllerData:
|
||||||
)
|
)
|
||||||
|
|
||||||
for uid in self.data["dhcp"]:
|
for uid in self.data["dhcp"]:
|
||||||
self.data["dhcp"][uid]['interface'] = \
|
self.data["dhcp"][uid]["interface"] = \
|
||||||
self.data["dhcp-server"][self.data["dhcp"][uid]['server']]["interface"]
|
self.data["dhcp-server"][self.data["dhcp"][uid]["server"]]["interface"]
|
||||||
|
|
||||||
self.data["dhcp"][uid]['available'] = \
|
# ---------------------------
|
||||||
self.api.arp_ping(self.data["dhcp"][uid]['address'], self.data["dhcp"][uid]['interface'])
|
# process_host
|
||||||
|
# ---------------------------
|
||||||
|
def process_host(self):
|
||||||
|
"""Get host tracking data"""
|
||||||
|
|
||||||
|
for uid in self.data["dhcp"]:
|
||||||
|
# TODO: set last-seen to now
|
||||||
|
self.data["dhcp"][uid]["available"] = \
|
||||||
|
self.api.arp_ping(self.data["dhcp"][uid]["address"], self.data["dhcp"][uid]["interface"])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue