-
Notifications
You must be signed in to change notification settings - Fork 878
Add Third Reality dual plug and single plug settings #4109
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
Open
3reality-support
wants to merge
69
commits into
zigpy:dev
Choose a base branch
from
3reality-support:dev
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 64 commits
Commits
Show all changes
69 commits
Select commit
Hold shift + click to select a range
f04cc8c
add 3r waterleak py
jintj ede63c1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] ce0a7fb
Update waterleak.py
3reality-support 5fa93b2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] bb80eea
Update waterleak.py
3reality-support 50e524f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 59c7701
Update waterleak.py
3reality-support 207156b
Update waterleak.py
3reality-support 4ac23ee
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 463ad2f
add 3r project py
jintj 7156188
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 45d3744
Update door.py
3reality-support 87a5218
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 503169a
add 3r project py
jintj bded2c7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 2e84798
Update garage.py
3reality-support 62dcafd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] a22f4e9
Rename temperature_humidity and soil.py to temperature_humidity_and_s…
3reality-support 5cca1a7
Merge branch 'zigpy:dev' into test
3reality-support 089b76e
Merge branch 'zigpy:dev' into test
3reality-support ed10c06
merge
jintj 2314b00
Merge branch 'test' into dev
jintj 697e43f
Merge branch 'zigpy:dev' into dev
3reality-support 1e99c2b
Merge branch 'zigpy:dev' into dev
3reality-support 316640a
update
jintj 1d3de26
update
jintj 31ca101
update
jintj 0d83b67
update
jintj cff8d6c
update
jintj 1146892
update
jintj 76351ca
update
jintj 1c7fab5
update
jintj 2e64798
Apply pre-commit auto fixes
pre-commit-ci[bot] a7dda09
update
jintj cfbf51b
Merge branch 'dev' of https://github.com/3reality-support/zha-device-…
jintj 4e677f8
Merge branch 'zigpy:dev' into dev
3reality-support dc7d5ce
Merge branch 'zigpy:dev' into dev
3reality-support ae68c82
Merge branch 'zigpy:dev' into dev
3reality-support e776deb
updatye
jintj a224af7
update
jintj 976e071
update
jintj e386bf9
updaye
jintj 889e38a
update
jintj c08859b
Apply pre-commit auto fixes
pre-commit-ci[bot] 40e0322
update
jintj ddb3a63
Merge branch 'dev' of https://github.com/3reality-support/zha-device-…
jintj 083c36b
update
jintj 517e1fe
update
jintj 55052ff
Merge branch 'zigpy:dev' into dev
3reality-support dcc326a
update
jintj 4c01e11
Apply pre-commit auto fixes
pre-commit-ci[bot] e2dee3e
update
jintj 4cbb2d6
Merge branch 'dev' of https://github.com/3reality-support/zha-device-…
jintj 6fe164a
Apply pre-commit auto fixes
pre-commit-ci[bot] 17a60dc
Merge branch 'zigpy:dev' into dev
3reality-support 935bbc1
update
jintj 5986e93
Apply pre-commit auto fixes
pre-commit-ci[bot] ffd8660
update
jintj 9b4f35e
Merge branch 'dev' of https://github.com/3reality-support/zha-device-…
jintj 534e1ff
update
jintj 19a74f0
Merge branch 'zigpy:dev' into dev
3reality-support 377c1c7
update
jintj bed3146
update
jintj 0af9494
update
jintj 3307bbb
Merge branch 'zigpy:dev' into dev
3reality-support d4951f6
update plug_dual translation_key
jintj 640321b
update
jintj bfe7979
Merge branch 'zigpy:dev' into dev
3reality-support 1ab9e50
Merge branch 'zigpy:dev' into dev
3reality-support File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
@@ -1,38 +1,82 @@ | ||
"""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() | ||
) | ||
"""Third Reality plug devices.""" | ||
|
||
from typing import Final | ||
|
||
from zigpy.quirks import CustomCluster | ||
from zigpy.quirks.v2 import QuirkBuilder | ||
from zigpy.quirks.v2.homeassistant import UnitOfTime | ||
from zigpy.quirks.v2.homeassistant.number import NumberDeviceClass | ||
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 the accumulated power of the plug | ||
reset_summation_delivered: Final = ZCLAttributeDef( | ||
id=0x0000, | ||
type=t.uint8_t, | ||
is_manufacturer_specific=True, | ||
) | ||
|
||
# turn off delay | ||
on_to_off_delay: Final = ZCLAttributeDef( | ||
id=0x0001, | ||
type=t.uint16_t, | ||
is_manufacturer_specific=True, | ||
) | ||
|
||
# turn on delay | ||
off_to_on_delay: Final = ZCLAttributeDef( | ||
id=0x0002, | ||
type=t.uint16_t, | ||
is_manufacturer_specific=True, | ||
) | ||
|
||
|
||
( | ||
QuirkBuilder("Third Reality, Inc", "3RSP02028BZ") | ||
.applies_to("Third Reality, Inc", "3RSPE01044BZ") | ||
.applies_to("Third Reality, Inc", "3RSPU01080Z") | ||
.applies_to("Third Reality, Inc", "3RSP02064Z") | ||
.applies_to("Third Reality, Inc", "3RSPE02065Z") | ||
.replaces(ThirdRealityPlugCluster) | ||
.write_attr_button( | ||
attribute_name=ThirdRealityPlugCluster.AttributeDefs.reset_summation_delivered.name, | ||
attribute_value=0x01, # 1 reset summation delivered | ||
cluster_id=ThirdRealityPlugCluster.cluster_id, | ||
translation_key="reset_summation_delivered", | ||
fallback_name="Reset summation delivered", | ||
) | ||
.number( | ||
attribute_name=ThirdRealityPlugCluster.AttributeDefs.on_to_off_delay.name, | ||
cluster_id=ThirdRealityPlugCluster.cluster_id, | ||
endpoint_id=1, | ||
min_value=0, | ||
max_value=65535, | ||
step=1, | ||
unit=UnitOfTime.SECONDS, | ||
device_class=NumberDeviceClass.DURATION, | ||
translation_key="on_to_off_delay", | ||
fallback_name="Turn off delay", | ||
) | ||
.number( | ||
attribute_name=ThirdRealityPlugCluster.AttributeDefs.off_to_on_delay.name, | ||
cluster_id=ThirdRealityPlugCluster.cluster_id, | ||
endpoint_id=1, | ||
min_value=0, | ||
max_value=65535, | ||
step=1, | ||
unit=UnitOfTime.SECONDS, | ||
device_class=NumberDeviceClass.DURATION, | ||
translation_key="off_to_on_delay", | ||
fallback_name="Turn on delay", | ||
) | ||
.add_to_registry() | ||
) |
This file contains hidden or 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,113 @@ | ||
"""Third Reality dual plug devices.""" | ||
|
||
from typing import Final | ||
|
||
from zigpy.quirks import CustomCluster | ||
from zigpy.quirks.v2 import QuirkBuilder | ||
from zigpy.quirks.v2.homeassistant import UnitOfTime | ||
from zigpy.quirks.v2.homeassistant.number import NumberDeviceClass | ||
import zigpy.types as t | ||
from zigpy.zcl.foundation import BaseAttributeDefs, ZCLAttributeDef | ||
|
||
|
||
class ThirdRealityPlugCluster(CustomCluster): | ||
"""Third Reality's dual plug private cluster.""" | ||
|
||
cluster_id = 0xFF03 | ||
|
||
class AttributeDefs(BaseAttributeDefs): | ||
"""Define the attributes of a private cluster.""" | ||
|
||
# reset the accumulated power of the plug | ||
reset_summation_delivered: Final = ZCLAttributeDef( | ||
id=0x0000, | ||
type=t.uint8_t, | ||
is_manufacturer_specific=True, | ||
) | ||
|
||
# turn off delay | ||
on_to_off_delay: Final = ZCLAttributeDef( | ||
id=0x0001, | ||
type=t.uint16_t, | ||
is_manufacturer_specific=True, | ||
) | ||
|
||
# turn on delay | ||
off_to_on_delay: Final = ZCLAttributeDef( | ||
id=0x0002, | ||
type=t.uint16_t, | ||
is_manufacturer_specific=True, | ||
) | ||
|
||
|
||
( | ||
QuirkBuilder("Third Reality, Inc", "3RDP01072Z") | ||
.applies_to("Third Reality, Inc", "3RWP01073Z") | ||
.replaces(ThirdRealityPlugCluster, endpoint_id=1) | ||
.replaces(ThirdRealityPlugCluster, endpoint_id=2) | ||
.write_attr_button( | ||
attribute_name=ThirdRealityPlugCluster.AttributeDefs.reset_summation_delivered.name, | ||
attribute_value=0x01, # 1 reset summation delivered | ||
cluster_id=ThirdRealityPlugCluster.cluster_id, | ||
endpoint_id=1, | ||
translation_key="reset_summation_delivered1", | ||
fallback_name="Reset left summation delivered", # ep1 is left | ||
) | ||
.write_attr_button( | ||
attribute_name=ThirdRealityPlugCluster.AttributeDefs.reset_summation_delivered.name, | ||
attribute_value=0x01, | ||
cluster_id=ThirdRealityPlugCluster.cluster_id, | ||
endpoint_id=2, | ||
translation_key="reset_summation_delivered2", | ||
fallback_name="Reset right summation delivered", # ep2 is right | ||
) | ||
.number( | ||
attribute_name=ThirdRealityPlugCluster.AttributeDefs.on_to_off_delay.name, | ||
cluster_id=ThirdRealityPlugCluster.cluster_id, | ||
endpoint_id=1, | ||
min_value=0, | ||
max_value=65535, | ||
step=1, | ||
unit=UnitOfTime.SECONDS, | ||
device_class=NumberDeviceClass.DURATION, | ||
translation_key="on_to_off_delay1", | ||
fallback_name="Turn off delay left", | ||
) | ||
.number( | ||
attribute_name=ThirdRealityPlugCluster.AttributeDefs.on_to_off_delay.name, | ||
cluster_id=ThirdRealityPlugCluster.cluster_id, | ||
endpoint_id=2, | ||
min_value=0, | ||
max_value=65535, | ||
step=1, | ||
unit=UnitOfTime.SECONDS, | ||
device_class=NumberDeviceClass.DURATION, | ||
translation_key="on_to_off_delay2", | ||
fallback_name="Turn off delay right", | ||
) | ||
.number( | ||
attribute_name=ThirdRealityPlugCluster.AttributeDefs.off_to_on_delay.name, | ||
cluster_id=ThirdRealityPlugCluster.cluster_id, | ||
endpoint_id=1, | ||
min_value=0, | ||
max_value=65535, | ||
step=1, | ||
unit=UnitOfTime.SECONDS, | ||
device_class=NumberDeviceClass.DURATION, | ||
translation_key="off_to_on_delay1", | ||
fallback_name="Turn on delay left", | ||
) | ||
.number( | ||
attribute_name=ThirdRealityPlugCluster.AttributeDefs.off_to_on_delay.name, | ||
cluster_id=ThirdRealityPlugCluster.cluster_id, | ||
endpoint_id=2, | ||
min_value=0, | ||
max_value=65535, | ||
step=1, | ||
unit=UnitOfTime.SECONDS, | ||
device_class=NumberDeviceClass.DURATION, | ||
translation_key="off_to_on_delay2", | ||
fallback_name="Turn on delay right", | ||
) | ||
.add_to_registry() | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an underscore before the
1
at the end. Do this for all translation keys.In this case, it might make even more sense to rename the
translation_key
toreset_summation_delivered_left
, since that's what thefallback_name
(translation value) will be. If the translation were to include1
or2
, we should mention that in the translation key. But if it's left or right, we should instead mention that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Modified, please check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TheJulianJES