-
Notifications
You must be signed in to change notification settings - Fork 687
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
510 additions
and
4 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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
from setuptools import find_packages, setup | ||
|
||
VERSION = "0.0.37" | ||
VERSION = "0.0.38" | ||
|
||
|
||
def readme(): | ||
|
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,50 @@ | ||
"""Tests for xiaomi.""" | ||
from unittest import mock | ||
from unittest.mock import call | ||
|
||
import zigpy.application | ||
from zigpy.device import Device | ||
|
||
from zhaquirks.xiaomi.aqara.ctrl_neutral1 import CtrlNeutral1 | ||
|
||
|
||
# zigbee-herdsman:controller:endpoint Command 0x00158d00024be541/2 genOnOff.on({}, | ||
# {"timeout":6000,"manufacturerCode":null,"disableDefaultResponse":false}) | ||
# zigbee-herdsman:adapter:zStack:znp:SREQ --> AF - dataRequest - | ||
# {"dstaddr":65311,"destendpoint":2,"srcendpoint":1,"clusterid":6,"transid":17,"options":0,"radius":30,"len":3, | ||
# "data":{"type":"Buffer","data":[1,8,1]}} | ||
# zigbee-herdsman:adapter:zStack:unpi:writer -->frame [254,13,36,1,31,255,2,1,6,0,17,0,30,3,1,8,1,201] | ||
|
||
|
||
# zigbee-herdsman:controller:endpoint Command 0x00158d00024be541/2 genOnOff.off({}, | ||
# {"timeout":6000,"manufacturerCode":null,"disableDefaultResponse":false}) | ||
# zigbee-herdsman:adapter:zStack:znp:SREQ --> AF - dataRequest - | ||
# {"dstaddr":65311,"destendpoint":2,"srcendpoint":1,"clusterid":6,"transid":16,"options":0,"radius":30,"len":3, | ||
# "data":{"type":"Buffer","data":[1,7,0]}} | ||
# zigbee-herdsman:adapter:zStack:unpi:writer --> frame [254,13,36,1,31,255,2,1,6,0,16,0,30,3,1,7,0,198] | ||
|
||
|
||
def test_ctrl_neutral1(): | ||
"""Test ctrl neutral 1 sends correct request.""" | ||
sec = 8 | ||
ieee = 0 | ||
nwk = 1234 | ||
data = b"\x01\x08\x01" | ||
cluster = 6 | ||
src_ep = 1 | ||
dst_ep = 2 | ||
|
||
app = zigpy.application.ControllerApplication() | ||
app.request = mock.MagicMock() | ||
app.get_sequence = mock.MagicMock(return_value=sec) | ||
|
||
rep = Device(app, ieee, nwk) | ||
rep.add_endpoint(1) | ||
rep.add_endpoint(2) | ||
|
||
dev = CtrlNeutral1(app, ieee, nwk, rep) | ||
dev[2].in_clusters[cluster].command(1) | ||
|
||
assert app.request.call_args == call( | ||
dev, 260, cluster, src_ep, dst_ep, sec, data, expect_reply=True | ||
) |
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 @@ | ||
"""Module for Echostar quirks implementations.""" |
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,87 @@ | ||
"""Echostar Sage Doorbell Sensor Device.""" | ||
from zigpy.profiles import zha | ||
from zigpy.quirks import CustomDevice | ||
from zigpy.zcl.clusters.general import ( | ||
Alarms, | ||
Basic, | ||
Identify, | ||
LevelControl, | ||
OnOff, | ||
Ota, | ||
PowerConfiguration, | ||
) | ||
|
||
from ..const import ( | ||
BUTTON_1, | ||
BUTTON_2, | ||
CLUSTER_ID, | ||
COMMAND, | ||
COMMAND_ON, | ||
COMMAND_OFF, | ||
DEVICE_TYPE, | ||
ENDPOINT_ID, | ||
ENDPOINTS, | ||
INPUT_CLUSTERS, | ||
MODELS_INFO, | ||
OUTPUT_CLUSTERS, | ||
PROFILE_ID, | ||
SHORT_PRESS, | ||
) | ||
|
||
MANUFACTURER = " Echostar" | ||
MODEL = " Bell" | ||
|
||
|
||
class Bell(CustomDevice): | ||
"""Echostar Bell device.""" | ||
|
||
signature = { | ||
# <SimpleDescriptor endpoint=18 profile=260 device_type=260 | ||
# device_version=0 | ||
# input_clusters=[0, 3, 9, 1] | ||
# output_clusters=[3, 6, 8, 25]> | ||
MODELS_INFO: [(MANUFACTURER, MODEL)], | ||
ENDPOINTS: { | ||
18: { | ||
PROFILE_ID: zha.PROFILE_ID, | ||
DEVICE_TYPE: zha.DeviceType.DIMMER_SWITCH, | ||
INPUT_CLUSTERS: [ | ||
Basic.cluster_id, | ||
Identify.cluster_id, | ||
Alarms.cluster_id, | ||
PowerConfiguration.cluster_id, | ||
], | ||
OUTPUT_CLUSTERS: [ | ||
Identify.cluster_id, | ||
OnOff.cluster_id, | ||
LevelControl.cluster_id, | ||
Ota.cluster_id, | ||
], | ||
} | ||
}, | ||
} | ||
|
||
replacement = { | ||
ENDPOINTS: { | ||
18: { | ||
PROFILE_ID: zha.PROFILE_ID, | ||
DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH, | ||
INPUT_CLUSTERS: [ | ||
Basic.cluster_id, | ||
Identify.cluster_id, | ||
Alarms.cluster_id, | ||
PowerConfiguration.cluster_id, | ||
], | ||
OUTPUT_CLUSTERS: [ | ||
Identify.cluster_id, | ||
OnOff.cluster_id, | ||
LevelControl.cluster_id, | ||
Ota.cluster_id, | ||
], | ||
} | ||
} | ||
} | ||
device_automation_triggers = { | ||
(SHORT_PRESS, BUTTON_1): {COMMAND: COMMAND_ON, CLUSTER_ID: 6, ENDPOINT_ID: 18}, | ||
(SHORT_PRESS, BUTTON_2): {COMMAND: COMMAND_OFF, CLUSTER_ID: 6, ENDPOINT_ID: 18}, | ||
} |
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
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,139 @@ | ||
"""Phillips RWL020 device.""" | ||
from zigpy.profiles import zha, zll | ||
from zigpy.quirks import CustomCluster, CustomDevice | ||
import zigpy.types as t | ||
from zigpy.zcl.clusters.general import ( | ||
Basic, | ||
BinaryInput, | ||
Groups, | ||
Identify, | ||
LevelControl, | ||
OnOff, | ||
Ota, | ||
PowerConfiguration, | ||
) | ||
|
||
from ..const import ( | ||
ARGS, | ||
CLUSTER_ID, | ||
COMMAND, | ||
COMMAND_OFF_WITH_EFFECT, | ||
COMMAND_ON, | ||
COMMAND_STEP, | ||
DEVICE_TYPE, | ||
DIM_DOWN, | ||
DIM_UP, | ||
ENDPOINT_ID, | ||
ENDPOINTS, | ||
INPUT_CLUSTERS, | ||
LONG_PRESS, | ||
OUTPUT_CLUSTERS, | ||
PROFILE_ID, | ||
SHORT_PRESS, | ||
TURN_OFF, | ||
TURN_ON, | ||
) | ||
|
||
DIAGNOSTICS_CLUSTER_ID = 0x0B05 # decimal = 2821 | ||
|
||
|
||
class BasicCluster(CustomCluster, Basic): | ||
"""Centralite acceleration cluster.""" | ||
|
||
attributes = Basic.attributes.copy() | ||
attributes.update({0x0031: ("phillips", t.bitmap16)}) | ||
|
||
|
||
class PhilipsRWL020(CustomDevice): | ||
"""Phillips RWL020 device.""" | ||
|
||
signature = { | ||
# <SimpleDescriptor endpoint=1 profile=49246 device_type=2080 | ||
# device_version=2 | ||
# input_clusters=[0] | ||
# output_clusters=[0, 3, 4, 6, 8]> | ||
ENDPOINTS: { | ||
1: { | ||
PROFILE_ID: zll.PROFILE_ID, | ||
DEVICE_TYPE: zll.DeviceType.CONTROLLER, | ||
INPUT_CLUSTERS: [Basic.cluster_id], | ||
OUTPUT_CLUSTERS: [ | ||
Basic.cluster_id, | ||
Identify.cluster_id, | ||
Groups.cluster_id, | ||
OnOff.cluster_id, | ||
LevelControl.cluster_id, | ||
], | ||
}, | ||
# <SimpleDescriptor endpoint=2 profile=260 device_type=12 | ||
# device_version=0 | ||
# input_clusters=[0, 1, 3, 15, 64512] | ||
# output_clusters=[25]> | ||
2: { | ||
PROFILE_ID: zha.PROFILE_ID, | ||
DEVICE_TYPE: zha.DeviceType.SIMPLE_SENSOR, | ||
INPUT_CLUSTERS: [ | ||
Basic.cluster_id, | ||
PowerConfiguration.cluster_id, | ||
Identify.cluster_id, | ||
BinaryInput.cluster_id, | ||
64512, | ||
], | ||
OUTPUT_CLUSTERS: [Ota.cluster_id], | ||
}, | ||
} | ||
} | ||
|
||
replacement = { | ||
ENDPOINTS: { | ||
1: { | ||
INPUT_CLUSTERS: [Basic.cluster_id], | ||
OUTPUT_CLUSTERS: [ | ||
Basic.cluster_id, | ||
Identify.cluster_id, | ||
Groups.cluster_id, | ||
OnOff.cluster_id, | ||
LevelControl.cluster_id, | ||
], | ||
}, | ||
2: { | ||
INPUT_CLUSTERS: [ | ||
BasicCluster, | ||
PowerConfiguration.cluster_id, | ||
Identify.cluster_id, | ||
BinaryInput.cluster_id, | ||
64512, | ||
], | ||
OUTPUT_CLUSTERS: [Ota.cluster_id], | ||
}, | ||
} | ||
} | ||
|
||
device_automation_triggers = { | ||
(SHORT_PRESS, TURN_ON): {COMMAND: COMMAND_ON}, | ||
(SHORT_PRESS, TURN_OFF): {COMMAND: COMMAND_OFF_WITH_EFFECT}, | ||
(SHORT_PRESS, DIM_UP): { | ||
COMMAND: COMMAND_STEP, | ||
CLUSTER_ID: 8, | ||
ENDPOINT_ID: 1, | ||
ARGS: [0, 30, 9], | ||
}, | ||
(LONG_PRESS, DIM_UP): { | ||
COMMAND: COMMAND_STEP, | ||
CLUSTER_ID: 8, | ||
ENDPOINT_ID: 1, | ||
ARGS: [0, 56, 9], | ||
}, | ||
(SHORT_PRESS, DIM_DOWN): { | ||
COMMAND: COMMAND_STEP, | ||
CLUSTER_ID: 8, | ||
ENDPOINT_ID: 1, | ||
ARGS: [1, 30, 9], | ||
}, | ||
(LONG_PRESS, DIM_DOWN): { | ||
COMMAND: COMMAND_STEP, | ||
CLUSTER_ID: 8, | ||
ENDPOINT_ID: 1, | ||
ARGS: [1, 56, 9], | ||
}, | ||
} |
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
Oops, something went wrong.