diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2024-02-17 02:48:57 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2024-02-17 02:48:57 +0300 |
commit | b7f1d55c9b4de4d21b11e5615a5dc8be0d4e883c (patch) | |
tree | df3cba57518e21590d579b014867611002d92de5 /include/py/homekit/modem/config.py | |
parent | c4ace358182d1f58724336714490e3caac6b60df (diff) | |
parent | 05c85757b8e2340441057d9ddfde2e9649ae8676 (diff) |
Merge branch 'website-python-rewrite'
Diffstat (limited to 'include/py/homekit/modem/config.py')
-rw-r--r-- | include/py/homekit/modem/config.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/py/homekit/modem/config.py b/include/py/homekit/modem/config.py new file mode 100644 index 0000000..16d1ba0 --- /dev/null +++ b/include/py/homekit/modem/config.py @@ -0,0 +1,29 @@ +from ..config import ConfigUnit, Translation +from typing import Optional + + +class ModemsConfig(ConfigUnit): + NAME = 'modems' + + _strings: Translation + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self._strings = Translation('modems') + + @classmethod + def schema(cls) -> Optional[dict]: + return { + 'type': 'dict', + 'schema': { + 'ip': cls._addr_schema(required=True, only_ip=True), + 'gateway_ip': cls._addr_schema(required=False, only_ip=True), + 'legacy_auth': {'type': 'boolean', 'required': True} + } + } + + def getshortname(self, modem: str, lang=Translation.DEFAULT_LANGUAGE): + return self._strings.get(lang)[modem]['short'] + + def getfullname(self, modem: str, lang=Translation.DEFAULT_LANGUAGE): + return self._strings.get(lang)[modem]['full']
\ No newline at end of file |