Skip to content

Commit

Permalink
Merge branch 'release/0.0.82'
Browse files Browse the repository at this point in the history
  • Loading branch information
dmulcahey committed Oct 4, 2022
2 parents e7f02ff + 320af17 commit df202f5
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 8 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from setuptools import find_packages, setup

VERSION = "0.0.81"
VERSION = "0.0.82"


setup(
Expand Down
18 changes: 18 additions & 0 deletions tests/test_tuya_mcu.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,24 @@ async def test_tuya_methods(zigpy_device_from_quirk, quirk):
m1.assert_called_with(tcd_dimmer2_level0) # current_level
assert m1.call_count == 9

# test `move_to_level` quirk (only call current_level)
rsp = await dimmer2_cluster.command(0x0000)
assert rsp.status == foundation.Status.SUCCESS
m1.assert_called_with(tcd_dimmer2_level0) # current_level
assert m1.call_count == 10

# test `move_to_level` quirk (only call current_level)
rsp = await dimmer2_cluster.command(0x0000, 75)
assert rsp.status == foundation.Status.SUCCESS
m1.assert_called_with(tcd_dimmer2_level) # current_level
assert m1.call_count == 11

# test `move_to_level` quirk (only call current_level)
rsp = await dimmer2_cluster.command(0x0000, level=75)
assert rsp.status == foundation.Status.SUCCESS
m1.assert_called_with(tcd_dimmer2_level) # current_level
assert m1.call_count == 12


async def test_tuya_mcu_classes():
"""Test tuya conversion from Data to ztype and reverse."""
Expand Down
65 changes: 65 additions & 0 deletions zhaquirks/legrand/dimmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,3 +324,68 @@ class DimmerWithNeutral(DimmerWithoutNeutral):
},
},
}


class DimmerWithNeutral2(CustomDevice):
"""Dimmer switch with neutral."""

signature = {
# <SimpleDescriptor endpoint=1 profile=260 device_type=256
# device_version=1
# input_clusters=[0, 3, 4, 8, 6, 5, 15, 64513]
# output_clusters=[0, 64513, 5, 25]>
MODELS_INFO: [(f" {LEGRAND}", " Dimmer switch with neutral")],
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT,
INPUT_CLUSTERS: [
Basic.cluster_id,
Identify.cluster_id,
Groups.cluster_id,
OnOff.cluster_id,
LevelControl.cluster_id,
Scenes.cluster_id,
BinaryInput.cluster_id,
MANUFACTURER_SPECIFIC_CLUSTER_ID,
],
OUTPUT_CLUSTERS: [
Basic.cluster_id,
MANUFACTURER_SPECIFIC_CLUSTER_ID,
Scenes.cluster_id,
Ota.cluster_id,
],
},
242: {
PROFILE_ID: 41440,
DEVICE_TYPE: 0x0066,
INPUT_CLUSTERS: [0x0021],
OUTPUT_CLUSTERS: [0x0021],
},
},
}

replacement = {
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT,
INPUT_CLUSTERS: [
Basic.cluster_id,
Identify.cluster_id,
Groups.cluster_id,
OnOff.cluster_id,
LevelControl.cluster_id,
Scenes.cluster_id,
BinaryInput.cluster_id,
LegrandCluster,
],
OUTPUT_CLUSTERS: [
Basic.cluster_id,
LegrandCluster,
Scenes.cluster_id,
Ota.cluster_id,
],
}
}
}
54 changes: 47 additions & 7 deletions zhaquirks/tuya/ts130f.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ class TuyaZemismartTS130F(CustomDevice):
}


class TuyaMoesDiyRf433TS130F(CustomDevice):
"""Moes Tuya ZigBee DIY RF433 Smart Curtain Switch Module."""
class TuyaTS130FTI2(CustomDevice):
"""Tuya smart curtain roller shutter Time In."""

signature = {
# SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=0x0203, device_version=1, input_clusters=[0x0000, 0x0004, 0x0005, 0x0006, 0x0102], output_clusters=[0x000a, 0x0019]))
Expand Down Expand Up @@ -296,16 +296,16 @@ class TuyaTS130GP(CustomDevice):
}


class TuyaTS130FTI2(CustomDevice):
"""Tuya smart curtain roller shutter Time In."""
class TuyaTS130Double_GP(CustomDevice):
"""Tuya double smart curtain roller shutter with Green Power."""

signature = {
# SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=0x0203, device_version=1, input_clusters=[0, 4, 5, 6, 0x0102], output_clusters=[0x000A,25]))
# SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=0x0202, device_version=1, input_clusters=[0, 4, 5, 6, 0x0102], output_clusters=[0x000a, 0x0019]))
MODEL: "TS130F",
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.WINDOW_COVERING_CONTROLLER,
DEVICE_TYPE: zha.DeviceType.WINDOW_COVERING_DEVICE,
INPUT_CLUSTERS: [
Basic.cluster_id,
Groups.cluster_id,
Expand All @@ -315,13 +315,36 @@ class TuyaTS130FTI2(CustomDevice):
],
OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
},
2: {
# "profile_id": 260, "device_type": "0x0202",
# "in_clusters": ["0x0004","0x0005","0x0006","0x0102"],
# "out_clusters": []
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.WINDOW_COVERING_DEVICE,
INPUT_CLUSTERS: [
Groups.cluster_id,
Scenes.cluster_id,
OnOff.cluster_id,
WindowCovering.cluster_id,
],
OUTPUT_CLUSTERS: [],
},
242: {
# <SimpleDescriptor endpoint=242 profile=41440 device_type=97
# input_clusters=[]
# output_clusters=[33]
PROFILE_ID: 41440,
DEVICE_TYPE: 97,
INPUT_CLUSTERS: [],
OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
},
},
}
replacement = {
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.WINDOW_COVERING_CONTROLLER,
DEVICE_TYPE: zha.DeviceType.WINDOW_COVERING_DEVICE,
INPUT_CLUSTERS: [
Basic.cluster_id,
Groups.cluster_id,
Expand All @@ -331,6 +354,23 @@ class TuyaTS130FTI2(CustomDevice):
],
OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
},
2: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.WINDOW_COVERING_DEVICE,
INPUT_CLUSTERS: [
Groups.cluster_id,
Scenes.cluster_id,
TuyaWithBacklightOnOffCluster,
TuyaCoveringCluster,
],
OUTPUT_CLUSTERS: [],
},
242: {
PROFILE_ID: 41440,
DEVICE_TYPE: 97,
INPUT_CLUSTERS: [],
OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
},
},
}

Expand Down

0 comments on commit df202f5

Please sign in to comment.