Skip to main content

MDNS for micropython with service discovery support

Project description

Micropython MDNS

PyPi MIT licensed

Image showing service discovery

A pure Python implementation of MDNS and the Service Discovery protocol over MDNS for MicroPython.

Installation

The library is available on PyPi and can be installed via upip.

import upip
upip.install("micropython-mdns")

For using this library, native C type implementations of MDNS which use the MDNS service port need to be disabled. For example, this project has been developed on the ESP32 which MicroPython implementation per default has a basic MDNS implementation available. This does only support local A record lookups and A record responding of its own host address.

The releases page on this project publishes a firmware.bin which is MicroPython 1.13 with MDNS disabled in each release for easy usage. It can also be built when having docker locally installed by running in the console the build command:

make build

Refer to the config directory to see the configuration files when baking this into your own MicroPython ESP32 build.

Other MicroPython implementations might not require any changes inside of the firmware.

Usage

The library requires uasyncio to function. All handling is done asynchronously.

Examples on how to utilize the libraries can be found in the examples folder.

Reference

A basic API reference for the public API is inside of the REFERENCE.md.

Caveats

  • Depending on your MicroPython implementation, you must disable MDNS in the firmware.
  • Currently no support for IPv6 is implemented.
  • Depending how chatty the network is, service responders and discovery might require a lot of memory. If the memory is filled by the buffer of the underlying socket, the socket is closed and reopened which looses data. It, however, seems to work fine enough in tests on an ESP32 without external memory. Depending on the project size, a module with external RAM might be advisable.

License

The library is published under the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

micropython-mdns-0.9.1.tar.gz (16.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page