From 03c9cc0e32b32ad3e6cc285dee4e1e5e73b62c54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20BOU=C3=89?= Date: Wed, 11 Sep 2024 07:59:53 +0200 Subject: [PATCH 1/2] ValvePosition attribute of EveCluster Cluster --- matter_server/common/custom_clusters.py | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/matter_server/common/custom_clusters.py b/matter_server/common/custom_clusters.py index 38762f6e..3d4ca116 100644 --- a/matter_server/common/custom_clusters.py +++ b/matter_server/common/custom_clusters.py @@ -90,6 +90,9 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor( Label="pressure", Tag=0x130A0014, Type=float32 ), + ClusterObjectFieldDescriptor( + Label="valvePosition", Tag=0x130A0018, Type=int + ), ] ) @@ -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.""" @@ -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).""" From e49b57525677bd8f1f597b05a67f4d861d1520f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20BOU=C3=89?= Date: Wed, 11 Sep 2024 08:04:52 +0200 Subject: [PATCH 2/2] Update custom_clusters.py --- matter_server/common/custom_clusters.py | 1 - 1 file changed, 1 deletion(-) diff --git a/matter_server/common/custom_clusters.py b/matter_server/common/custom_clusters.py index 3d4ca116..b5e8d59b 100644 --- a/matter_server/common/custom_clusters.py +++ b/matter_server/common/custom_clusters.py @@ -291,7 +291,6 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: float32 = 0 - @dataclass class ValvePosition(ClusterAttributeDescriptor, CustomClusterAttributeMixin): """ValvePosition Attribute within the Eve Cluster."""