python-zeroconf
python-zeroconf copied to clipboard
Using sub type, avahi-browse does not show filtered on type. Is sub type implementation correct?
Using avahi-browseon a Ubuntu 18.04 I want to check that my service publishing works.
With avahi-browse -ar I expect to see all services.
With avahi-browse -r _zmq._tcp I expect to see only services of type _zmq._tcp including those with a sub type.
To test this I do avahi-publish-service --subtype=_foo._sub._zmq._tcp foo _zmq._tcp 9099 and the above commands show as expected.
I then use the following code to publish a service with sub type with python 3.7 and zeroconf 0.28.4:
from zeroconf import IPVersion, Zeroconf, ServiceInfo
import socket
if __name__ == "__main__":
zeroconf = Zeroconf(ip_version=IPVersion.All)
service_info = ServiceInfo(f"_bar._sub._zmq._tcp.local.",
f"bar._zmq._tcp.local.",
port=int(9090),
server=f"{socket.gethostname()}.local."
)
zeroconf.register_service(service_info, allow_name_change=True)
try:
input("Press enter to exit...\n\n")
finally:
zeroconf.unregister_all_services()
zeroconf.close()
avahi-browse -arwill show the service..
avahi-browse -r _zmq._tcp will not.
There don't seem to be many people using sub type and the documentation is rather short. Did I do something wrong in my code?
Is there anyone else using subtype at all?