Skip to content

Commit

Permalink
Eve cluster part2: Add EveWeather attributes (#855)
Browse files Browse the repository at this point in the history
Co-authored-by: Stefan Agner <[email protected]>
  • Loading branch information
lboue and agners committed Aug 16, 2024
1 parent 1c38147 commit 4734970
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion matter_server/common/custom_clusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def descriptor(cls) -> ClusterObjectDescriptor:
Label="current", Tag=0x130A0009, Type=float32
),
ClusterObjectFieldDescriptor(
Label="altitude", Tag=0x130A0013, Type=int
Label="altitude", Tag=0x130A0013, Type=float32
),
ClusterObjectFieldDescriptor(
Label="pressure", Tag=0x130A0014, Type=float32
Expand All @@ -99,6 +99,8 @@ def descriptor(cls) -> ClusterObjectDescriptor:
wattAccumulatedControlPoint: float32 | None = None
voltage: float32 | None = None
current: float32 | None = None
altitude: float32 | None = None
pressure: float32 | None = None

class Attributes:
"""Attributes for the Eve Cluster."""
Expand Down Expand Up @@ -243,6 +245,48 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor:

value: float32 = 0

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

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

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

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

value: float32 = 0

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

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

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

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

value: float32 = 0


@dataclass
class NeoCluster(Cluster, CustomClusterMixin):
Expand Down

0 comments on commit 4734970

Please sign in to comment.