class DeviceInfo: """Device information class, used to identify and connect Attributes ip: IP address (ipv4 only) of the physical device port: Usually this will always be 7000 mac: mac address, in the format 'aabbcc112233' name: Name of unit, if available """ def __init__(self, ip, port, mac, name, brand=None, model=None, version=None): self.ip = ip self.port = port self.mac = mac self.name = name if name else mac.replace(":", "") self.brand = brand self.model = model self.version = version def __str__(self): return f"Device: {self.name} @ {self.ip}:{self.port} (mac: {self.mac})" def __eq__(self, other): """Check equality based on Device Info properties""" if isinstance(other, DeviceInfo): return ( self.mac == other.mac and self.name == other.name and self.brand == other.brand and self.model == other.model and self.version == other.version ) return False def __ne__(self, other): """Check inequality based on Device Info properties""" return not self.__eq__(other)