mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-10-13 02:48:07 +00:00
Rename smartcamera to smartcam (#1300)
This commit is contained in:
28
kasa/smartcam/modules/led.py
Normal file
28
kasa/smartcam/modules/led.py
Normal file
@@ -0,0 +1,28 @@
|
||||
"""Module for led controls."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from ...interfaces.led import Led as LedInterface
|
||||
from ..smartcammodule import SmartCamModule
|
||||
|
||||
|
||||
class Led(SmartCamModule, LedInterface):
|
||||
"""Implementation of led controls."""
|
||||
|
||||
REQUIRED_COMPONENT = "led"
|
||||
QUERY_GETTER_NAME = "getLedStatus"
|
||||
QUERY_MODULE_NAME = "led"
|
||||
QUERY_SECTION_NAMES = "config"
|
||||
|
||||
@property
|
||||
def led(self) -> bool:
|
||||
"""Return current led status."""
|
||||
return self.data["config"]["enabled"] == "on"
|
||||
|
||||
async def set_led(self, enable: bool) -> dict:
|
||||
"""Set led.
|
||||
|
||||
This should probably be a select with always/never/nightmode.
|
||||
"""
|
||||
params = {"enabled": "on"} if enable else {"enabled": "off"}
|
||||
return await self.call("setLedStatus", {"led": {"config": params}})
|
Reference in New Issue
Block a user