Skip to content

Add support for mDNS registration #373

Open
@fadushin

Description

@fadushin

In order to interoperate with services like Home Assistant, it would be good if a device running AtomVM could register services it is running via mDNS.

Proposal:

Augment the current network interface to allow configuration of mDNS entries, when the device is configured in STA mode.

This change just requires the addition of an optional field in the STA configuration. If the mDNS configuration is not present, mDNS is not initialized. Otherwise, mDNS is initialized, as each entry in configuration is added to the internal mdns server. Note that this list may be empty, though at present there would be no use case for this. (In the future, we may want to add an API for mDNS query, but this issue only addresses registration).

Here is the suggested type specification:

-type sta_config_property() ::
    ssid_config()
    | psk_config()
    | dhcp_hostname_config()
    | mdns_config(),   %% <-- new
    | sta_connected_config()
    | sta_disconnected_config()
    | sta_got_ip_config().

-type mdns_config() :: {mdns, [mdns_entry()]}.
-type mdns_entry() ::
    [
        {service_name, string()}, %% optional
        {protocol, tcp | udp}, %% required
        {port, port_number()}, %% required
        {txt_data, [{string(), string()}]} %% optional
    ].

Note that this proposal does not support modification to mDNS entries after initialization. A future API could be crafted to support this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions