Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
add some classes to binary sensor (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasgermain authored Jan 4, 2022
1 parent b30c318 commit e77ef1c
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion custom_components/multimatic/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ def entity_category(self) -> str | None:
"""Return the category of the entity, if any."""
return ENTITY_CATEGORY_DIAGNOSTIC

@property
def device_class(self):
"""Return the class of this device, from component DEVICE_CLASSES."""
return BinarySensorDeviceClass.RUNNING


class RoomWindow(MultimaticEntity, BinarySensorEntity):
"""multimatic window binary sensor."""
Expand Down Expand Up @@ -357,6 +362,11 @@ def entity_category(self) -> str | None:
"""Return the category of the entity, if any."""
return ENTITY_CATEGORY_DIAGNOSTIC

@property
def device_class(self):
"""Return the class of this device, from component DEVICE_CLASSES."""
return BinarySensorDeviceClass.UPDATE


class BoxOnline(VRBoxEntity):
"""Check if box is online."""
Expand Down Expand Up @@ -527,7 +537,7 @@ def __init__(self, coordinator: MultimaticCoordinator) -> None:
@property
def is_on(self):
"""Return true if the binary sensor is on."""
return self.coordinator.data and self.coordinator.data.is_applied
return self.coordinator.data is not None and self.coordinator.data.is_applied

@property
def state_attributes(self):
Expand All @@ -554,6 +564,11 @@ def entity_category(self) -> str | None:
"""Return the category of the entity, if any."""
return ENTITY_CATEGORY_DIAGNOSTIC

@property
def device_class(self):
"""Return the class of this device, from component DEVICE_CLASSES."""
return BinarySensorDeviceClass.OCCUPANCY


class QuickModeSensor(MultimaticEntity, BinarySensorEntity):
"""Binary sensor for holiday mode."""
Expand Down Expand Up @@ -591,3 +606,8 @@ def available(self) -> bool:
def entity_category(self) -> str | None:
"""Return the category of the entity, if any."""
return ENTITY_CATEGORY_DIAGNOSTIC

@property
def device_class(self):
"""Return the class of this device, from component DEVICE_CLASSES."""
return BinarySensorDeviceClass.RUNNING

0 comments on commit e77ef1c

Please sign in to comment.