|
2 | 2 | from homeassistant.core import HomeAssistant |
3 | 3 | from homeassistant.components.binary_sensor import ( |
4 | 4 | BinarySensorEntity, |
5 | | - DEVICE_CLASS_CONNECTIVITY, |
6 | | - DEVICE_CLASS_DOOR, |
7 | | - DEVICE_CLASS_GAS, |
8 | | - DEVICE_CLASS_MOISTURE, |
9 | | - DEVICE_CLASS_MOTION, |
10 | | - DEVICE_CLASS_PROBLEM, |
11 | | - DEVICE_CLASS_SAFETY, |
12 | | - DEVICE_CLASS_SMOKE, |
13 | | - DEVICE_CLASS_WINDOW, |
14 | | - DEVICE_CLASS_LIGHT, |
15 | | - DEVICE_CLASS_POWER, |
| 5 | + BinarySensorDeviceClass, |
16 | 6 | ) |
17 | 7 | from .const import ( |
18 | 8 | DATA_JABLOTRON, |
@@ -62,35 +52,35 @@ def icon(self) -> Optional[str]: |
62 | 52 | def device_class(self) -> Optional[str]: |
63 | 53 | if self._object._id <= 0: |
64 | 54 | if "code" == self._object.type and self._object.reaction == JablotronConstants.REACTION_PANIC: |
65 | | - return DEVICE_CLASS_SAFETY |
| 55 | + return BinarySensorDeviceClass.SAFETY |
66 | 56 | elif "code" == self._object.type and self._object.reaction == JablotronConstants.REACTION_FIRE_ALARM: |
67 | | - return DEVICE_CLASS_SMOKE |
| 57 | + return BinarySensorDeviceClass.SMOKE |
68 | 58 | elif "code" == self._object.type: |
69 | | - return DEVICE_CLASS_MOTION |
| 59 | + return BinarySensorDeviceClass.MOTION |
70 | 60 | elif DEVICE_CONTROL_PANEL == self._object.type: |
71 | | - return DEVICE_CLASS_PROBLEM |
| 61 | + return BinarySensorDeviceClass.PROBLEM |
72 | 62 | elif "power led" == self._object.type: |
73 | | - return DEVICE_CLASS_POWER |
| 63 | + return BinarySensorDeviceClass.POWER |
74 | 64 | elif "armed led" == self._object.type: |
75 | | - return DEVICE_CLASS_LIGHT |
| 65 | + return BinarySensorDeviceClass.LIGHT |
76 | 66 | if self._object.type == DEVICE_MOTION_DETECTOR: |
77 | | - return DEVICE_CLASS_MOTION |
| 67 | + return BinarySensorDeviceClass.MOTION |
78 | 68 | if self._object.type == DEVICE_KEYPAD: |
79 | | - return DEVICE_CLASS_PROBLEM |
| 69 | + return BinarySensorDeviceClass.PROBLEM |
80 | 70 | if self._object.type == DEVICE_WINDOW_OPENING_DETECTOR: |
81 | | - return DEVICE_CLASS_WINDOW |
| 71 | + return BinarySensorDeviceClass.WINDOW |
82 | 72 |
|
83 | 73 | if self._object.type == DEVICE_DOOR_OPENING_DETECTOR: |
84 | | - return DEVICE_CLASS_DOOR |
| 74 | + return BinarySensorDeviceClass.DOOR |
85 | 75 |
|
86 | 76 | if self._object.type == DEVICE_FLOOD_DETECTOR: |
87 | | - return DEVICE_CLASS_MOISTURE |
| 77 | + return BinarySensorDeviceClass.MOISTURE |
88 | 78 |
|
89 | 79 | if self._object.type == DEVICE_GAS_DETECTOR: |
90 | | - return DEVICE_CLASS_GAS |
| 80 | + return BinarySensorDeviceClass.GAS |
91 | 81 |
|
92 | 82 | if self._object.type == DEVICE_SMOKE_DETECTOR: |
93 | | - return DEVICE_CLASS_SMOKE |
| 83 | + return BinarySensorDeviceClass.SMOKE |
94 | 84 |
|
95 | 85 | return None |
96 | 86 |
|
|
0 commit comments