Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eve cluster part2: Add EveWeather attributes #855

Merged
merged 12 commits into from
Aug 16, 2024
46 changes: 46 additions & 0 deletions matter_server/common/custom_clusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ def descriptor(cls) -> ClusterObjectDescriptor:
wattAccumulatedControlPoint: float32 | None = None
voltage: float32 | None = None
current: float32 | None = None
altitude: int | None = None
lboue marked this conversation as resolved.
Show resolved Hide resolved
pressure: float32 | None = None

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

value: float32 = 0

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

should_poll = False

lboue marked this conversation as resolved.
Show resolved Hide resolved
@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=int)
lboue marked this conversation as resolved.
Show resolved Hide resolved
lboue marked this conversation as resolved.
Show resolved Hide resolved

value: int = 0
lboue marked this conversation as resolved.
Show resolved Hide resolved

@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