Skip to content

Commit afea567

Browse files
Add MatterMeterSensor class for enhanced Matter sensor representation
1 parent f87c888 commit afea567

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

matter_server/common/custom_clusters.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,11 +606,15 @@ def descriptor(cls) -> ClusterObjectDescriptor:
606606
ClusterObjectFieldDescriptor(
607607
Label="instantaneousDemand", Tag=0x0400, Type=uint
608608
),
609+
ClusterObjectFieldDescriptor(Label="multiplier", Tag=0x0301, Type=uint),
610+
ClusterObjectFieldDescriptor(Label="divisor", Tag=0x0302, Type=uint),
609611
]
610612
)
611613

612614
currentSummationDelivered: uint | None = None
613615
instantaneousDemand: uint | None = None
616+
multiplier: uint = 1
617+
divisor: uint = 1
614618

615619
class Attributes:
616620
"""Attributes for the custom Cluster."""
@@ -644,6 +648,48 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor:
644648

645649
value: uint = 0
646650

651+
@dataclass
652+
class Divisor(ClusterAttributeDescriptor, CustomClusterAttributeMixin):
653+
"""Divisor Attribute within the ThirdRealityMeteringCluster Cluster."""
654+
655+
@ChipUtility.classproperty
656+
def cluster_id(cls) -> int:
657+
"""Return cluster id."""
658+
return 0x130DFC02
659+
660+
@ChipUtility.classproperty
661+
def attribute_id(cls) -> int:
662+
"""Return attribute id."""
663+
return 0x0302
664+
665+
@ChipUtility.classproperty
666+
def attribute_type(cls) -> ClusterObjectFieldDescriptor:
667+
"""Return attribute type."""
668+
return ClusterObjectFieldDescriptor(Type=uint)
669+
670+
value: uint = 1
671+
672+
@dataclass
673+
class Multiplier(ClusterAttributeDescriptor, CustomClusterAttributeMixin):
674+
"""Multiplier Attribute within the ThirdRealityMeteringCluster Cluster."""
675+
676+
@ChipUtility.classproperty
677+
def cluster_id(cls) -> int:
678+
"""Return cluster id."""
679+
return 0x130DFC02
680+
681+
@ChipUtility.classproperty
682+
def attribute_id(cls) -> int:
683+
"""Return attribute id."""
684+
return 0x0301
685+
686+
@ChipUtility.classproperty
687+
def attribute_type(cls) -> ClusterObjectFieldDescriptor:
688+
"""Return attribute type."""
689+
return ClusterObjectFieldDescriptor(Type=uint)
690+
691+
value: uint = 1
692+
647693
@dataclass
648694
class InstantaneousDemand(
649695
ClusterAttributeDescriptor, CustomClusterAttributeMixin

0 commit comments

Comments
 (0)