Add support for registered_devices to DHCP (#1212)

This commit is contained in:
J. Nick Koston 2022-02-16 05:18:38 -06:00 committed by GitHub
parent 95478ed3c7
commit 66a547f18b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -200,7 +200,11 @@ MQTT discovery works by subscribing to MQTT topics specified in the manifest.jso
## DHCP
If your integration supports discovery via dhcp, you can add the type to your manifest. If the user has the `dhcp` integration loaded, it will load the `dhcp` step of your integration's config flow when it is discovered. We support passively listening for DHCP discovery by the `hostname` and [OUI](https://en.wikipedia.org/wiki/Organizationally_unique_identifier). The manifest value is a list of matcher dictionaries, your integration is discovered if all items of any of the specified matchers are found in the DHCP data. It's up to your config flow to filter out duplicates.
If your integration supports discovery via dhcp, you can add the type to your manifest. If the user has the `dhcp` integration loaded, it will load the `dhcp` step of your integration's config flow when it is discovered. We support passively listening for DHCP discovery by the `hostname` and [OUI](https://en.wikipedia.org/wiki/Organizationally_unique_identifier), or matching device registry mac address when `registered_devices` is set to `true`. The manifest value is a list of matcher dictionaries, your integration is discovered if all items of any of the specified matchers are found in the DHCP data. It's up to your config flow to filter out duplicates.
If an integration wants to receive discovery flows to update the IP Address of a device when it comes
online, but a `hostname` or `oui` match would be too broad, and it has registered in the device registry with mac address using the `CONNECTION_NETWORK_MAC`,
it should add a DHCP entry with `registered_devices` set to `true`.
If the integration supports `zeroconf` or `ssdp`, these should be preferred over `dhcp` as it generally offers a better
user experience.
@ -233,6 +237,21 @@ For example:
}
```
Example with setting `registered_devices` to `true`:
```json
{
"dhcp": [
{
"hostname": "myintegration-*",
},
{
"registered_devices": true,
}
]
}
```
## USB
If your integration supports discovery via usb, you can add the type to your manifest. If the user has the `usb` integration loaded, it will load the `usb` step of your integration's config flow when it is discovered. We support discovery by VID (Vendor ID), PID (Device ID), Serial Number, Manufacturer, and Description by extracting these values from the USB descriptor. For help identifiying these values see [How To Identify A Device](https://wiki.debian.org/HowToIdentifyADevice/USB). The manifest value is a list of matcher dictionaries. Your integration is discovered if all items of any of the specified matchers are found in the USB data. It's up to your config flow to filter out duplicates.