Giter Club home page Giter Club logo

micropython-mdns's Introduction

Micropython MDNS

PyPi MIT licensed

Image showing service discovery

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

Intended Audience

You should not use this library if you "just" require MDNS A record lookup and Host annoucement if there is already baked in support in your MicroPython distribution. This is for example the case with the default ESP32 MicroPython distribution since v1.12. This will be in all cases more resource efficient.

If you, however, require additional functionality like Service Discovery and Annoucement, you should use this library. It supports all functionality of existing basic MDNS implementations plus these features so you will not loose any functionality.

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.mp.1.13.bin which is MicroPython 1.13 with MDNS disabled as well as a firmware.mp.1.15.bin for MicroPython 1.15 in each release for easy usage. Both can also be built when having docker locally installed by running in the console the build command:

make build

Individually it is also possible to build the desired version via:

make compile-micropython-1-13
make compile-micropython-1-15

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.

micropython-mdns's People

Contributors

cbrand avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.