Skip to content

Commit c17d986

Browse files
authored
Add draft ElectricalMeasurement cluster definition (#1000)
1 parent 1ccee23 commit c17d986

File tree

2 files changed

+310
-0
lines changed

2 files changed

+310
-0
lines changed

dashboard/src/client/models/descriptions.ts

+60
Original file line numberDiff line numberDiff line change
@@ -12267,5 +12267,65 @@ export const clusters: Record<number, ClusterDescription> = {
1226712267
"type": "uint"
1226812268
}
1226912269
}
12270+
},
12271+
"2820": {
12272+
"id": 2820,
12273+
"label": "DraftElectricalMeasurementCluster",
12274+
"attributes": {
12275+
"1285": {
12276+
"id": 1285,
12277+
"cluster_id": 2820,
12278+
"label": "RmsVoltage",
12279+
"type": "uint"
12280+
},
12281+
"1288": {
12282+
"id": 1288,
12283+
"cluster_id": 2820,
12284+
"label": "RmsCurrent",
12285+
"type": "uint"
12286+
},
12287+
"1291": {
12288+
"id": 1291,
12289+
"cluster_id": 2820,
12290+
"label": "ActivePower",
12291+
"type": "uint"
12292+
},
12293+
"1536": {
12294+
"id": 1536,
12295+
"cluster_id": 2820,
12296+
"label": "AcVoltageMultiplier",
12297+
"type": "uint"
12298+
},
12299+
"1537": {
12300+
"id": 1537,
12301+
"cluster_id": 2820,
12302+
"label": "AcVoltageDivisor",
12303+
"type": "uint"
12304+
},
12305+
"1538": {
12306+
"id": 1538,
12307+
"cluster_id": 2820,
12308+
"label": "AcCurrentMultiplier",
12309+
"type": "uint"
12310+
},
12311+
"1539": {
12312+
"id": 1539,
12313+
"cluster_id": 2820,
12314+
"label": "AcCurrentDivisor",
12315+
"type": "uint"
12316+
},
12317+
"1540": {
12318+
"id": 1540,
12319+
"cluster_id": 2820,
12320+
"label": "AcPowerMultiplier",
12321+
"type": "uint"
12322+
},
12323+
"1541": {
12324+
"id": 1541,
12325+
"cluster_id": 2820,
12326+
"label": "AcPowerDivisor",
12327+
"type": "uint"
12328+
}
12329+
}
1227012330
}
1227112331
}

matter_server/common/custom_clusters.py

+250
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,256 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor:
575575
value: uint = 0
576576

577577

