| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| """Implementation of matter module.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from ...feature import Feature | ||
| from ..smartmodule import SmartModule | ||
|
|
||
|
|
||
| class Matter(SmartModule): | ||
| """Implementation of matter module.""" | ||
|
|
||
| QUERY_GETTER_NAME: str = "get_matter_setup_info" | ||
| 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 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| from kasa import Module | ||
| from kasa.smart import SmartDevice | ||
|
|
||
| from ...device_fixtures import parametrize | ||
|
|
||
| matter = parametrize( | ||
| "has matter", component_filter="matter", protocol_filter={"SMART", "SMARTCAM"} | ||
| ) | ||
|
|
||
|
|
||
| @matter | ||
| async def test_info(dev: SmartDevice): | ||
| """Test matter info.""" | ||
| matter = dev.modules.get(Module.Matter) | ||
| assert matter | ||
| assert matter.info | ||
| setup_code = dev.features.get("matter_setup_code") | ||
| assert setup_code | ||
| setup_payload = dev.features.get("matter_setup_payload") | ||
| assert setup_payload |
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.