From 12059e4ee55a5d6bcf87fb0c44a483df0294e524 Mon Sep 17 00:00:00 2001 From: kei81131 <111072203+kei81131@users.noreply.github.com> Date: Fri, 29 Nov 2024 15:58:25 +0800 Subject: [PATCH 1/2] Add support for linp.sensor_occupy.es3 --- custom_components/xiaomi_gateway3/core/devices.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/custom_components/xiaomi_gateway3/core/devices.py b/custom_components/xiaomi_gateway3/core/devices.py index cb2cc4c9..02833d3a 100644 --- a/custom_components/xiaomi_gateway3/core/devices.py +++ b/custom_components/xiaomi_gateway3/core/devices.py @@ -1660,6 +1660,19 @@ BaseConv("has_someone_duration", "sensor", mi="2.p.1081", entity=ENTITY_DISABLED), BaseConv("no_one_duration", "sensor", mi="2.p.1082", entity=ENTITY_DISABLED), ], +}, { + # https://home.miot-spec.com/spec/linp.sensor_occupy.es3 + 20731: ["Linp", "Occupancy Sensor", "ES3", "linp.sensor_occupy.es3"], + "spec": [ + # main sensors + BoolConv("occupancy", "binary_sensor", mi="2.p.1078"), + BaseConv("illuminance", "sensor", mi="2.p.1005"), + # other sensors + BaseConv("battery", "sensor", mi="3.p.1003"), + BaseConv("customized_property", "binary_sensor", mi="5.p.1018"), #customized distance trigger + BaseConv("has_someone_duration", "sensor", mi="2.p.1080", entity=ENTITY_DISABLED), + BaseConv("no_one_duration", "sensor", mi="2.p.1079", entity=ENTITY_DISABLED), + ], }, { # https://github.com/AlexxIT/XiaomiGateway3/pull/1118 13617: ["xiaomi", "Motion Sensor 2s", "XMPIRO25XS", "xiaomi.motion.pir1"], From 180f9b27e98b406818987dc970ac3404cbc0c62e Mon Sep 17 00:00:00 2001 From: kei81131 <111072203+kei81131@users.noreply.github.com> Date: Tue, 17 Dec 2024 18:35:52 +0800 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Charming --- custom_components/xiaomi_gateway3/core/devices.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/custom_components/xiaomi_gateway3/core/devices.py b/custom_components/xiaomi_gateway3/core/devices.py index 02833d3a..acdd9d07 100644 --- a/custom_components/xiaomi_gateway3/core/devices.py +++ b/custom_components/xiaomi_gateway3/core/devices.py @@ -1662,13 +1662,14 @@ ], }, { # https://home.miot-spec.com/spec/linp.sensor_occupy.es3 - 20731: ["Linp", "Occupancy Sensor", "ES3", "linp.sensor_occupy.es3"], + # https://home.mi.com/views/introduction.html?model=linp.sensor_occupy.es2 + 20731: ["Linptech", "Human Presence Sensor ES3", "ES3BB", "linp.sensor_occupy.es2"], "spec": [ # main sensors BoolConv("occupancy", "binary_sensor", mi="2.p.1078"), BaseConv("illuminance", "sensor", mi="2.p.1005"), # other sensors - BaseConv("battery", "sensor", mi="3.p.1003"), + BaseConv("battery", "sensor", mi="4.p.1003", entity=ENTITY_LAZY), BaseConv("customized_property", "binary_sensor", mi="5.p.1018"), #customized distance trigger BaseConv("has_someone_duration", "sensor", mi="2.p.1080", entity=ENTITY_DISABLED), BaseConv("no_one_duration", "sensor", mi="2.p.1079", entity=ENTITY_DISABLED),