[DHCP] add configuration options

Current issue

Currently, there’s one configuration choice for users: omitting the dhcp: key from your configuration.

In order to do so, you must stop using default_config:. Meaning you effectively “stop receiving updates” for every other entry in the default config.

Feature request

Offer a few configuration options for the DHCP discovery integration, such that:

  • Users don’t need to avoid default_config: to manage the DHCP behavior.
  • Users gain more granular control over it’s behavior as a nice bonus.

Examples

There is an active scanner, and passive listener part in the integration. (source)
These might have their own enable/disable option.

dhcp:
  passive_watcher: true
  active_watcher: true

The active scan also has a fixed interval of 1 hour (source).
This might be a good tuning parameter.

dhcp:
  # Daily, rather than hourly.
  scan_interval_minutes: 1440

Motivation for configuration

The active scan in particular is not very efficient compared to discovery methods that can leverage multicast. There are multiple reports of the DNS PTR “request spam”. A necessary evil for this discovery approach to work.

In many scenarios ~250 probes per hour with a high cache ratio may be a totally reasonable load. And for the out-of-box experience for new hass installs, it makes sense to include many discovery methods.

But in other scenarios it might not be justified. For instance when:

  • The load is noticeable for under-powered networking equipment.
    Like a small pi-hole, router-firewall appliance, etc.
  • Because of network segmentation this method won’t find anything.
  • The devices you care about also support other options like ssdp or zeroconf.
  • Your network is stable / you’re not actively adding devices.

Any of those could be valid reasons to disable dhcp: after an initial setup round.

In my case, I have found the additional load to be unnecessary and causing minor issues here and there, so I’d like to substantially reduce or disable the active scans.

Motivation for keeping default_config:

In my case, I would like to install hass for someone else who’s less of a tinkerer. So low maintenance matters to me. I would expect them to run multiple updates without me actively monitoring this.

The defaults may change over time. New integrations could be promoted to defaults. Existing settings could be superseded by better ones. Etc.

So for this low-maintenance installation I would like to leverage the community’s wisdom and keep default_config: with minimal overrides.