From 7921fa17873e272ff3ebbc07b7db5afc0fc6cb87 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Benecke Date: Mon, 26 Feb 2024 22:50:47 +0100 Subject: [PATCH] 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 --- ...4-02-26-single-instance-only-manifest-option.md | 14 ++++++++++++++ docs/creating_integration_manifest.md | 10 ++++++++++ 2 files changed, 24 insertions(+) create mode 100644 blog/2024-02-26-single-instance-only-manifest-option.md diff --git a/blog/2024-02-26-single-instance-only-manifest-option.md b/blog/2024-02-26-single-instance-only-manifest-option.md new file mode 100644 index 00000000..80f42fcb --- /dev/null +++ b/blog/2024-02-26-single-instance-only-manifest-option.md @@ -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. \ No newline at end of file diff --git a/docs/creating_integration_manifest.md b/docs/creating_integration_manifest.md index bbbf49e7..d599850d 100644 --- a/docs/creating_integration_manifest.md +++ b/docs/creating_integration_manifest.md @@ -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 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.