Skip to content

Zeroconf API

mopidy.zeroconf

Classes:

  • Zeroconf

    Publish a network service with Zeroconf.

Zeroconf

Zeroconf(
    name: str,
    stype: str,
    port: int,
    domain: str = "",
    host: str = "",
    text: list[str] | None = None,
)

Publish a network service with Zeroconf.

Currently, this only works on Linux using Avahi via D-Bus.

Parameters:

  • name

    (str) –

    Human readable name of the service, e.g. 'MPD on neptune'.

  • stype

    (str) –

    Service type, e.g. '_mpd._tcp'.

  • port

    (int) –

    TCP port of the service, e.g. 6600.

  • domain

    (str, default: '' ) –

    Local network domain name, defaults to ''.

  • host

    (str, default: '' ) –

    Interface to advertise the service on, defaults to ''.

  • text

    (list[str] | None, default: None ) –

    Extra information depending on stype, defaults to empty list.

Methods:

publish

publish() -> bool

Publish the service.

Call when your service starts.

unpublish

unpublish() -> None

Unpublish the service.

Call when your service shuts down.