Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions src/xiaomi_ble/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1121,12 +1121,18 @@ def obj4818(
def obj484e(
xobj: bytes, device: XiaomiBluetoothDeviceData, device_type: str
) -> dict[str, Any]:
"""From miot-spec: occupancy-status: uint8: 0 - No One, 1 - Has One,
2 - Quick Check"""
"""Translate to: occupancy: bool: 0 - Clear, 1 - Detected, 2 - Clear"""
device.update_predefined_binary_sensor(
BinarySensorDeviceClass.OCCUPANCY, xobj[0] == 1
)
"""From miot-spec: occupancy-status: uint8: 0 - No One, 1 - Has One"""
"""Translate to: occupancy: bool: 0 - Clear, 1 - Detected"""
if device_type == "XMOSB01XS":
"""Translate to: occupancy: bool: 0 - Clear, 1 - Detected, 2 - Clear"""
device.update_predefined_binary_sensor(
BinarySensorDeviceClass.OCCUPANCY, xobj[0] == 1
)
else:
"""Translate to: occupancy: bool: 0 - Clear, 1 - Detected"""
device.update_predefined_binary_sensor(
BinarySensorDeviceClass.OCCUPANCY, xobj[0] > 0
)
return {}


Expand Down
2 changes: 1 addition & 1 deletion tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3746,7 +3746,7 @@ def test_Xiaomi_ES3_occupancy_on():
},
binary_entity_values={
KEY_BINARY_OCCUPANCY: BinarySensorValue(
device_key=KEY_BINARY_OCCUPANCY, name="Occupancy", native_value=False
device_key=KEY_BINARY_OCCUPANCY, name="Occupancy", native_value=True
),
},
)
Expand Down