Skip to content

Commit 4734970

Browse files
lboueagners
andauthored
Eve cluster part2: Add EveWeather attributes (#855)
Co-authored-by: Stefan Agner <stefan@agner.ch>
1 parent 1c38147 commit 4734970

File tree

1 file changed

+45
-1
lines changed

1 file changed

+45
-1
lines changed

matter_server/common/custom_clusters.py

+45-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def descriptor(cls) -> ClusterObjectDescriptor:
8585
Label="current", Tag=0x130A0009, Type=float32
8686
),
8787
ClusterObjectFieldDescriptor(
88-
Label="altitude", Tag=0x130A0013, Type=int
88+
Label="altitude", Tag=0x130A0013, Type=float32
8989
),
9090
ClusterObjectFieldDescriptor(
9191
Label="pressure", Tag=0x130A0014, Type=float32
@@ -99,6 +99,8 @@ def descriptor(cls) -> ClusterObjectDescriptor:
9999
wattAccumulatedControlPoint: float32 | None = None
100100
voltage: float32 | None = None
101101
current: float32 | None = None
102+
altitude: float32 | None = None
103+
pressure: float32 | None = None
102104

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

244246
value: float32 = 0
245247

248+
@dataclass
249+
class Altitude(ClusterAttributeDescriptor, CustomClusterAttributeMixin):
250+
"""Altitude Attribute within the Eve Cluster."""
251+
252+
@ChipUtility.classproperty
253+
def cluster_id(cls) -> int:
254+
"""Return cluster id."""
255+
return 0x130AFC01
256+
257+
@ChipUtility.classproperty
258+
def attribute_id(cls) -> int:
259+
"""Return attribute id."""
260+
return 0x130A0013
261+
262+
@ChipUtility.classproperty
263+
def attribute_type(cls) -> ClusterObjectFieldDescriptor:
264+
"""Return attribute type."""
265+
return ClusterObjectFieldDescriptor(Type=float32)
266+
267+
value: float32 = 0
268+
269+
@dataclass
270+
class Pressure(ClusterAttributeDescriptor, CustomClusterAttributeMixin):
271+
"""Pressure Attribute within the Eve Cluster."""
272+
273+
@ChipUtility.classproperty
274+
def cluster_id(cls) -> int:
275+
"""Return cluster id."""
276+
return 0x130AFC01
277+
278+
@ChipUtility.classproperty
279+
def attribute_id(cls) -> int:
280+
"""Return attribute id."""
281+
return 0x130A0014
282+
283+
@ChipUtility.classproperty
284+
def attribute_type(cls) -> ClusterObjectFieldDescriptor:
285+
"""Return attribute type."""
286+
return ClusterObjectFieldDescriptor(Type=float32)
287+
288+
value: float32 = 0
289+
246290

247291
@dataclass
248292
class NeoCluster(Cluster, CustomClusterMixin):

0 commit comments

Comments
 (0)