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

Add Third Reality sensors #3336

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions zhaquirks/thirdreality/garage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
"""Third Reality garage sensor devices."""

from typing import Final

from zigpy.profiles import zha
from zigpy.quirks import CustomDevice
import zigpy.types as t
from zigpy.zcl.clusters.general import Basic, Ota, PowerConfiguration
from zigpy.zcl.clusters.security import IasZone
from zigpy.zcl.foundation import BaseAttributeDefs, ZCLAttributeDef

from zhaquirks import CustomCluster
from zhaquirks.const import (
DEVICE_TYPE,
ENDPOINTS,
INPUT_CLUSTERS,
MODELS_INFO,
OUTPUT_CLUSTERS,
PROFILE_ID,
)
from zhaquirks.thirdreality import THIRD_REALITY

THIRD_REALITY_GARAGE_CLUSTER_ID = 0xFF01
DELAY_OPEN_ATTR_ID = 0x0000
ZCL_CABRATION_ATTR_ID = 0x0003


class ControlMode(t.uint16_t):
"""Reset mode for not clear and clear."""

pass

class ThirdRealityGarageCluster(CustomCluster):
"""ThirdReality Acceleration Cluster."""

cluster_id = THIRD_REALITY_GARAGE_CLUSTER_ID

class AttributeDefs(BaseAttributeDefs):
"""ThirdReality Acceleration Cluster."""

delay_open: Final = ZCLAttributeDef(
id=DELAY_OPEN_ATTR_ID,
type=ControlMode,
is_manufacturer_specific=True
)

zcl_cabration: Final = ZCLAttributeDef(
id=ZCL_CABRATION_ATTR_ID,
type=ControlMode,
is_manufacturer_specific=True
)

zcl_cabration: Final = ZCLAttributeDef(
id=ZCL_CABRATION_ATTR_ID, type=ControlMode, is_manufacturer_specific=True
)


class Garage(CustomDevice):
"""ThirdReality garage device."""

signature = {
MODELS_INFO: [(THIRD_REALITY, "3RDTS01056Z")],
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.IAS_ZONE,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
IasZone.cluster_id,
ThirdRealityGarageCluster.cluster_id,
],
OUTPUT_CLUSTERS: [
Ota.cluster_id,
],
}
},
}
replacement = {
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.IAS_ZONE,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
IasZone.cluster_id,
ThirdRealityGarageCluster,
],
OUTPUT_CLUSTERS: [
Ota.cluster_id,
],
}
},
}
184 changes: 184 additions & 0 deletions zhaquirks/thirdreality/temperature_humidity_and_soil.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
"""Third Reality Temperature humidity devices."""

from typing import Final

from zigpy.profiles import zha
from zigpy.quirks import CustomDevice
import zigpy.types as t
from zigpy.zcl.clusters.general import Basic, Identify, Ota, PowerConfiguration
from zigpy.zcl.clusters.measurement import RelativeHumidity, TemperatureMeasurement
from zigpy.zcl.foundation import BaseAttributeDefs, ZCLAttributeDef

from zhaquirks import CustomCluster
from zhaquirks.const import (
DEVICE_TYPE,
ENDPOINTS,
INPUT_CLUSTERS,
MODELS_INFO,
OUTPUT_CLUSTERS,
PROFILE_ID,
)
from zhaquirks.thirdreality import THIRD_REALITY

THIRDREALITY_CLUSTER_ID = 0xFF01


class ControlMode(t.int16s):
"""ThirdReality Temperature humidity Cluster."""

pass


class ThirdRealityCluster(CustomCluster):
"""ThirdReality Temperature humidity Cluster."""

cluster_id = THIRDREALITY_CLUSTER_ID

class AttributeDefs(BaseAttributeDefs):
"""Attribute definitions."""

Celsius_degree_calibration: Final = ZCLAttributeDef(
id=0x0031,
type=ControlMode,
is_manufacturer_specific=True,
)

humidity_calibration: Final = ZCLAttributeDef(
id=0x0032,
type=ControlMode,
is_manufacturer_specific=True,
)

Fahrenheit_degree_calibration: Final = ZCLAttributeDef(
id=0x0033,
type=ControlMode,
is_manufacturer_specific=True,
)


class Temperature_humidity(CustomDevice):
"""ThirdReality Temperature humidity device."""

signature = {
MODELS_INFO: [(THIRD_REALITY, "3RTHS24BZ")],
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
TemperatureMeasurement.cluster_id,
RelativeHumidity.cluster_id,
ThirdRealityCluster.cluster_id,
],
OUTPUT_CLUSTERS: [
Ota.cluster_id,
],
}
},
}
replacement = {
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
TemperatureMeasurement.cluster_id,
RelativeHumidity.cluster_id,
ThirdRealityCluster,
],
OUTPUT_CLUSTERS: [
Ota.cluster_id,
],
}
},
}


class Temperature_humidity_lite(CustomDevice):
"""ThirdReality Temperature humidity lite device."""

signature = {
MODELS_INFO: [(THIRD_REALITY, "3RTHS0224Z")],
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
Identify.cluster_id,
TemperatureMeasurement.cluster_id,
RelativeHumidity.cluster_id,
ThirdRealityCluster.cluster_id,
],
OUTPUT_CLUSTERS: [
Ota.cluster_id,
],
}
},
}
replacement = {
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
Identify.cluster_id,
TemperatureMeasurement.cluster_id,
RelativeHumidity.cluster_id,
ThirdRealityCluster,
],
OUTPUT_CLUSTERS: [
Ota.cluster_id,
],
}
},
}


class Soil_Moisture_Sensor(CustomDevice):
"""ThirdReality Soil Moisture Sensor device."""

signature = {
MODELS_INFO: [(THIRD_REALITY, "3RSM0147Z")],
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
TemperatureMeasurement.cluster_id,
RelativeHumidity.cluster_id,
ThirdRealityCluster.cluster_id,
],
OUTPUT_CLUSTERS: [
Ota.cluster_id,
],
}
},
}
replacement = {
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.TEMPERATURE_SENSOR,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
TemperatureMeasurement.cluster_id,
RelativeHumidity.cluster_id,
ThirdRealityCluster,
],
OUTPUT_CLUSTERS: [
Ota.cluster_id,
],
}
},
}
Loading