Skip to content

Instantly share code, notes, and snippets.

@erkr
Last active January 15, 2024 10:07
Show Gist options
  • Save erkr/a9bac40a7e3184dff2bd01f8d38d61bd to your computer and use it in GitHub Desktop.
Save erkr/a9bac40a7e3184dff2bd01f8d38d61bd to your computer and use it in GitHub Desktop.
Custom Quirk for Aubess (Tuya TS0001 _TZ3000_46t1rvdu)
"""Aubess / tuya TS0001 Wall Switches."""
# I bought some Aubess (Tuya TS0001 _TZ3000_46t1rvdu) devices on Ali
# The signature is recognized as a Tuya TS0001 device with power metering support, but it doesn report any values.
# This custom quirk makes it a simple switch device with the option to configure the power on behavior
from zigpy.profiles import zgp, zha
from zigpy.zcl.clusters.general import (
Basic,
GreenPowerProxy,
Groups,
Identify,
OnOff,
Ota,
Scenes,
Time,
)
from zhaquirks.const import (
DEVICE_TYPE,
ENDPOINTS,
INPUT_CLUSTERS,
MODEL,
MODELS_INFO,
OUTPUT_CLUSTERS,
PROFILE_ID,
)
from zhaquirks.tuya import (
TuyaZBE000Cluster,
TuyaZBElectricalMeasurement,
TuyaZBExternalSwitchTypeCluster,
TuyaZBMeteringCluster,
TuyaZBOnOffAttributeCluster,
)
from zhaquirks.tuya.mcu import EnchantedDevice
class Switch_1G_Metering_not_working_(EnchantedDevice):
"""Tuya 1 gang switch with no actual metering support."""
signature = {
MODELS_INFO: [("_TZ3000_46t1rvdu", "TS0001")],
ENDPOINTS: {
# <SimpleDescriptor endpoint=1 profile=266 device_type=256
# input_clusters=["0x0000","0x0003","0x0004","0x0005","0x0006","0x0702","0x0b04","0xe000","0xe001"]
# output_clusters=["0x000a","0x0019"]>
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT,
INPUT_CLUSTERS: [
Basic.cluster_id,
Identify.cluster_id,
Groups.cluster_id,
Scenes.cluster_id,
OnOff.cluster_id,
TuyaZBMeteringCluster.cluster_id,
TuyaZBElectricalMeasurement.cluster_id,
TuyaZBE000Cluster.cluster_id,
TuyaZBExternalSwitchTypeCluster.cluster_id,
],
OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
},
# <SimpleDescriptor endpoint=242 profile=41440 device_type=97
# device_version=1
# input_clusters=[]
# output_clusters=["0x0021"]>
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.ON_OFF_PLUG_IN_UNIT,
INPUT_CLUSTERS: [
Basic.cluster_id,
Identify.cluster_id,
Groups.cluster_id,
Scenes.cluster_id,
TuyaZBOnOffAttributeCluster,
TuyaZBE000Cluster,
],
OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id],
},
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment