Skip to content

Commit 3e87324

Browse files
authored
Merge pull request #1597 from seanyan1994/master
Add support for Linptech LX2BCW, KS2 and enhance motion sensor HS3
2 parents aee5619 + 629dab4 commit 3e87324

File tree

1 file changed

+43
-12
lines changed

1 file changed

+43
-12
lines changed

custom_components/xiaomi_gateway3/core/devices.py

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,12 +1730,16 @@
17301730
}, {
17311731
# https://home.miot-spec.com/spec/linp.motion.hs1bb2
17321732
20692: ["Linptech", "Motion Sensor 3", "HS3BB", "blt.3.1kgrbasoo4k03"],
1733+
# https://github.com/AlexxIT/XiaomiGateway3/pull/1118
1734+
13617: ["xiaomi", "Motion Sensor 2s", "XMPIRO25XS", "xiaomi.motion.pir1"],
17331735
"spec": [
17341736
# main sensors
17351737
ConstConv("motion", "binary_sensor", mi="2.e.1008", value=True),
17361738
BaseConv("illuminance", "sensor", mi="2.p.1005"),
1739+
BaseConv("custom_no_motion_time", "sensor", mi="2.p.1053", entity={"units": UNIT_MINUTES, "icon": "mdi:timer"}),
17371740
# other sensors
1738-
BaseConv("battery", "sensor", mi="3.p.1003"), # uint8
1741+
MathConv("no_motion_duration", "sensor", mi="2.p.1024", entity={"enabled": False, "units": UNIT_SECONDS, "icon": "mdi:timer"}),
1742+
BaseConv("battery", "sensor", mi="3.p.1003"),
17391743
],
17401744
}, {
17411745
# https://home.miot-spec.com/spec/linp.sensor_occupy.es3
@@ -1752,17 +1756,6 @@
17521756
BaseConv("no_one_duration", "sensor", mi="2.p.1079", entity={"enabled": False, "units": UNIT_MINUTES}), # uint8
17531757
BoolConv("led", "binary_sensor", mi="3.p.1"), # bool, config
17541758
],
1755-
}, {
1756-
# https://github.com/AlexxIT/XiaomiGateway3/pull/1118
1757-
13617: ["xiaomi", "Motion Sensor 2s", "XMPIRO25XS", "xiaomi.motion.pir1"],
1758-
"spec": [
1759-
# miot format
1760-
ConstConv("motion", "binary_sensor", mi="2.e.1008", value=True),
1761-
BaseConv("illuminance", "sensor", mi="2.p.1005"),
1762-
BaseConv("battery", "sensor", mi="3.p.1003"),
1763-
BaseConv("idle_time", "sensor", mi="2.p.1024"), # no-motion-duration
1764-
# BaseConv("idle_time", mi="2.p.1053"), # custom-no-motion-time
1765-
],
17661759
}, {
17671760
8613: ["H+", "Double Wall Switch", "huca.switch.dh2"],
17681761
"spec": [
@@ -2128,6 +2121,21 @@
21282121
MapConv("action", mi="5.e.1014.p.1", map={1: BUTTON_1_HOLD, 2: BUTTON_2_HOLD, 3: BUTTON_3_HOLD, 4: BUTTON_4_HOLD}),
21292122
],
21302123
# "ttl": "6h" # battery every 6 hours
2124+
}, {
2125+
21003: ["Linptech", "Temperature Humidity Sensor KS2", "KS2BB", "linp.sensor_ht.ks2bb"],
2126+
"spec": [
2127+
# main sensors
2128+
BLEFloatConv("temperature", "sensor", mi=18433, round=1), # float
2129+
BLEFloatConv("humidity", "sensor", mi=18440, round=1), # float
2130+
BLEByteConv("battery", "sensor", mi=20483), # uint8
2131+
MathConv("temperature", mi="2.p.1001", round=1),
2132+
MathConv("humidity", mi="2.p.1002", round=1),
2133+
BaseConv("battery", mi="4.p.1003", entity=ENTITY_LAZY),
2134+
BaseConv("action", "sensor"),
2135+
ConstConv("action", mi="5.e.1012", value=BUTTON_SINGLE),
2136+
ConstConv("action", mi="5.e.1013", value=BUTTON_DOUBLE),
2137+
ConstConv("action", mi="5.e.1014", value=BUTTON_HOLD),
2138+
],
21312139
}, {
21322140
# https://github.com/AlexxIT/XiaomiGateway3/pull/1303
21332141
17825: [None, "Eight scene knob switch", "cxw.remote.ble006"],
@@ -3450,6 +3458,29 @@
34503458
BaseConv("backlight", "switch", mi="8.p.1"),
34513459
BaseConv("led", "switch", mi="8.p.2"),
34523460
]
3461+
}, {
3462+
# https://home.miot-spec.com/spec/linp.light.lx2bcw
3463+
23071: ["Linptech", "Linp Human presence smart light", "LP2", "linp.light.lx2bcw"],
3464+
"spec": [
3465+
BaseConv("light", "light", mi="2.p.1"),
3466+
BrightnessConv("brightness", mi="2.p.2", max=100),
3467+
ColorTempKelvin("color_temp", mi="2.p.3", mink=2700, maxk=6500),
3468+
MapConv("mode", "select", mi="2.p.7", map={0: "None", 1: "TV", 2: "Reading", 3: "Computer", 4: "Guest", 5: "Entertainment", 6: "Lighting", 7: "Night Light", 8: "Warm"}),
3469+
MapConv("power_on_state", "select", mi="2.p.9", map={0: "Default", 1: "On", 2: "Off"}, entity=ENTITY_CONFIG),
3470+
MathConv("light_off_gradient_time", "number", mi="2.p.10", min=0, max=10, entity={"category": "config", "enabled": False, "units": UNIT_SECONDS}),
3471+
MathConv("light_on_gradient_time", "number", mi="2.p.11", min=0, max=10, entity={"category": "config", "enabled": False, "units": UNIT_SECONDS}),
3472+
BoolConv("occupancy", "binary_sensor", mi="5.p.1"),
3473+
MathConv("no_one_determine_time", "number", mi="5.p.2", min=0, max=10000, entity={"category": "config", "units": UNIT_SECONDS}),
3474+
MathConv("has_one_duration", "sensor", mi="5.p.3", min=0, max=30, entity={"category": "diagnostic", "enabled": False, "units": UNIT_MINUTES}),
3475+
MathConv("no_one_duration", "sensor", mi="5.p.4", min=0, max=30, entity={"category": "diagnostic", "enabled": False, "units": UNIT_MINUTES}),
3476+
MathConv("illuminance", "sensor", mi="5.p.5", min=0, max=1000),
3477+
BaseConv("link_human_sensor", "switch", mi="4.p.2"),
3478+
MathConv("link_human_lux_threshold", "number", mi="4.p.3", min=0, max=1000, entity={"category": "config", "units": "lx"}),
3479+
MapConv("human_trigger_lv", "select", mi="4.p.4", map={0: "One Region", 1: "Two Region", 2: "Three Region"}, entity=ENTITY_CONFIG),
3480+
MapConv("sensitivity", "select", mi="6.p.6", map={0: "Low", 1: "Middle", 2: "High", 3: "User-defined"}, entity=ENTITY_CONFIG),
3481+
MapConv("radar_function_onoff", "select", mi="6.p.12", map={0: "RADAR ON", 1: "RADAR OFF"}),
3482+
MathConv("shielding_distance", "number", mi="6.p.2", min=0, max=255, entity={"category": "config", "enabled": False, "mode": "slider"}),
3483+
],
34533484
}, {
34543485
# https://home.miot-spec.com/spec/linp.light.lp1bc
34553486
19653: ["Linptech", "Human Presence-Sensing Flat Panel Light", "LP1", "linp.light.lp1bc"],

0 commit comments

Comments
 (0)