Add new single_config_entry manifest option (#2074)

* Add new `single_instance_only` manifest option

* Add dev blog about manifest option

* change version

* Rename

* Apply code review suggestions
This commit is contained in:
Jan-Philipp Benecke 2024-02-26 22:50:47 +01:00 committed by GitHub
parent a3fd00696a
commit 7921fa1787
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,14 @@
---
author: Jan-Philipp Benecke
authorURL: https://github.com/jpbede
authorImageURL: https://avatars.githubusercontent.com/u/3989428?s=96&v=4
title: "New single instance only manifest option"
---
In Home Assistant 2024.3, we introduced a new `single_config_entry` option for the integration manifest file.
This option allows you to set that your integration supports only one config entry.
Home Assistant will take care and prevent the initialization of a config flow if there is already a config entry for the integration.
This way you won't have to implement any check in the config flow.
Integrations that have this option not set in their manifest and do the check in the config flow should replace it with the new option.

View File

@ -116,6 +116,16 @@ Specify the `config_flow` key if your integration has a config flow to create a
} }
``` ```
### Single config entry only
Specify the `single_config_entry` key if your integration supports only one config entry. When specified, it will not allow the user to add more than one config entry for this integration.
```json
{
"single_config_entry": true
}
```
## Requirements ## Requirements
Requirements are Python libraries or modules that you would normally install using `pip` for your component. Home Assistant will try to install the requirements into the `deps` subdirectory of the Home Assistant [configuration directory](https://www.home-assistant.io/docs/configuration/) if you are not using a `venv` or in something like `path/to/venv/lib/python3.6/site-packages` if you are running in a virtual environment. This will make sure that all requirements are present at startup. If steps fail, like missing packages for the compilation of a module or other install errors, the component will fail to load. Requirements are Python libraries or modules that you would normally install using `pip` for your component. Home Assistant will try to install the requirements into the `deps` subdirectory of the Home Assistant [configuration directory](https://www.home-assistant.io/docs/configuration/) if you are not using a `venv` or in something like `path/to/venv/lib/python3.6/site-packages` if you are running in a virtual environment. This will make sure that all requirements are present at startup. If steps fail, like missing packages for the compilation of a module or other install errors, the component will fail to load.