-
Notifications
You must be signed in to change notification settings - Fork 712
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Third Reality plug, motion, water leak sensor (#3426)
Co-authored-by: TheJulianJES <[email protected]>
- Loading branch information
1 parent
abf208e
commit 382dc33
Showing
3 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
"""Third Reality motion sensor devices.""" | ||
|
||
from typing import Final | ||
|
||
from zigpy.quirks import CustomCluster | ||
from zigpy.quirks.v2 import QuirkBuilder | ||
from zigpy.quirks.v2.homeassistant import UnitOfTime | ||
import zigpy.types as t | ||
from zigpy.zcl.foundation import BaseAttributeDefs, ZCLAttributeDef | ||
|
||
|
||
class ThirdRealityMotionCluster(CustomCluster): | ||
"""Third Reality's motion sensor private cluster.""" | ||
|
||
cluster_id = 0xFF01 | ||
|
||
class AttributeDefs(BaseAttributeDefs): | ||
"""Define the attributes of a private cluster.""" | ||
|
||
detection_interval: Final = ZCLAttributeDef( | ||
id=0x0001, | ||
type=t.uint16_t, | ||
is_manufacturer_specific=True, | ||
) | ||
|
||
|
||
( | ||
QuirkBuilder("Third Reality, Inc", "3RMS16BZ") | ||
.replaces(ThirdRealityMotionCluster) | ||
.number( | ||
attribute_name=ThirdRealityMotionCluster.AttributeDefs.detection_interval.name, | ||
min_value=5, | ||
max_value=3600, | ||
unit=UnitOfTime.SECONDS, | ||
cluster_id=ThirdRealityMotionCluster.cluster_id, | ||
translation_key="detection_interval", | ||
fallback_name="Detection interval", | ||
) | ||
.add_to_registry() | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
"""Third Reality plug devices.""" | ||
|
||
from typing import Final | ||
|
||
from zigpy.quirks import CustomCluster | ||
from zigpy.quirks.v2 import QuirkBuilder | ||
import zigpy.types as t | ||
from zigpy.zcl.foundation import BaseAttributeDefs, ZCLAttributeDef | ||
|
||
|
||
class ThirdRealityPlugCluster(CustomCluster): | ||
"""Third Reality's plug private cluster.""" | ||
|
||
cluster_id = 0xFF03 | ||
|
||
class AttributeDefs(BaseAttributeDefs): | ||
"""Define the attributes of a private cluster.""" | ||
|
||
reset_summation_delivered: Final = ZCLAttributeDef( | ||
id=0x0000, | ||
type=t.uint8_t, | ||
is_manufacturer_specific=True, | ||
) | ||
|
||
|
||
( | ||
QuirkBuilder("Third Reality, Inc", "3RSP02028BZ") | ||
.also_applies_to("Third Reality, Inc", "3RSPE01044BZ") | ||
.replaces(ThirdRealityPlugCluster) | ||
.write_attr_button( | ||
attribute_name=ThirdRealityPlugCluster.AttributeDefs.reset_summation_delivered.name, | ||
attribute_value=0x01, | ||
cluster_id=ThirdRealityPlugCluster.cluster_id, | ||
translation_key="reset_summation_delivered", | ||
fallback_name="Reset summation delivered", | ||
) | ||
.add_to_registry() | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
"""Third Reality water leak devices.""" | ||
|
||
from typing import Final | ||
|
||
from zigpy.quirks import CustomCluster | ||
from zigpy.quirks.v2 import QuirkBuilder | ||
from zigpy.quirks.v2.homeassistant import UnitOfTime | ||
import zigpy.types as t | ||
from zigpy.zcl.foundation import BaseAttributeDefs, ZCLAttributeDef | ||
|
||
|
||
class ThirdRealityWaterLeakCluster(CustomCluster): | ||
"""Third Reality's water leak sensor private cluster.""" | ||
|
||
cluster_id = 0xFF01 | ||
|
||
class AttributeDefs(BaseAttributeDefs): | ||
"""Define the attributes of a private cluster.""" | ||
|
||
enable_siren: Final = ZCLAttributeDef( | ||
id=0x0010, | ||
type=t.uint8_t, | ||
is_manufacturer_specific=True, | ||
) | ||
|
||
siren_time: Final = ZCLAttributeDef( | ||
id=0x0011, | ||
type=t.uint8_t, | ||
is_manufacturer_specific=True, | ||
) | ||
|
||
|
||
( | ||
QuirkBuilder("Third Reality, Inc", "3RWS18BZ") | ||
.replaces(ThirdRealityWaterLeakCluster) | ||
.switch( | ||
attribute_name=ThirdRealityWaterLeakCluster.AttributeDefs.enable_siren.name, | ||
cluster_id=ThirdRealityWaterLeakCluster.cluster_id, | ||
translation_key="enable_siren", | ||
fallback_name="Enable siren", | ||
) | ||
.number( | ||
attribute_name=ThirdRealityWaterLeakCluster.AttributeDefs.siren_time.name, | ||
min_value=0, | ||
max_value=255, | ||
unit=UnitOfTime.MINUTES, | ||
cluster_id=ThirdRealityWaterLeakCluster.cluster_id, | ||
translation_key="siren_time", | ||
fallback_name="Siren time", | ||
) | ||
.add_to_registry() | ||
) |