We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 368694d commit 205a2eeCopy full SHA for 205a2ee
1 file changed
homeassistant/components/abode/binary_sensor.py
@@ -1,4 +1,7 @@
1
"""Support for Abode Security System binary sensors."""
2
+from __future__ import annotations
3
+
4
+from contextlib import suppress
5
from typing import cast
6
7
from abodepy.devices.binary_sensor import AbodeBinarySensor as ABBinarySensor
@@ -47,8 +50,10 @@ def is_on(self) -> bool:
47
50
return cast(bool, self._device.is_on)
48
51
49
52
@property
- def device_class(self) -> str:
53
+ def device_class(self) -> BinarySensorDeviceClass | None:
54
"""Return the class of the binary sensor."""
55
if self._device.get_value("is_window") == "1":
56
return BinarySensorDeviceClass.WINDOW
- return cast(str, self._device.generic_type)
57
+ with suppress(ValueError):
58
+ return BinarySensorDeviceClass(cast(str, self._device.generic_type))
59
+ return None
0 commit comments