Abort config flow for already_configured (#1280)

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
kongo09 2022-04-04 11:40:19 +02:00 committed by GitHub
parent 9baa500e6d
commit 1f6624ffd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,6 +70,17 @@ await self.async_set_unique_id(device_unique_id)
self._abort_if_unique_id_configured()
```
Should the config flow then abort, the text resource with the key `already_configured` from the `abort` part of your `strings.json` will be displayed to the user in the interface as an abort reason.
```json
{
"config": {
"abort": {
"already_configured": "Device is already configured"
}
}
```
By setting a unique ID, users will have the option to ignore the discovery of your config entry. That way, they won't be bothered about it anymore.
If the integration uses DHCP, HomeKit, Zeroconf/mDNS, USB, or SSDP/uPnP to be discovered, supplying a unique ID is required.