Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ The following devices have been tested and confirmed as working. If your device
- **Bulbs**: L510B, L510E, L530E
- **Light Strips**: L900-10, L900-5, L920-5, L930-5
- **Hubs**: H100
- **Hub-Connected Devices<sup>\*\*\*</sup>**: T110, T300, T310, T315
- **Hub-Connected Devices<sup>\*\*\*</sup>**: T100, T110, T300, T310, T315

<!--SUPPORTED_END-->
<sup>\*</sup>&nbsp;&nbsp; Model requires authentication<br>
Expand Down
2 changes: 2 additions & 0 deletions SUPPORTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ All Tapo devices require authentication.<br>Hub-Connected Devices may work acros

### Hub-Connected Devices

- **T100**
- Hardware: 1.0 (EU) / Firmware: 1.12.0
- **T110**
- Hardware: 1.0 (EU) / Firmware: 1.8.0
- **T300**
Expand Down
1 change: 1 addition & 0 deletions kasa/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class Module(ABC):
LightTransition: Final[ModuleName[smart.LightTransition]] = ModuleName(
"LightTransition"
)
MotionSensor: Final[ModuleName[smart.MotionSensor]] = ModuleName("MotionSensor")
ReportMode: Final[ModuleName[smart.ReportMode]] = ModuleName("ReportMode")
SmartLightEffect: Final[ModuleName[smart.SmartLightEffect]] = ModuleName(
"LightEffect"
Expand Down
2 changes: 2 additions & 0 deletions kasa/smart/modules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
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
Expand Down Expand Up @@ -54,6 +55,7 @@
"Color",
"WaterleakSensor",
"ContactSensor",
"MotionSensor",
"FrostProtection",
"SmartLightEffect",
]
36 changes: 36 additions & 0 deletions kasa/smart/modules/motionsensor.py
Original file line number Diff line number Diff line change
@@ -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"]
2 changes: 1 addition & 1 deletion kasa/tests/device_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
}

HUBS_SMART = {"H100", "KH100"}
SENSORS_SMART = {"T310", "T315", "T300", "T110"}
SENSORS_SMART = {"T310", "T315", "T300", "T100", "T110"}
THERMOSTATS_SMART = {"KE100"}

WITH_EMETER_IOT = {"HS110", "HS300", "KP115", "KP125", *BULBS_IOT}
Expand Down
Loading