File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed
homeassistant/components/mysensors Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change 2
2
from __future__ import annotations
3
3
4
4
from homeassistant .components .binary_sensor import (
5
- DEVICE_CLASSES ,
6
5
BinarySensorDeviceClass ,
7
6
BinarySensorEntity ,
8
7
)
17
16
from .helpers import on_unload
18
17
19
18
SENSORS = {
20
- "S_DOOR" : "door" ,
19
+ "S_DOOR" : BinarySensorDeviceClass . DOOR ,
21
20
"S_MOTION" : BinarySensorDeviceClass .MOTION ,
22
- "S_SMOKE" : "smoke" ,
21
+ "S_SMOKE" : BinarySensorDeviceClass . SMOKE ,
23
22
"S_SPRINKLER" : BinarySensorDeviceClass .SAFETY ,
24
23
"S_WATER_LEAK" : BinarySensorDeviceClass .SAFETY ,
25
24
"S_SOUND" : BinarySensorDeviceClass .SOUND ,
@@ -66,10 +65,7 @@ def is_on(self) -> bool:
66
65
return self ._values .get (self .value_type ) == STATE_ON
67
66
68
67
@property
69
- def device_class (self ) -> str | None :
68
+ def device_class (self ) -> BinarySensorDeviceClass | None :
70
69
"""Return the class of this sensor, from DEVICE_CLASSES."""
71
70
pres = self .gateway .const .Presentation
72
- device_class = SENSORS .get (pres (self .child_type ).name )
73
- if device_class in DEVICE_CLASSES :
74
- return device_class
75
- return None
71
+ return SENSORS .get (pres (self .child_type ).name )
You can’t perform that action at this time.
0 commit comments