Skip to content

Commit

Permalink
ValvePosition attribute of EveCluster Cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
lboue authored Sep 11, 2024
1 parent 6fa4b55 commit 03c9cc0
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions matter_server/common/custom_clusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ def descriptor(cls) -> ClusterObjectDescriptor:
ClusterObjectFieldDescriptor(
Label="pressure", Tag=0x130A0014, Type=float32
),
ClusterObjectFieldDescriptor(
Label="valvePosition", Tag=0x130A0018, Type=int
),
]
)

Expand All @@ -101,6 +104,7 @@ def descriptor(cls) -> ClusterObjectDescriptor:
current: float32 | None = None
altitude: float32 | None = None
pressure: float32 | None = None
valvePosition: int | None = None

class Attributes:
"""Attributes for the Eve Cluster."""
Expand Down Expand Up @@ -288,6 +292,30 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor:
value: float32 = 0


@dataclass
class ValvePosition(ClusterAttributeDescriptor, CustomClusterAttributeMixin):
"""ValvePosition 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 0x130A0018

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

value: int = 0


@dataclass
class NeoCluster(Cluster, CustomClusterMixin):
"""Custom (vendor-specific) cluster for Neo - Vendor ID 4991 (0x137F)."""
Expand Down

0 comments on commit 03c9cc0

Please sign in to comment.