mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 11:13:34 +00:00
b5f49a3c8a
Some checks are pending
CI / Perform linting checks (3.13) (push) Waiting to run
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.11) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.12) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.13) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.11) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.12) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.13) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.11) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.12) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.13) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.11) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.12) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.13) (push) Blocked by required conditions
CodeQL checks / Analyze (python) (push) Waiting to run
Fixes a few issues with the lens mask since migrating it into its own module: - The module didn't provide itself as the container and hence the feature was accessing the same properties on the device. - `enabled` getter on the module incorrect but not picked up due to the previous issue. - No `REQUIRED_COMPONENT` set to ensure the module only created if available. Also changes attribute names to `enabled` from `state` to avoid confusion with device states.
32 lines
876 B
Python
32 lines
876 B
Python
"""Implementation of lens mask privacy module."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import logging
|
|
|
|
from ..smartcammodule import SmartCamModule
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
class LensMask(SmartCamModule):
|
|
"""Implementation of lens mask module."""
|
|
|
|
REQUIRED_COMPONENT = "lensMask"
|
|
|
|
QUERY_GETTER_NAME = "getLensMaskConfig"
|
|
QUERY_MODULE_NAME = "lens_mask"
|
|
QUERY_SECTION_NAMES = "lens_mask_info"
|
|
|
|
@property
|
|
def enabled(self) -> bool:
|
|
"""Return the lens mask state."""
|
|
return self.data["lens_mask_info"]["enabled"] == "on"
|
|
|
|
async def set_enabled(self, enable: bool) -> dict:
|
|
"""Set the lens mask state."""
|
|
params = {"enabled": "on" if enable else "off"}
|
|
return await self._device._query_setter_helper(
|
|
"setLensMaskConfig", self.QUERY_MODULE_NAME, "lens_mask_info", params
|
|
)
|