Commit 0947866 1 parent a138345 commit 0947866 Copy full SHA for 0947866
File tree 1 file changed +27
-0
lines changed
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ async def async_setup_entry(
23
23
(
24
24
MhSeverityBinarySensor (coordinator , entry ),
25
25
MhDataActualBinarySensor (coordinator , entry ),
26
+ MhAlarmsBinarySensor (coordinator , entry ),
26
27
),
27
28
chain .from_iterable (
28
29
[
@@ -66,6 +67,32 @@ def is_on(self) -> bool | None:
66
67
return self .coordinator .data .get ("dataActual" )
67
68
68
69
70
+ class MhAlarmsBinarySensor (MhEntity , BinarySensorEntity ):
71
+ """myheat Alarms Binary Sensor class."""
72
+
73
+ _attr_device_class = "tamper"
74
+
75
+ @property
76
+ def name (self ) -> str :
77
+ return f"{ self ._mh_name } alarms"
78
+
79
+ @property
80
+ def unique_id (self ):
81
+ return f"{ super ().unique_id } alarms"
82
+
83
+ @property
84
+ def is_on (self ) -> bool | None :
85
+ alarms = self .coordinator .data .get ("alarms" , [])
86
+ return len (alarms ) > 0
87
+
88
+ @property
89
+ def extra_state_attributes (self ):
90
+ alarms = self .coordinator .data .get ("alarms" , [])
91
+ return {
92
+ "alarms" : alarms ,
93
+ }
94
+
95
+
69
96
class MhSeverityBinarySensorBase (BinarySensorEntity ):
70
97
_attr_device_class = "problem"
71
98
You can’t perform that action at this time.
0 commit comments