Skip to content
191 changes: 187 additions & 4 deletions src/devices/tuya.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1223,6 +1223,7 @@ export const definitions: DefinitionWithExtend[] = [
"_TZ3000_gntwytxo", // Moes ZSS-X-GWM-C
"_TZ3000_4ugnzsli", // Luminea ZX-5232
"_TZ3000_timx9ivq", //Woox R7047
"_TZ3000_t3vvhrmh",
];
if (!device || !noTamperModels.includes(device.manufacturerName)) {
exps.push(e.tamper());
Expand Down Expand Up @@ -10186,12 +10187,21 @@ export const definitions: DefinitionWithExtend[] = [
extend: [m.illuminance()],
},
{
fingerprint: tuya.fingerprint("TS0222", ["_TYZB01_4mdqxxnn", "_TYZB01_m6ec2pgj", "_TZ3000_do6txrcw", "_TZ3000_7kscdesh", "_TZ3000_hy6ncvmw"]),
zigbeeModel: ["ZG-106Z"],
fingerprint: tuya.fingerprint("TS0222", [
"_TYZB01_4mdqxxnn",
"_TYZB01_m6ec2pgj",
"_TZ3000_do6txrcw",
"_TZ3000_7kscdesh",
"_TZ3000_hy6ncvmw",
"_TZ3000_7y90pany",
]),
model: "TS0222",
vendor: "Tuya",
description: "Light intensity sensor",
fromZigbee: [fz.battery, legacy.fromZigbee.TS0222],
toZigbee: [],
whiteLabel: [{vendor: "HOBEIAN", model: "ZG-106Z", fingerprint: [{modelID: "ZG-106Z"}]}],
exposes: [e.battery()],
configure: tuya.configureMagicPacket,
extend: [m.illuminance()],
Expand Down Expand Up @@ -17537,6 +17547,97 @@ export const definitions: DefinitionWithExtend[] = [
],
},
},
{
zigbeeModel: ["ZG-302ZL"],
fingerprint: tuya.fingerprint("TS0601", [
"_TZE200_khzbklyh",
"_TZE200_df04ghrb",
"_TZE200_toeldckg",
"_TZE200_cqtamhh5",
"_TZE200_xlnzk169",
"_TZE200_llvwkkde",
]),
model: "ZG-302ZL",
vendor: "HOBEIAN",
description: "Motion sensing switch",
extend: [tuya.modernExtend.tuyaBase({dp: true})],
exposes: [
e.presence(),
e.binary("switch1", ea.STATE_SET, "ON", "OFF").withDescription("Switch1"),
e.binary("switch2", ea.STATE_SET, "ON", "OFF").withDescription("Switch2"),
e.binary("switch3", ea.STATE_SET, "ON", "OFF").withDescription("Switch3"),
e
.numeric("sensitivity", ea.STATE_SET)
.withValueMin(0)
.withValueMax(19)
.withValueStep(1)
.withUnit("x")
.withDescription("detection sensitivity"),
e.binary("backlight", ea.STATE_SET, "ON", "OFF").withDescription("backlight"),
e
.numeric("trigger_hold", ea.STATE_SET)
.withValueMin(5)
.withValueMax(28800)
.withValueStep(1)
.withUnit("s")
.withDescription("Trigger hold(second)"),
tuya.exposes.powerOutageMemory(),
e
.enum("auto_on", ea.STATE_SET, ["off", "all", "ch1", "ch2", "ch3", "ch1_2", "ch2_3", "ch1_3"])
.withDescription("Someone turn on the light"),
Copy link
Owner

Choose a reason for hiding this comment

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

Could you improve this description? It's not clear what it does (same for auto_off)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could you improve this description? It's not clear what it does (same for auto_off)
The switch is equipped with a millimeter wave motion detection sensor, which turns on the light when someone passes by and turns off the light when the person walks away, This function is used to set whether lights need to be turned on and which group of lights to turn on

e
.enum("auto_off", ea.STATE_SET, ["off", "all", "ch1", "ch2", "ch3", "ch1_2", "ch2_3", "ch1_3"])
.withDescription("No one turns off the lights"),
],
meta: {
tuyaDatapoints: [
[101, "presence", tuya.valueConverter.trueFalse1],
[102, "sensitivity", tuya.valueConverter.raw],
[1, "switch1", tuya.valueConverter.onOff],
[2, "switch2", tuya.valueConverter.onOff],
[3, "switch3", tuya.valueConverter.onOff],
[16, "backlight", tuya.valueConverter.onOff],
[103, "trigger_hold", tuya.valueConverter.raw],
[
14,
"power_outage_memory",
tuya.valueConverterBasic.lookup({
off: tuya.enum(0),
on: tuya.enum(1),
restore: tuya.enum(2),
}),
],
[
104,
"auto_on",
tuya.valueConverterBasic.lookup({
off: tuya.enum(0),
all: tuya.enum(1),
ch1: tuya.enum(1),
ch2: tuya.enum(2),
ch3: tuya.enum(3),
ch1_2: tuya.enum(4),
ch2_3: tuya.enum(5),
ch1_3: tuya.enum(6),
}),
],
[
105,
"auto_off",
tuya.valueConverterBasic.lookup({
off: tuya.enum(0),
all: tuya.enum(1),
ch1: tuya.enum(1),
ch2: tuya.enum(2),
ch3: tuya.enum(3),
ch1_2: tuya.enum(4),
ch2_3: tuya.enum(5),
ch1_3: tuya.enum(6),
}),
],
],
},
},
{
fingerprint: tuya.fingerprint("TS0601", ["_TZE200_wqashyqo"]),
model: "ZG-303Z",
Expand Down Expand Up @@ -20071,6 +20172,7 @@ export const definitions: DefinitionWithExtend[] = [
extend: [tuya.modernExtend.tuyaBase({dp: true})],
exposes: [
e.presence(),
e.enum("motion_state", ea.STATE, ["none", "large", "small", "static"]).withDescription("Motion state"),
e.illuminance(),
e.temperature(),
e.humidity(),
Expand Down Expand Up @@ -20108,6 +20210,13 @@ export const definitions: DefinitionWithExtend[] = [
.withUnit("x")
.withDescription("Static detection sensitivity"),
e.enum("motion_detection_mode", ea.STATE_SET, ["pir_and_radar", "pir_or_radar", "only_radar"]).withDescription("Motion detection mode"),
e
.numeric("motion_detection_sensitivity", ea.STATE_SET)
.withValueMin(0)
.withValueMax(10)
.withValueStep(1)
.withUnit("x")
.withDescription("Radar Motion detection sensitivity"),
],
meta: {
tuyaDatapoints: [
Expand All @@ -20133,6 +20242,17 @@ export const definitions: DefinitionWithExtend[] = [
only_radar: tuya.enum(2),
}),
],
[
103,
"motion_state",
tuya.valueConverterBasic.lookup({
none: tuya.enum(0),
large: tuya.enum(1),
small: tuya.enum(2),
static: tuya.enum(3),
}),
],
[123, "motion_detection_sensitivity", tuya.valueConverter.raw],
],
},
},
Expand Down Expand Up @@ -20709,13 +20829,14 @@ export const definitions: DefinitionWithExtend[] = [
},
{
zigbeeModel: ["ZG-204ZK"],
fingerprint: tuya.fingerprint("TS0601", ["_TZE200_ka8l86iu"]),
fingerprint: tuya.fingerprint("TS0601", ["_TZE200_ka8l86iu", "_TZE200_zbfmvj13"]),
model: "ZG-204ZK",
vendor: "HOBEIAN",
description: "24Ghz human presence sensor",
extend: [tuya.modernExtend.tuyaBase({dp: true})],
exposes: [
e.presence(),
e.illuminance(),
e.battery(),
e
.numeric("fading_time", ea.STATE_SET)
Expand Down Expand Up @@ -20756,19 +20877,24 @@ export const definitions: DefinitionWithExtend[] = [
[107, "indicator", tuya.valueConverter.onOff],
[123, "motion_detection_sensitivity", tuya.valueConverter.raw],
[121, "battery", tuya.valueConverter.raw],
[106, "illuminance", tuya.valueConverter.raw],
],
},
},
{
zigbeeModel: ["ZG-204ZE"],
fingerprint: [{modelID: "CK-BL702-MWS-01(7016)", manufacturerName: "ZG-204ZE"}],
fingerprint: [
{modelID: "CK-BL702-MWS-01(7016)", manufacturerName: "ZG-204ZE"},
{modelID: "TS0601", manufacturerName: "_TZE200_cq8lu23i"},
{modelID: "TS0601", manufacturerName: "_TZE200_4pm4pekt"},
],
model: "ZG-204ZE",
vendor: "HOBEIAN",
description: "10G mw motion detection",
extend: [tuya.modernExtend.tuyaBase({dp: true})],
exposes: [
e.presence(),

e.illuminance(),
e.battery(),
e
.numeric("fading_time", ea.STATE_SET)
Expand All @@ -20785,6 +20911,13 @@ export const definitions: DefinitionWithExtend[] = [
.withValueStep(1)
.withUnit("x")
.withDescription("The larger the value, the more sensitive it is (refresh and update only while active)"),
e
.numeric("illuminance_interval", ea.STATE_SET)
.withValueMin(1)
.withValueMax(720)
.withValueStep(1)
.withUnit("minutes")
.withDescription("Light sensing sampling(refresh and update only while active)"),
],
meta: {
tuyaDatapoints: [
Expand All @@ -20793,6 +20926,8 @@ export const definitions: DefinitionWithExtend[] = [
[2, "motion_detection_sensitivity", tuya.valueConverter.raw],
[108, "indicator", tuya.valueConverter.onOff],
[110, "battery", tuya.valueConverter.raw],
[106, "illuminance", tuya.valueConverter.raw],
[107, "illuminance_interval", tuya.valueConverter.raw],
],
},
},
Expand Down Expand Up @@ -21526,4 +21661,52 @@ export const definitions: DefinitionWithExtend[] = [
},
exposes: [e.battery(), e.action(["on_1", "off_1", "on_2", "off_2"])],
},
{
zigbeeModel: ["ZG-204ZQ"],
fingerprint: tuya.fingerprint("TS0601", ["_TZE200_p9zbdqgs"]),
model: "ZG-204ZQ",
vendor: "HOBEIAN",
description: "PIR temperature&humidity sensor",
extend: [tuya.modernExtend.tuyaBase({dp: true})],
exposes: [
e.presence(),
e.illuminance(),
e.temperature(),
e.humidity(),
tuya.exposes.temperatureUnit(),
tuya.exposes.temperatureCalibration(),
tuya.exposes.humidityCalibration(),
e.battery(),
e
.numeric("fading_time", ea.STATE_SET)
.withValueMin(0)
.withValueMax(28800)
.withValueStep(1)
.withUnit("s")
.withDescription("Motion keep time"),
e.binary("indicator", ea.STATE_SET, "ON", "OFF").withDescription("LED indicator mode"),
e
.numeric("illuminance_interval", ea.STATE_SET)
.withValueMin(1)
.withValueMax(720)
.withValueStep(1)
.withUnit("minutes")
.withDescription("Light sensing sampling(refresh and update only while active)"),
],
meta: {
tuyaDatapoints: [
[1, "presence", tuya.valueConverter.trueFalse1],
[106, "illuminance", tuya.valueConverter.raw],
[102, "fading_time", tuya.valueConverter.raw],
[108, "indicator", tuya.valueConverter.onOff],
[110, "battery", tuya.valueConverter.raw],
[111, "temperature", tuya.valueConverter.divideBy10],
[101, "humidity", tuya.valueConverter.raw],
[109, "temperature_unit", tuya.valueConverter.temperatureUnit],
[105, "temperature_calibration", tuya.valueConverter.localTempCalibration3],
[104, "humidity_calibration", tuya.valueConverter.localTempCalibration2],
[107, "illuminance_interval", tuya.valueConverter.raw],
],
},
},
];