Skip to content

Commit

Permalink
feat: Support new features for TuYa ZG-225Z and ZG-204ZM (#7553)
Browse files Browse the repository at this point in the history
* Update tuya.ts

* Update tuya.ts

* Join the new command of ZG-204ZM

Join the new command of ZG-204ZM

* modify

* Update tuya.ts

* Update src/devices/tuya.ts

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>

* Update tuya.ts

* Update tuya.ts

* Update tuya.ts

* Update tuya.ts

* Update tuya.ts

* Update tuya.ts

---------

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
  • Loading branch information
13717033460 and Koenkk authored May 31, 2024
1 parent 3f27d31 commit 058eac7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
18 changes: 16 additions & 2 deletions src/devices/tuya.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6212,18 +6212,23 @@ const definitions: Definition[] = [
},
},
{
fingerprint: tuya.fingerprint('TS0601', ['_TZE200_8isdky6j']),
fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_8isdky6j'}, {modelID: 'TS0225', manufacturerName: '_TZE200_p6fuhvez'}],
model: 'ZG-225Z',
vendor: 'TuYa',
description: 'Gas sensor',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
configure: tuya.configureMagicPacket,
exposes: [e.gas(), tuya.exposes.gasValue().withUnit('ppm')],
exposes: [e.gas(), tuya.exposes.gasValue().withUnit('ppm'),
e.enum('sensitivity', ea.STATE_SET, ['low', 'medium', 'high']).withDescription('Gas sensor sensitivity'),
e.enum('ring', ea.STATE_SET, ['ring1', 'ring2']).withDescription('Ring'),
],
meta: {
tuyaDatapoints: [
[1, 'gas', tuya.valueConverter.trueFalse0],
[2, 'gas_value', tuya.valueConverter.raw],
[101, 'sensitivity', tuya.valueConverterBasic.lookup({'low': tuya.enum(0), 'medium': tuya.enum(1), 'high': tuya.enum(2)})],
[6, 'ring', tuya.valueConverterBasic.lookup({'ring1': tuya.enum(0), 'ring2': tuya.enum(1)})],
],
},
},
Expand Down Expand Up @@ -6333,6 +6338,10 @@ const definitions: Definition[] = [
e.numeric('static_detection_sensitivity', ea.STATE_SET).withValueMin(0).withValueMax(10).withValueStep(1).withUnit('x')
.withDescription('Static detection sensitivity'),
e.binary('indicator', ea.STATE_SET, 'ON', 'OFF').withDescription('LED indicator mode'),
e.enum('motion_detection_mode', ea.STATE_SET, ['Only PIR', 'PIR+Dadar', 'Only Dadar'])
.withDescription('Motion detection mode (Firmware version>=0122052017)'),
e.numeric('motion_detection_sensitivity', ea.STATE_SET).withValueMin(0).withValueMax(10).withValueStep(1).withUnit('x')
.withDescription('Motion detection sensitivity (Firmware version>=0122052017)'),
],
meta: {
tuyaDatapoints: [
Expand All @@ -6346,6 +6355,11 @@ const definitions: Definition[] = [
[2, 'static_detection_sensitivity', tuya.valueConverter.raw],
[107, 'indicator', tuya.valueConverter.onOff],
[121, 'battery', tuya.valueConverter.raw],
[122, 'motion_detection_mode', tuya.valueConverterBasic.lookup({
'only_pir': tuya.enum(0), 'pir_and_dadar': tuya.enum(1), 'only_dadar': tuya.enum(2),
})],
[123, 'motion_detection_sensitivity', tuya.valueConverter.raw],

],
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/lib/tuya.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,7 @@ const tuyaTz = {
'buzzer_feedback', 'rf_pairing', 'max_temperature_alarm', 'min_temperature_alarm', 'max_humidity_alarm', 'min_humidity_alarm',
'temperature_periodic_report', 'humidity_periodic_report', 'temperature_sensitivity', 'humidity_sensitivity', 'temperature_alarm',
'humidity_alarm', 'move_sensitivity', 'radar_range', 'presence_timeout', 'update_frequency', 'remote_pair', 'motor_working_mode',
'restart_mode', 'rf_remote_control',
'restart_mode', 'rf_remote_control', 'motion_detection_sensitivity', 'motion_detection_mode',
],
convertSet: async (entity, key, value, meta) => {
// A set converter is only called once; therefore we need to loop
Expand Down

0 comments on commit 058eac7

Please sign in to comment.