Skip to content

Commit

Permalink
Fix illuminance for Aqara Motion Sensor E1 after v4 #1322
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Apr 18, 2024
1 parent aac14d5 commit 406dc06
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions custom_components/xiaomi_gateway3/core/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@
"spec": [
ConstConv("motion", "binary_sensor", mi="2.e.1", value=True),
BaseConv("illuminance", "sensor", mi="2.e.1.p.1"),
BaseConv("illuminance", mi="2.p.1"),
BatVoltConv("battery", "sensor", mi="3.p.2"), # voltage, mV
MapConv("battery_low", "binary_sensor", mi="3.p.1", map={1: False, 2: True}), # diagnostic
],
Expand Down
8 changes: 3 additions & 5 deletions tests/test_conv_lumi.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,10 @@ def test_sensor_motion_e1():
device = XDevice("lumi.motion.acn001")
assert device.market_name == "Aqara Motion Sensor E1"

p = device.decode(
[{"siid": 2, "eiid": 1, "arguments": [{"siid": 2, "piid": 1, "value": 9}]}]
)
assert p == {"illuminance": 9, "motion": True}
p = device.decode({"siid": 2, "eiid": 1, "arguments": [{"piid": 1, "value": 179}]})
assert p == {"illuminance": 179, "motion": True}

p = device.decode([{"siid": 2, "piid": 1, "value": 10, "code": 0}])
p = device.decode({"siid": 2, "piid": 1, "value": 10, "code": 0})
assert p == {"illuminance": 10}


Expand Down

0 comments on commit 406dc06

Please sign in to comment.