Update agent_unifi_controller: handle device names

UniFi UI allows people to create device names with blanks - of course these don't end up as valid hostnames.

This is a very simplistic fix that replaces blanks with underscores.
It allows for piggyback processing of the devices.
This commit is contained in:
Florian Heigl 2023-11-23 03:50:11 +01:00 committed by GitHub
parent f3646613fd
commit c4891a4318
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -337,7 +337,7 @@ class unifi_device(unifi_object):
def __str__(self):
if self._piggy_back:
_piggybackname = getattr(self,self._API.PIGGYBACK_ATTRIBUT,self.name)
_piggybackname = getattr(self,self._API.PIGGYBACK_ATTRIBUT,self.name).replace(" ", "_")
_ret = [f"<<<<{_piggybackname}>>>>"]
else:
_ret = []