4

I'm trying to use python-zeroconf to find a local service. I know it is there - if I use the mDNS discovery app, the service is found almost instantly. However, while using the python-zeroconf example, the service is not found. The obvious difference (to me) is the presence of ".local." in the service type searched for.

Using the mDNS app, I search for the service type '_hwenergy._tcp' (hwenergy being specific to the device I'm trying to find)

If I use this service type in my python code, I get an exception: BadTypeInNameException: Type '_hwenergy._tcp' must end with '.local.'

If I then add '.local.' to the service type, there is no exception. But also nothing found after minutes of waiting.

Q1: Why do I need to add '.local.' in python-zeroconf? Q2: Why can python-zeroconf not find the service type, whereas the mDNS app can?

BTW I am using python 3.7 on a Chromebook, the 'mDNS discovery' app I got from the Google play store, it's running on the same Chromebook. The python-zeroconf version is 0.112.0, installed using pip.

2
  • Did you find anything?
    – overkill
    Commented May 28 at 14:56
  • The .local. suffix is part of the Zeroconf standard to indicate a local network service. The mDNS app may be appending it in the background. According to the Zeroconf documentation, using the service type as _hwenergy._tcp.local. is the correct way to specify a local network service. May need to check your code again to see if you missed anything else.
    – Nesi
    Commented May 30 at 9:33

0

Browse other questions tagged or ask your own question.