mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Indentify IKEA and Phillips motion sensors correctly (#41111)
This commit is contained in:
parent
a73daa5f20
commit
4aacc87425
@ -143,6 +143,25 @@ class Opening(BinarySensor):
|
|||||||
DEVICE_CLASS = DEVICE_CLASS_OPENING
|
DEVICE_CLASS = DEVICE_CLASS_OPENING
|
||||||
|
|
||||||
|
|
||||||
|
@STRICT_MATCH(
|
||||||
|
channel_names=CHANNEL_ON_OFF,
|
||||||
|
manufacturers="IKEA of Sweden",
|
||||||
|
models=lambda model: isinstance(model, str)
|
||||||
|
and model is not None
|
||||||
|
and model.find("motion") != -1,
|
||||||
|
)
|
||||||
|
@STRICT_MATCH(
|
||||||
|
channel_names=CHANNEL_ON_OFF,
|
||||||
|
manufacturers="Philips",
|
||||||
|
models={"SML001", "SML002"},
|
||||||
|
)
|
||||||
|
class Motion(BinarySensor):
|
||||||
|
"""ZHA BinarySensor."""
|
||||||
|
|
||||||
|
SENSOR_ATTR = "on_off"
|
||||||
|
DEVICE_CLASS = DEVICE_CLASS_MOTION
|
||||||
|
|
||||||
|
|
||||||
@STRICT_MATCH(channel_names=CHANNEL_ZONE)
|
@STRICT_MATCH(channel_names=CHANNEL_ZONE)
|
||||||
class IASZone(BinarySensor):
|
class IASZone(BinarySensor):
|
||||||
"""ZHA IAS BinarySensor."""
|
"""ZHA IAS BinarySensor."""
|
||||||
|
@ -180,10 +180,12 @@ class MatchRule:
|
|||||||
"""
|
"""
|
||||||
weight = 0
|
weight = 0
|
||||||
if self.models:
|
if self.models:
|
||||||
weight += 401 - len(self.models)
|
weight += 401 - (1 if callable(self.models) else len(self.models))
|
||||||
|
|
||||||
if self.manufacturers:
|
if self.manufacturers:
|
||||||
weight += 301 - len(self.manufacturers)
|
weight += 301 - (
|
||||||
|
1 if callable(self.manufacturers) else len(self.manufacturers)
|
||||||
|
)
|
||||||
|
|
||||||
weight += 10 * len(self.channel_names)
|
weight += 10 * len(self.channel_names)
|
||||||
weight += 5 * len(self.generic_ids)
|
weight += 5 * len(self.generic_ids)
|
||||||
|
@ -784,7 +784,7 @@ DEVICES = [
|
|||||||
},
|
},
|
||||||
("binary_sensor", "00:11:22:33:44:55:66:77-1-6"): {
|
("binary_sensor", "00:11:22:33:44:55:66:77-1-6"): {
|
||||||
"channels": ["on_off"],
|
"channels": ["on_off"],
|
||||||
"entity_class": "Opening",
|
"entity_class": "Motion",
|
||||||
"entity_id": "binary_sensor.ikea_of_sweden_tradfri_motion_sensor_77665544_on_off",
|
"entity_id": "binary_sensor.ikea_of_sweden_tradfri_motion_sensor_77665544_on_off",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user