From bdd6ab840c14776296f3fc480cb625734b460b00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Lov=C3=A9n?= Date: Wed, 19 Oct 2022 21:17:19 +0200 Subject: [PATCH] Don't allow multiple instances --- custom_components/plejd/config_flow.py | 2 ++ custom_components/plejd/translations/en.json | 3 +++ 2 files changed, 5 insertions(+) diff --git a/custom_components/plejd/config_flow.py b/custom_components/plejd/config_flow.py index 6a64955..c17882c 100644 --- a/custom_components/plejd/config_flow.py +++ b/custom_components/plejd/config_flow.py @@ -13,6 +13,8 @@ class PlejdConfigFlow(ConfigFlow, domain="plejd"): async def async_step_user(self, info=None): if info is None: + if self._async_current_entries(): + return self.async_abort(reason="single_instance_allowed") return self.async_show_form( step_id="user", data_schema=vol.Schema( diff --git a/custom_components/plejd/translations/en.json b/custom_components/plejd/translations/en.json index f57a3ba..05479f4 100644 --- a/custom_components/plejd/translations/en.json +++ b/custom_components/plejd/translations/en.json @@ -1,6 +1,9 @@ { "title": "Plejd", "config": { + "abort": { + "single_instance_allowed": "Only one Plejd instance at a time is currently supported." + }, "step": { "user": { "title": "Log in to Plejd",