Skip to content

Commit

Permalink
add dedicated motion binary sensor for ms600 (#485)
Browse files Browse the repository at this point in the history
  • Loading branch information
krahabb committed Oct 10, 2024
1 parent b702d7b commit 23ee9ad
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions custom_components/meross_lan/devices/ms600.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import typing

from .. import meross_entity as me
from ..binary_sensor import MLBinarySensor
from ..helpers.namespaces import NamespaceHandler
from ..merossclient import const as mc, namespaces as mn
from ..number import MLConfigNumber
Expand Down Expand Up @@ -199,6 +200,7 @@ class MLPresenceSensor(MLNumericSensor):

__slots__ = (
"sensor_distance",
"binary_sensor_motion",
"sensor_times",
)

Expand All @@ -222,6 +224,9 @@ def __init__(
suggested_display_precision=2,
name="Presence distance",
)
self.binary_sensor_motion = MLBinarySensor(
manager, channel, f"{entitykey}_motion", MLBinarySensor.DeviceClass.MOTION
)
self.sensor_times = MLNumericSensor(
manager,
channel,
Expand All @@ -232,6 +237,7 @@ def __init__(
async def async_shutdown(self):
await super().async_shutdown()
self.sensor_times: MLNumericSensor = None # type: ignore
self.binary_sensor_motion: MLBinarySensor = None # type: ignore
self.sensor_distance: MLNumericSensor = None # type: ignore

def _parse(self, payload: dict):
Expand All @@ -240,4 +246,5 @@ def _parse(self, payload: dict):
"""
self.update_device_value(payload[mc.KEY_VALUE])
self.sensor_distance.update_device_value(payload[mc.KEY_DISTANCE])
self.binary_sensor_motion.update_onoff(payload[mc.KEY_VALUE] == 2)
self.sensor_times.update_device_value(payload[mc.KEY_TIMES])

0 comments on commit 23ee9ad

Please sign in to comment.