Skip to content
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 Tuya TS011F plug variant, add Tuya 0x1888 cluster class #2592

Merged
merged 5 commits into from
Sep 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions zhaquirks/tuya/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
TUYA_CLUSTER_ID = 0xEF00
TUYA_CLUSTER_E000_ID = 0xE000
TUYA_CLUSTER_E001_ID = 0xE001
TUYA_CLUSTER_1888_ID = 0x1888
# ---------------------------------------------------------
# Tuya Cluster Commands
# ---------------------------------------------------------
Expand Down Expand Up @@ -1105,9 +1106,9 @@ class TuyaZBElectricalMeasurement(CustomCluster, ElectricalMeasurement):
class TuyaZBE000Cluster(CustomCluster):
"""Tuya manufacturer specific cluster 57344."""

name = "Tuya Manufacturer Specific"
name = "Tuya Manufacturer Specific 0"
cluster_id = TUYA_CLUSTER_E000_ID
ep_attribute = "tuya_is_pita_0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This naming is made of @Adminiuga but i can being good getting somthing better as the old PITA ;-)

ep_attribute = "tuya_manufacturer_specific_57344"


# Tuya Zigbee Cluster 0xE001 Implementation
Expand All @@ -1128,6 +1129,15 @@ class TuyaZBExternalSwitchTypeCluster(CustomCluster):
attributes = {0xD030: ("external_switch_type", ExternalSwitchType)}


# Tuya Zigbee Cluster 0x1888 Implementation
class TuyaZB1888Cluster(CustomCluster):
"""Tuya manufacturer specific cluster 6280."""

name = "Tuya Manufacturer Specific 1"
cluster_id = TUYA_CLUSTER_1888_ID
ep_attribute = "tuya_manufacturer_specific_6280"


# Tuya Window Cover Implementation
class TuyaManufacturerWindowCover(TuyaManufCluster):
"""Manufacturer Specific Cluster for cover device."""
Expand Down
73 changes: 73 additions & 0 deletions zhaquirks/tuya/ts011f_plug.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
Time,
)
from zigpy.zcl.clusters.homeautomation import ElectricalMeasurement
from zigpy.zcl.clusters.lightlink import LightLink
from zigpy.zcl.clusters.measurement import TemperatureMeasurement
from zigpy.zcl.clusters.smartenergy import Metering

Expand All @@ -27,6 +28,7 @@
)
from zhaquirks.tuya import (
TuyaNewManufCluster,
TuyaZB1888Cluster,
TuyaZBE000Cluster,
TuyaZBElectricalMeasurement,
TuyaZBExternalSwitchTypeCluster,
Expand Down Expand Up @@ -1074,6 +1076,77 @@ class Plug_v2(EnchantedDevice):
}


class Plug_v3(EnchantedDevice):
"""Tuya TS011F plug. One plug is _Tz3000_0Zfrhq4I."""

signature = {
MODEL: "TS011F",
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.SMART_PLUG,
INPUT_CLUSTERS: [
Basic.cluster_id,
Identify.cluster_id,
Groups.cluster_id,
Scenes.cluster_id,
OnOff.cluster_id,
Time.cluster_id,
Metering.cluster_id,
ElectricalMeasurement.cluster_id,
LightLink.cluster_id,
TuyaZB1888Cluster.cluster_id,
TuyaZBE000Cluster.cluster_id,
],
OUTPUT_CLUSTERS: [
Ota.cluster_id,
],
},
242: {
PROFILE_ID: zgp.PROFILE_ID,
DEVICE_TYPE: zgp.DeviceType.PROXY_BASIC,
INPUT_CLUSTERS: [],
OUTPUT_CLUSTERS: [
GreenPowerProxy.cluster_id,
],
},
},
}

replacement = {
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.SMART_PLUG,
INPUT_CLUSTERS: [
Basic.cluster_id,
Identify.cluster_id,
Groups.cluster_id,
Scenes.cluster_id,
TuyaZBOnOffAttributeCluster,
Time.cluster_id,
TuyaZBMeteringClusterWithUnit,
TuyaZBElectricalMeasurement,
LightLink.cluster_id,
TuyaZB1888Cluster,
TuyaZBE000Cluster,
],
OUTPUT_CLUSTERS: [
Ota.cluster_id,
],
},
242: {
PROFILE_ID: zgp.PROFILE_ID,
DEVICE_TYPE: zgp.DeviceType.PROXY_BASIC,
INPUT_CLUSTERS: [],
OUTPUT_CLUSTERS: [
GreenPowerProxy.cluster_id,
],
},
},
}


class Plug_2AC_var03(CustomDevice):
"""Tuya 2 socket wall outlet with child lock and power-restore state support."""

Expand Down
Loading