Skip to content

Commit e51c1d0

Browse files
committed
Use occupancy device class for presence sensor motion detection
1 parent a88eb91 commit e51c1d0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

homeassistant/components/switchbot/binary_sensor.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from __future__ import annotations
44

5+
from switchbot import SwitchbotModel
6+
57
from homeassistant.components.binary_sensor import (
68
BinarySensorDeviceClass,
79
BinarySensorEntity,
@@ -98,6 +100,12 @@ def __init__(
98100
self._sensor = binary_sensor
99101
self._attr_unique_id = f"{coordinator.base_unique_id}-{binary_sensor}"
100102
self.entity_description = BINARY_SENSOR_TYPES[binary_sensor]
103+
# Presence sensors should use occupancy device class instead of motion
104+
if (
105+
binary_sensor == "motion_detected"
106+
and coordinator.model == SwitchbotModel.PRESENCE_SENSOR
107+
):
108+
self._attr_device_class = BinarySensorDeviceClass.OCCUPANCY
101109

102110
@property
103111
def is_on(self) -> bool:

0 commit comments

Comments
 (0)