Skip to content

Commit

Permalink
[Eve Door] EveCluster --> Attribute TimesOpened (#755)
Browse files Browse the repository at this point in the history
  • Loading branch information
lboue authored Jun 14, 2024
1 parent cd68b1e commit ee11af2
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions matter_server/common/custom_clusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ def descriptor(cls) -> ClusterObjectDescriptor:
"""Return descriptor for this cluster."""
return ClusterObjectDescriptor(
Fields=[
ClusterObjectFieldDescriptor(
Label="timesOpened", Tag=0x130A0006, Type=int
),
ClusterObjectFieldDescriptor(
Label="watt", Tag=0x130A000A, Type=float32
),
Expand All @@ -84,6 +87,7 @@ def descriptor(cls) -> ClusterObjectDescriptor:
]
)

timesOpened: int | None = None
watt: float32 | None = None
wattAccumulated: float32 | None = None
wattAccumulatedControlPoint: float32 | None = None
Expand All @@ -93,6 +97,29 @@ def descriptor(cls) -> ClusterObjectDescriptor:
class Attributes:
"""Attributes for the Eve Cluster."""

@dataclass
class TimesOpened(ClusterAttributeDescriptor, CustomClusterAttributeMixin):
"""TimesOpened Attribute within the Eve Cluster."""

should_poll = True

@ChipUtility.classproperty
def cluster_id(cls) -> int:
"""Return cluster id."""
return 0x130AFC01

@ChipUtility.classproperty
def attribute_id(cls) -> int:
"""Return attribute id."""
return 0x130A0006

@ChipUtility.classproperty
def attribute_type(cls) -> ClusterObjectFieldDescriptor:
"""Return attribute type."""
return ClusterObjectFieldDescriptor(Type=int)

value: int = 0

@dataclass
class Watt(ClusterAttributeDescriptor, CustomClusterAttributeMixin):
"""Watt Attribute within the Eve Cluster."""
Expand Down

0 comments on commit ee11af2

Please sign in to comment.