Add bare-bones matter modules to smart and smartcam devices (#1371)

This commit is contained in:
Steven B.
2024-12-13 19:45:38 +00:00
committed by GitHub
parent 223f3318ea
commit 2ca6d3ebe9
12 changed files with 183 additions and 12 deletions

View File

@@ -5,6 +5,7 @@ from .camera import Camera
from .childdevice import ChildDevice
from .device import DeviceModule
from .led import Led
from .matter import Matter
from .pantilt import PanTilt
from .time import Time
@@ -16,4 +17,5 @@ __all__ = [
"Led",
"PanTilt",
"Time",
"Matter",
]

View File

@@ -0,0 +1,44 @@
"""Implementation of matter module."""
from __future__ import annotations
from ...feature import Feature
from ..smartcammodule import SmartCamModule
class Matter(SmartCamModule):
"""Implementation of matter module."""
QUERY_GETTER_NAME = "getMatterSetupInfo"
QUERY_MODULE_NAME = "matter"
REQUIRED_COMPONENT = "matter"
def _initialize_features(self) -> None:
"""Initialize features after the initial update."""
self._add_feature(
Feature(
self._device,
id="matter_setup_code",
name="Matter setup code",
container=self,
attribute_getter=lambda x: x.info["setup_code"],
type=Feature.Type.Sensor,
category=Feature.Category.Debug,
)
)
self._add_feature(
Feature(
self._device,
id="matter_setup_payload",
name="Matter setup payload",
container=self,
attribute_getter=lambda x: x.info["setup_payload"],
type=Feature.Type.Sensor,
category=Feature.Category.Debug,
)
)
@property
def info(self) -> dict[str, str]:
"""Matter setup info."""
return self.data