578+
@dataclass
579+
class DraftElectricalMeasurementCluster(Cluster, CustomClusterMixin):
580+
"""Custom ElectricalMetering cluster from Matter 1.0 draft specification."""
581+
582+
id: ClassVar[int] = 0x00000B04
583+
584+
@ChipUtility.classproperty
585+
def descriptor(cls) -> ClusterObjectDescriptor:
586+
"""Return descriptor for this cluster."""
587+
return ClusterObjectDescriptor(
588+
Fields=[
589+
ClusterObjectFieldDescriptor(
590+
Label="rmsVoltage", Tag=0x00000505, Type=uint
591+
),
592+
ClusterObjectFieldDescriptor(
593+
Label="rmsCurrent", Tag=0x00000508, Type=uint
594+
),
595+
ClusterObjectFieldDescriptor(
596+
Label="activePower", Tag=0x0000050B, Type=uint
597+
),
598+
ClusterObjectFieldDescriptor(
599+
Label="acVoltageMultiplier", Tag=0x00000600, Type=uint
600+
),
601+
ClusterObjectFieldDescriptor(
602+
Label="acVoltageDivisor", Tag=0x00000601, Type=uint
603+
),
604+
ClusterObjectFieldDescriptor(
605+
Label="acCurrentMultiplier", Tag=0x00000602, Type=uint
606+
),
607+
ClusterObjectFieldDescriptor(
608+
Label="acCurrentDivisor", Tag=0x00000603, Type=uint
609+
),
610+
ClusterObjectFieldDescriptor(
611+
Label="acPowerMultiplier", Tag=0x00000604, Type=uint
612+
),
613+
ClusterObjectFieldDescriptor(
614+
Label="acPowerDivisor", Tag=0x00000605, Type=uint
615+
),
616+
]
617+
)
618+
619+
rmsVoltage: uint | None = None
620+
rmsCurrent: uint | None = None
621+
activePower: uint | None = None
622+
acVoltageMultiplier: uint | None = None
623+
acVoltageDivisor: uint | None = None
624+
acCurrentMultiplier: uint | None = None
625+
acCurrentDivisor: uint | None = None
626+
acPowerMultiplier: uint | None = None
627+
acPowerDivisor: uint | None = None
628+
629+
class Attributes:
630+
"""Attributes for the custom Cluster."""
631+
632+
@dataclass
633+
class RmsVoltage(ClusterAttributeDescriptor, CustomClusterAttributeMixin):
634+
"""RmsVoltage Attribute within the DraftElectricalMeasurement Cluster."""
635+
636+
@ChipUtility.classproperty
637+
def cluster_id(cls) -> int:
638+
"""Return cluster id."""
639+
return 0x00000B04
640+
641+
@ChipUtility.classproperty
642+
def attribute_id(cls) -> int:
643+
"""Return attribute id."""
644+
return 0x00000505
645+
646+
@ChipUtility.classproperty
647+
def attribute_type(cls) -> ClusterObjectFieldDescriptor:
648+
"""Return attribute type."""
649+
return ClusterObjectFieldDescriptor(Type=uint)
650+
651+
value: uint = 0
652+
653+
@dataclass
654+
class RmsCurrent(ClusterAttributeDescriptor, CustomClusterAttributeMixin):
655+
"""RmsCurrent Attribute within the DraftElectricalMeasurement Cluster."""
656+
657+
@ChipUtility.classproperty
658+
def cluster_id(cls) -> int:
659+
"""Return cluster id."""
660+
return 0x00000B04
661+
662+
@ChipUtility.classproperty
663+
def attribute_id(cls) -> int:
664+
"""Return attribute id."""
665+
return 0x00000508
666+
667+
@ChipUtility.classproperty
668+
def attribute_type(cls) -> ClusterObjectFieldDescriptor:
669+
"""Return attribute type."""
670+
return ClusterObjectFieldDescriptor(Type=uint)
671+
672+
value: uint = 0
673+
674+
@dataclass
675+
class ActivePower(ClusterAttributeDescriptor, CustomClusterAttributeMixin):
676+
"""ActivePower Attribute within the DraftElectricalMeasurement Cluster."""
677+
678+
@ChipUtility.classproperty
679+
def cluster_id(cls) -> int:
680+
"""Return cluster id."""
681+
return 0x00000B04
682+
683+
@ChipUtility.classproperty
684+
def attribute_id(cls) -> int:
685+
"""Return attribute id."""
686+
return 0x0000050B
687+
688+
@ChipUtility.classproperty
689+
def attribute_type(cls) -> ClusterObjectFieldDescriptor:
690+
"""Return attribute type."""
691+
return ClusterObjectFieldDescriptor(Type=uint)
692+
693+
value: uint = 0
694+
695+
@dataclass
696+
class AcVoltageMultiplier(
697+
ClusterAttributeDescriptor, CustomClusterAttributeMixin
698+
):
699+
"""AcVoltageMultiplier Attribute within the DraftElectricalMeasurement Cluster."""
700+
701+
@ChipUtility.classproperty
702+
def cluster_id(cls) -> int:
703+
"""Return cluster id."""
704+
return 0x00000B04
705+
706+
@ChipUtility.classproperty
707+
def attribute_id(cls) -> int:
708+
"""Return attribute id."""
709+
return 0x00000600
710+
711+
@ChipUtility.classproperty
712+
def attribute_type(cls) -> ClusterObjectFieldDescriptor:
713+
"""Return attribute type."""
714+
return ClusterObjectFieldDescriptor(Type=uint)
715+
716+
value: uint = 0
717+
718+
@dataclass
719+
class AcVoltageDivisor(ClusterAttributeDescriptor, CustomClusterAttributeMixin):
720+
"""AcVoltageDivisor Attribute within the DraftElectricalMeasurement Cluster."""
721+
722+
@ChipUtility.classproperty
723+
def cluster_id(cls) -> int:
724+
"""Return cluster id."""
725+
return 0x00000B04
726+
727+
@ChipUtility.classproperty
728+
def attribute_id(cls) -> int:
729+
"""Return attribute id."""
730+
return 0x00000601
731+
732+
@ChipUtility.classproperty
733+
def attribute_type(cls) -> ClusterObjectFieldDescriptor:
734+
"""Return attribute type."""
735+
return ClusterObjectFieldDescriptor(Type=uint)
736+
737+
value: uint = 0
738+
739+
@dataclass
740+
class AcCurrentMultiplier(
741+
ClusterAttributeDescriptor, CustomClusterAttributeMixin
742+
):
743+
"""AcCurrentMultiplier Attribute within the DraftElectricalMeasurement Cluster."""
744+
745+
@ChipUtility.classproperty
746+
def cluster_id(cls) -> int:
747+
"""Return cluster id."""
748+
return 0x00000B04
749+
750+
@ChipUtility.classproperty
751+
def attribute_id(cls) -> int:
752+
"""Return attribute id."""
753+
return 0x00000602
754+
755+
@ChipUtility.classproperty
756+
def attribute_type(cls) -> ClusterObjectFieldDescriptor:
757+
"""Return attribute type."""
758+
return ClusterObjectFieldDescriptor(Type=uint)
759+
760+
value: uint = 0
761+
762+
@dataclass
763+
class AcCurrentDivisor(ClusterAttributeDescriptor, CustomClusterAttributeMixin):
764+
"""AcCurrentDivisor Attribute within the DraftElectricalMeasurement Cluster."""
765+
766+
@ChipUtility.classproperty
767+
def cluster_id(cls) -> int:
768+
"""Return cluster id."""
769+
return 0x00000B04
770+
771+
@ChipUtility.classproperty
772+
def attribute_id(cls) -> int:
773+
"""Return attribute id."""
774+
return 0x00000603
775+
776+
@ChipUtility.classproperty
777+
def attribute_type(cls) -> ClusterObjectFieldDescriptor:
778+
"""Return attribute type."""
779+
return ClusterObjectFieldDescriptor(Type=uint)
780+
781+
value: uint = 0
782+
783+
@dataclass
784+
class AcPowerMultiplier(
785+
ClusterAttributeDescriptor, CustomClusterAttributeMixin
786+
):
787+
"""AcPowerMultiplier Attribute within the DraftElectricalMeasurement Cluster."""
788+
789+
@ChipUtility.classproperty
790+
def cluster_id(cls) -> int:
791+
"""Return cluster id."""
792+
return 0x00000B04
793+
794+
@ChipUtility.classproperty
795+
def attribute_id(cls) -> int:
796+
"""Return attribute id."""
797+
return 0x00000604
798+
799+
@ChipUtility.classproperty
800+
def attribute_type(cls) -> ClusterObjectFieldDescriptor:
801+
"""Return attribute type."""
802+
return ClusterObjectFieldDescriptor(Type=uint)
803+
804+
value: uint = 0
805+
806+
@dataclass
807+
class AcPowerDivisor(ClusterAttributeDescriptor, CustomClusterAttributeMixin):
808+
"""AcPowerDivisor Attribute within the DraftElectricalMeasurement Cluster."""
809+
810+
@ChipUtility.classproperty
811+
def cluster_id(cls) -> int:
812+
"""Return cluster id."""
813+
return 0x00000B04
814+
815+
@ChipUtility.classproperty
816+
def attribute_id(cls) -> int:
817+
"""Return attribute id."""
818+
return 0x00000605
819+
820+
@ChipUtility.classproperty
821+
def attribute_type(cls) -> ClusterObjectFieldDescriptor:
822+
"""Return attribute type."""
823+
return ClusterObjectFieldDescriptor(Type=uint)
824+
825+
value: uint = 0
826+
827+
578828
def check_polled_attributes(node_data: MatterNodeData) -> set[str]:
579829
"""Check if custom attributes are present in the node data that need to be polled."""
580830
attributes_to_poll: set[str] = set()

0 commit comments

Comments
 (0)