mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-06 10:44:04 +00:00
Add support for T100 motion sensor (#1079)
Add support for T100 motion sensor. Thanks to @DarthSonic for the fixture file!
This commit is contained in:
@@ -22,6 +22,7 @@ from .lighteffect import LightEffect
|
||||
from .lightpreset import LightPreset
|
||||
from .lightstripeffect import LightStripEffect
|
||||
from .lighttransition import LightTransition
|
||||
from .motionsensor import MotionSensor
|
||||
from .reportmode import ReportMode
|
||||
from .temperaturecontrol import TemperatureControl
|
||||
from .temperaturesensor import TemperatureSensor
|
||||
@@ -54,6 +55,7 @@ __all__ = [
|
||||
"Color",
|
||||
"WaterleakSensor",
|
||||
"ContactSensor",
|
||||
"MotionSensor",
|
||||
"FrostProtection",
|
||||
"SmartLightEffect",
|
||||
]
|
||||
|
36
kasa/smart/modules/motionsensor.py
Normal file
36
kasa/smart/modules/motionsensor.py
Normal file
@@ -0,0 +1,36 @@
|
||||
"""Implementation of motion sensor module."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from ...feature import Feature
|
||||
from ..smartmodule import SmartModule
|
||||
|
||||
|
||||
class MotionSensor(SmartModule):
|
||||
"""Implementation of motion sensor module."""
|
||||
|
||||
REQUIRED_COMPONENT = "sensitivity"
|
||||
|
||||
def _initialize_features(self):
|
||||
"""Initialize features."""
|
||||
self._add_feature(
|
||||
Feature(
|
||||
self._device,
|
||||
id="motion_detected",
|
||||
name="Motion detected",
|
||||
container=self,
|
||||
attribute_getter="motion_detected",
|
||||
icon="mdi:motion-sensor",
|
||||
category=Feature.Category.Primary,
|
||||
type=Feature.Type.BinarySensor,
|
||||
)
|
||||
)
|
||||
|
||||
def query(self) -> dict:
|
||||
"""Query to execute during the update cycle."""
|
||||
return {}
|
||||
|
||||
@property
|
||||
def motion_detected(self):
|
||||
"""Return True if the motion has been detected."""
|
||||
return self._device.sys_info["detected"]
|
Reference in New Issue
Block a user