summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2023-06-11 14:02:47 +0300
committerEvgeny Zinoviev <me@ch1p.io>2023-06-11 14:02:47 +0300
commit5d8e81b6c8fc7abe75188007c6a86bb501a314ad (patch)
tree8e6567b92dec35f067d15c96a216631f494fd5bf
parent58b5a1b5fca1cd898b1121778a3205ce2dafae36 (diff)
config: turn ConfigUnit into singleton
-rw-r--r--include/py/homekit/config/config.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/py/homekit/config/config.py b/include/py/homekit/config/config.py
index f2a3990..29364af 100644
--- a/include/py/homekit/config/config.py
+++ b/include/py/homekit/config/config.py
@@ -76,6 +76,13 @@ class BaseConfigUnit(ABC):
class ConfigUnit(BaseConfigUnit):
NAME = 'dumb'
+ _instance = None
+
+ def __new__(cls, *args, **kwargs):
+ if cls._instance is None:
+ cls._instance = super(ConfigUnit, cls).__new__(cls, *args, **kwargs)
+ return cls._instance
+
def __init__(self, name=None, load=True):
super().__init__()