File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
homeassistant/components/switchbot Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 22
33from __future__ import annotations
44
5+ from switchbot import SwitchbotModel
6+
57from 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 :
You can’t perform that action at this time.
0 commit comments