File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed
Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -1121,12 +1121,18 @@ def obj4818(
11211121def obj484e (
11221122 xobj : bytes , device : XiaomiBluetoothDeviceData , device_type : str
11231123) -> dict [str , Any ]:
1124- """From miot-spec: occupancy-status: uint8: 0 - No One, 1 - Has One,
1125- 2 - Quick Check"""
1126- """Translate to: occupancy: bool: 0 - Clear, 1 - Detected, 2 - Clear"""
1127- device .update_predefined_binary_sensor (
1128- BinarySensorDeviceClass .OCCUPANCY , xobj [0 ] == 1
1129- )
1124+ """From miot-spec: occupancy-status: uint8: 0 - No One, 1 - Has One"""
1125+ """Translate to: occupancy: bool: 0 - Clear, 1 - Detected"""
1126+ if device_type == "XMOSB01XS" :
1127+ """Translate to: occupancy: bool: 0 - Clear, 1 - Detected, 2 - Clear"""
1128+ device .update_predefined_binary_sensor (
1129+ BinarySensorDeviceClass .OCCUPANCY , xobj [0 ] == 1
1130+ )
1131+ else :
1132+ """Translate to: occupancy: bool: 0 - Clear, 1 - Detected"""
1133+ device .update_predefined_binary_sensor (
1134+ BinarySensorDeviceClass .OCCUPANCY , xobj [0 ] > 0
1135+ )
11301136 return {}
11311137
11321138
Original file line number Diff line number Diff line change @@ -3746,7 +3746,7 @@ def test_Xiaomi_ES3_occupancy_on():
37463746 },
37473747 binary_entity_values = {
37483748 KEY_BINARY_OCCUPANCY : BinarySensorValue (
3749- device_key = KEY_BINARY_OCCUPANCY , name = "Occupancy" , native_value = False
3749+ device_key = KEY_BINARY_OCCUPANCY , name = "Occupancy" , native_value = True
37503750 ),
37513751 },
37523752 )
You can’t perform that action at this time.
0 commit comments