-
Notifications
You must be signed in to change notification settings - Fork 712
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 Owon PC321 support for custom attributes #2602
Open
exelsis423
wants to merge
18
commits into
zigpy:dev
Choose a base branch
from
exelsis423: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 all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
1104b8a
Create owon pc 321 z.py
exelsis423 2c6f6f9
Update owon pc 321 z.py
exelsis423 9047d3a
Update owon pc 321 z.py
exelsis423 2f0e61b
Update owon pc 321 z.py
exelsis423 cce71c4
Update owon pc 321 z.py
exelsis423 43bd48a
Update owon pc 321 z.py
exelsis423 abee15c
Update owon pc 321 z.py
exelsis423 93cf5af
Update owon pc 321 z.py
exelsis423 d4b6c12
Create __init__.py
exelsis423 f2f933a
Rename owon pc 321 z.py to Owon_PC321_Z.py
exelsis423 531132c
Merge branch 'dev' into dev
exelsis423 5089e56
Update Owon_PC321_Z.py
exelsis423 8e1589d
Update __init__.py
exelsis423 1c040e1
Update Owon_PC321_Z.py
exelsis423 66e8abb
Update Owon_PC321_Z.py
exelsis423 4e79fb4
Update Owon_PC321_Z.py
exelsis423 de4ee25
Update Owon_PC321_Z.py
exelsis423 1e01acc
Merge branch 'dev' into dev
exelsis423 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
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,94 @@ | ||
"""Quirk for Owon PC321 Z.""" | ||
|
||
from zigpy.profiles import zha | ||
from zigpy.quirks import CustomCluster, CustomDevice | ||
import zigpy.types as t | ||
from zigpy.zcl.clusters.general import Basic, Identify | ||
from zigpy.zcl.clusters.smartenergy import Metering | ||
|
||
from zhaquirks.const import ( | ||
DEVICE_TYPE, | ||
ENDPOINTS, | ||
INPUT_CLUSTERS, | ||
MODELS_INFO, | ||
OUTPUT_CLUSTERS, | ||
PROFILE_ID, | ||
) | ||
from zhaquirks.owon import Owon | ||
|
||
|
||
class Owon_PC321_Z_Simple_Metering(CustomCluster, Metering): | ||
"""Owon PC321 CustomCluster""" | ||
|
||
ep_attribute: str = "smartenergy_metering" | ||
|
||
attributes = Metering.attributes.copy() | ||
attributes.update( | ||
{ | ||
0x2000: ("L1_phase_power", t.uint24_t, True), | ||
0x2001: ("L2_phase_power", t.uint24_t, True), | ||
0x2002: ("L3_phase_power", t.uint24_t, True), | ||
0x2100: ("L1_phase_reactive_power", t.uint24_t, True), | ||
0x2101: ("L2_phase_reactive_power", t.uint24_t, True), | ||
0x2102: ("L3_phase_reactive_power", t.uint24_t, True), | ||
0x2103: ("reactive_power_summation_of_the_3_phases", t.uint24_t, True), | ||
0x3000: ("L1_phase_voltage", t.uint24_t, True), | ||
0x3001: ("L2_phase_voltage", t.uint24_t, True), | ||
0x3002: ("L3_phase_voltage", t.uint24_t, True), | ||
0x3100: ("L1_phase_current", t.uint24_t, True), | ||
0x3101: ("L2_phase_current", t.uint24_t, True), | ||
0x3102: ("L3_phase_current", t.uint24_t, True), | ||
0x3103: ("current_summation_of_the_3_phases", t.uint24_t, True), | ||
0x3104: ("leakage_current", t.uint24_t, True), | ||
0x4000: ("L1_phase_energy_consumption", t.uint48_t, True), | ||
0x4001: ("L2_phase_energy_consumption", t.uint48_t, True), | ||
0x4002: ("L3_phase_energy_consumption", t.uint48_t, True), | ||
0x4100: ("L1_phase_reactive_energy_consumption", t.uint48_t, True), | ||
0x4101: ("L2_phase_reactive_energy_consumption", t.uint48_t, True), | ||
0x4102: ("L3_phase_reactive_energy_consumption", t.uint48_t, True), | ||
0x4103: ("reactive_energy_summation_of_the_3_phases", t.uint48_t, True), | ||
0x5005: ("frequency", t.uint8_t, True), | ||
} | ||
) | ||
|
||
|
||
class Owon_PC321_Z(CustomDevice): | ||
"""New Device Owon PC321 Z.""" | ||
|
||
signature = { | ||
MODELS_INFO: [(Owon, "PC321")], | ||
ENDPOINTS: { | ||
# <SimpleDescriptor endpoint=1 profile=260 device_type=13 | ||
# device_version=1 | ||
# input_clusters=[0, 3, 1794] | ||
# output_clusters=[3]> | ||
1: { | ||
PROFILE_ID: zha.PROFILE_ID, | ||
DEVICE_TYPE: zha.DeviceType.CONSUMPTION_AWARENESS_DEVICE, | ||
INPUT_CLUSTERS: [ | ||
Basic.cluster_id, | ||
Identify.cluster_id, | ||
Metering.cluster_id, | ||
], | ||
OUTPUT_CLUSTERS: [Identify.cluster_id], | ||
}, | ||
}, | ||
} | ||
replacement = { | ||
ENDPOINTS: { | ||
# <SimpleDescriptor endpoint=1 profile=260 device_type=13 | ||
# device_version=1 | ||
# input_clusters=[0, 3, 1794] | ||
# output_clusters=[3]> | ||
1: { | ||
PROFILE_ID: zha.PROFILE_ID, | ||
DEVICE_TYPE: zha.DeviceType.CONSUMPTION_AWARENESS_DEVICE, | ||
INPUT_CLUSTERS: [ | ||
Basic.cluster_id, | ||
Identify.cluster_id, | ||
Owon_PC321_Z_Simple_Metering, | ||
], | ||
OUTPUT_CLUSTERS: [Identify.cluster_id], | ||
}, | ||
}, | ||
} |
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,3 @@ | ||
"""Owon quirks.""" | ||
|
||
Owon = "OWON Technology Inc." |
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.
I think this isn't needed, because the
ep_attribute
is already set inMetering
(which we're inheriting here)?