mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-07-02 21:44:31 +02:00
Fix for naming of static DNS entries without host-name and static DNS entry. Fallback value is not mac-address
This commit is contained in:
parent
069897c32c
commit
3c44445cd1
2 changed files with 7 additions and 5 deletions
|
@ -788,9 +788,12 @@ class MikrotikControllerData:
|
|||
# Then static DNS entry
|
||||
elif vals['address'] in dns_data and str(dns_data[vals['address']].get('name', '').strip()):
|
||||
self.data["accounting"][mac]['name'] = dns_data[vals['address']]['name']
|
||||
# If everything fails use hosts DHCP lease host-name
|
||||
else:
|
||||
# Then DHCP lease host-name
|
||||
elif str(vals.get('host-name', '').strip()):
|
||||
self.data["accounting"][mac]['name'] = vals['host-name']
|
||||
# If everything fails fallback to device's MAC address
|
||||
else:
|
||||
self.data["accounting"][mac]['name'] = vals['mac-address']
|
||||
|
||||
_LOGGER.debug(f"Generated {len(self.data['accounting'])} accounting devices")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue