From 5aae154e23882d2fd4250c267a20ff28032a6033 Mon Sep 17 00:00:00 2001 From: Kirov Ilya Date: Wed, 14 Jun 2023 22:15:16 +0300 Subject: [PATCH 01/15] Finger bot plus --- src/devices/tuya.ts | 50 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/src/devices/tuya.ts b/src/devices/tuya.ts index 78000cf85e7aa..6e182a65bf413 100644 --- a/src/devices/tuya.ts +++ b/src/devices/tuya.ts @@ -1920,7 +1920,6 @@ const definitions: Definition[] = [ extend: tuya.extend.switch(), whiteLabel: [{vendor: 'CR Smart Home', model: 'TS0001', description: 'Valve control'}, {vendor: 'Lonsonho', model: 'X701'}, {vendor: 'Bandi', model: 'BDS03G1'}, - tuya.whitelabel('Adaprox', 'TS0001_1', 'White Zigbee fingbot plus', ['_TZ3210_dse8ogfy']), ], configure: async (device, coordinatorEndpoint, logger) => { await tuya.configureMagicPacket(device, coordinatorEndpoint, logger); @@ -4903,6 +4902,55 @@ const definitions: Definition[] = [ tuya.whitelabel('Marmitek', 'SM0202_1', 'Motion sensor', ['_TYZB01_yr95mpib']), ], }, + { + zigbeeModel: ['TS0001'], + model: 'FingerBot', + vendor: 'TuYa', + description: 'Zigbee fingbot plus', + whiteLabel: [ + tuya.whitelabel('Adaprox', 'TS0001_1', 'Zigbee fingbot plus', ['_TZ3210_dse8ogfy']), + ], + fromZigbee: [fz.on_off, tuya.fz.datapoints], + toZigbee: [tz.on_off, + { + ...tuya.tz.datapoints, + key: tuya.tz.datapoints.key.filter(item => item !== 'state').concat([ + 'mode', 'lower', 'upper', 'delay', 'reverse', 'touch', 'program', + ]) + }, + ], + exposes: [ + tuya.exposes.switch(), + e.enum('mode', ea.STATE_SET, ['click', 'switch', 'program']).withDescription('Working mode'), + e.numeric('lower', ea.STATE_SET).withValueMin(50).withValueMax(100).withValueStep(1).withUnit('%') + .withDescription('Down movement limit'), + e.numeric('upper', ea.STATE_SET).withValueMin(0).withValueMax(50).withValueStep(1).withUnit('%') + .withDescription('Up movement limit'), + e.numeric('delay', ea.STATE_SET).withValueMin(0).withValueMax(10).withValueStep(1).withUnit('s') + .withDescription('Sustain time'), + e.binary('reverse', ea.STATE_SET, 'ON', 'OFF').withDescription('Reverse'), + e.binary('touch', ea.STATE_SET, 'ON', 'OFF').withDescription('Touch controll'), + e.battery(), + ], + configure: async (device, coordinatorEndpoint, logger) => { + await tuya.configureMagicPacket(device, coordinatorEndpoint, logger); + await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ['genOnOff']); + }, + meta: { + tuyaDatapoints: [ + [0x65, 'mode', tuya.valueConverterBasic.lookup({'click': tuya.enum(0), 'switch': tuya.enum(1), 'program': tuya.enum(2)})], + [0x66, 'lower', tuya.valueConverter.raw], + [0x67, 'delay', tuya.valueConverter.raw], + [0x68, 'reverse', tuya.valueConverter.onOff], + [0x69, 'battery', tuya.valueConverter.raw], + [0x6a, 'upper', tuya.valueConverter.raw], + [0x6b, 'touch', tuya.valueConverter.onOff], + //? [0x6c, '', tuya.valueConverter.raw], + [0x6d, 'program', tuya.valueConverter.raw], + //? [0x70, '', tuya.valueConverter.raw], + ], + }, + }, ]; module.exports = definitions; From 062c2c8faa17e03159c8d9c7ab63c5330de630d6 Mon Sep 17 00:00:00 2001 From: Kirov Ilya Date: Wed, 14 Jun 2023 22:20:45 +0300 Subject: [PATCH 02/15] fix --- src/devices/tuya.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/tuya.ts b/src/devices/tuya.ts index 6e182a65bf413..f9c811544b225 100644 --- a/src/devices/tuya.ts +++ b/src/devices/tuya.ts @@ -4903,7 +4903,7 @@ const definitions: Definition[] = [ ], }, { - zigbeeModel: ['TS0001'], + fingerprint: tuya.fingerprint('TS0001', ['_TZ3210_dse8ogfy']), model: 'FingerBot', vendor: 'TuYa', description: 'Zigbee fingbot plus', From 752d6836612feb6313539d295bbe8c95d5d0fc69 Mon Sep 17 00:00:00 2001 From: Kirov Ilya Date: Wed, 14 Jun 2023 22:26:19 +0300 Subject: [PATCH 03/15] fix --- src/devices/tuya.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/tuya.ts b/src/devices/tuya.ts index f9c811544b225..66b27e6c9dadb 100644 --- a/src/devices/tuya.ts +++ b/src/devices/tuya.ts @@ -4920,7 +4920,7 @@ const definitions: Definition[] = [ }, ], exposes: [ - tuya.exposes.switch(), + e.switch(), e.enum('mode', ea.STATE_SET, ['click', 'switch', 'program']).withDescription('Working mode'), e.numeric('lower', ea.STATE_SET).withValueMin(50).withValueMax(100).withValueStep(1).withUnit('%') .withDescription('Down movement limit'), From 094aa4073684ed2e7b3dcecda07a6687a12701c4 Mon Sep 17 00:00:00 2001 From: Kirov Ilya Date: Wed, 14 Jun 2023 22:31:44 +0300 Subject: [PATCH 04/15] fix --- src/devices/tuya.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/devices/tuya.ts b/src/devices/tuya.ts index 66b27e6c9dadb..023f72b3a17ab 100644 --- a/src/devices/tuya.ts +++ b/src/devices/tuya.ts @@ -4914,20 +4914,20 @@ const definitions: Definition[] = [ toZigbee: [tz.on_off, { ...tuya.tz.datapoints, - key: tuya.tz.datapoints.key.filter(item => item !== 'state').concat([ + key: tuya.tz.datapoints.key.filter((item) => {item !== 'state'}).concat([ 'mode', 'lower', 'upper', 'delay', 'reverse', 'touch', 'program', - ]) + ]), }, ], exposes: [ e.switch(), e.enum('mode', ea.STATE_SET, ['click', 'switch', 'program']).withDescription('Working mode'), e.numeric('lower', ea.STATE_SET).withValueMin(50).withValueMax(100).withValueStep(1).withUnit('%') - .withDescription('Down movement limit'), + .withDescription('Down movement limit'), e.numeric('upper', ea.STATE_SET).withValueMin(0).withValueMax(50).withValueStep(1).withUnit('%') - .withDescription('Up movement limit'), + .withDescription('Up movement limit'), e.numeric('delay', ea.STATE_SET).withValueMin(0).withValueMax(10).withValueStep(1).withUnit('s') - .withDescription('Sustain time'), + .withDescription('Sustain time'), e.binary('reverse', ea.STATE_SET, 'ON', 'OFF').withDescription('Reverse'), e.binary('touch', ea.STATE_SET, 'ON', 'OFF').withDescription('Touch controll'), e.battery(), @@ -4945,9 +4945,9 @@ const definitions: Definition[] = [ [0x69, 'battery', tuya.valueConverter.raw], [0x6a, 'upper', tuya.valueConverter.raw], [0x6b, 'touch', tuya.valueConverter.onOff], - //? [0x6c, '', tuya.valueConverter.raw], + // ? [0x6c, '', tuya.valueConverter.raw], [0x6d, 'program', tuya.valueConverter.raw], - //? [0x70, '', tuya.valueConverter.raw], + // ? [0x70, '', tuya.valueConverter.raw], ], }, }, From 112b5922fad47b6a1f208a536515ee316489cd37 Mon Sep 17 00:00:00 2001 From: Kirov Ilya Date: Wed, 14 Jun 2023 22:34:52 +0300 Subject: [PATCH 05/15] fix --- src/devices/tuya.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/devices/tuya.ts b/src/devices/tuya.ts index 023f72b3a17ab..7ccac179d5782 100644 --- a/src/devices/tuya.ts +++ b/src/devices/tuya.ts @@ -4914,7 +4914,9 @@ const definitions: Definition[] = [ toZigbee: [tz.on_off, { ...tuya.tz.datapoints, - key: tuya.tz.datapoints.key.filter((item) => {item !== 'state'}).concat([ + key: tuya.tz.datapoints.key.filter((item) => { + return item !== 'state' + }).concat([ 'mode', 'lower', 'upper', 'delay', 'reverse', 'touch', 'program', ]), }, From 0949d7a6eff77878ae44aaa799ff2ffcfcc96ed8 Mon Sep 17 00:00:00 2001 From: Kirov Ilya Date: Wed, 14 Jun 2023 22:36:50 +0300 Subject: [PATCH 06/15] fix --- src/devices/tuya.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/tuya.ts b/src/devices/tuya.ts index 7ccac179d5782..173e00c3514c4 100644 --- a/src/devices/tuya.ts +++ b/src/devices/tuya.ts @@ -4915,7 +4915,7 @@ const definitions: Definition[] = [ { ...tuya.tz.datapoints, key: tuya.tz.datapoints.key.filter((item) => { - return item !== 'state' + return item !== 'state'; }).concat([ 'mode', 'lower', 'upper', 'delay', 'reverse', 'touch', 'program', ]), From 9316da4ee8fa843cc2499ca830f445dc8e20e0e1 Mon Sep 17 00:00:00 2001 From: Ilya Kirov Date: Sun, 18 Jun 2023 20:44:01 +0300 Subject: [PATCH 07/15] Update src/devices/tuya.ts Co-authored-by: Denys Karpenko --- src/devices/tuya.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/tuya.ts b/src/devices/tuya.ts index 173e00c3514c4..a0738bfb16690 100644 --- a/src/devices/tuya.ts +++ b/src/devices/tuya.ts @@ -4906,7 +4906,7 @@ const definitions: Definition[] = [ fingerprint: tuya.fingerprint('TS0001', ['_TZ3210_dse8ogfy']), model: 'FingerBot', vendor: 'TuYa', - description: 'Zigbee fingbot plus', + description: 'Zigbee fingerbot plus', whiteLabel: [ tuya.whitelabel('Adaprox', 'TS0001_1', 'Zigbee fingbot plus', ['_TZ3210_dse8ogfy']), ], From ffe23afdb4b398bb0ab5d9398fba5d47af89a20e Mon Sep 17 00:00:00 2001 From: Kirov Ilya Date: Sun, 18 Jun 2023 20:45:44 +0300 Subject: [PATCH 08/15] fixes --- src/devices/tuya.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/devices/tuya.ts b/src/devices/tuya.ts index a0738bfb16690..b4d6b49eea046 100644 --- a/src/devices/tuya.ts +++ b/src/devices/tuya.ts @@ -4908,15 +4908,13 @@ const definitions: Definition[] = [ vendor: 'TuYa', description: 'Zigbee fingerbot plus', whiteLabel: [ - tuya.whitelabel('Adaprox', 'TS0001_1', 'Zigbee fingbot plus', ['_TZ3210_dse8ogfy']), + tuya.whitelabel('Adaprox', 'TS0001_1', 'Zigbee fingerbot plus', ['_TZ3210_dse8ogfy']), ], fromZigbee: [fz.on_off, tuya.fz.datapoints], toZigbee: [tz.on_off, { ...tuya.tz.datapoints, - key: tuya.tz.datapoints.key.filter((item) => { - return item !== 'state'; - }).concat([ + key: tuya.tz.datapoints.key.concat([ 'mode', 'lower', 'upper', 'delay', 'reverse', 'touch', 'program', ]), }, @@ -4943,11 +4941,11 @@ const definitions: Definition[] = [ [0x65, 'mode', tuya.valueConverterBasic.lookup({'click': tuya.enum(0), 'switch': tuya.enum(1), 'program': tuya.enum(2)})], [0x66, 'lower', tuya.valueConverter.raw], [0x67, 'delay', tuya.valueConverter.raw], - [0x68, 'reverse', tuya.valueConverter.onOff], + [0x68, 'reverse', tuya.valueConverterBasic.lookup({ 'ON': 1, 'OFF': 0 })], [0x69, 'battery', tuya.valueConverter.raw], [0x6a, 'upper', tuya.valueConverter.raw], - [0x6b, 'touch', tuya.valueConverter.onOff], - // ? [0x6c, '', tuya.valueConverter.raw], + [0x6b, 'touch', tuya.valueConverterBasic.lookup({ 'ON': 1, 'OFF': 0 })], + //? [0x6c, '', tuya.valueConverter.onOff], [0x6d, 'program', tuya.valueConverter.raw], // ? [0x70, '', tuya.valueConverter.raw], ], From 224e4c0175ab059cfea9673670eb1f7a01da5fd5 Mon Sep 17 00:00:00 2001 From: Kirov Ilya Date: Sun, 18 Jun 2023 21:32:08 +0300 Subject: [PATCH 09/15] fix lint --- src/devices/tuya.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/devices/tuya.ts b/src/devices/tuya.ts index b4d6b49eea046..8ea77359bd047 100644 --- a/src/devices/tuya.ts +++ b/src/devices/tuya.ts @@ -4941,10 +4941,10 @@ const definitions: Definition[] = [ [0x65, 'mode', tuya.valueConverterBasic.lookup({'click': tuya.enum(0), 'switch': tuya.enum(1), 'program': tuya.enum(2)})], [0x66, 'lower', tuya.valueConverter.raw], [0x67, 'delay', tuya.valueConverter.raw], - [0x68, 'reverse', tuya.valueConverterBasic.lookup({ 'ON': 1, 'OFF': 0 })], + [0x68, 'reverse', tuya.valueConverterBasic.lookup({'ON': 1, 'OFF': 0})], [0x69, 'battery', tuya.valueConverter.raw], [0x6a, 'upper', tuya.valueConverter.raw], - [0x6b, 'touch', tuya.valueConverterBasic.lookup({ 'ON': 1, 'OFF': 0 })], + [0x6b, 'touch', tuya.valueConverterBasic.lookup({'ON': 1, 'OFF': 0})], //? [0x6c, '', tuya.valueConverter.onOff], [0x6d, 'program', tuya.valueConverter.raw], // ? [0x70, '', tuya.valueConverter.raw], From ad393d175b7fbaa18032f563d8aa0998f3ce24f3 Mon Sep 17 00:00:00 2001 From: Kirov Ilya Date: Sun, 18 Jun 2023 21:36:55 +0300 Subject: [PATCH 10/15] fix --- src/devices/tuya.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/tuya.ts b/src/devices/tuya.ts index 8ea77359bd047..b4093b5a519d1 100644 --- a/src/devices/tuya.ts +++ b/src/devices/tuya.ts @@ -4947,7 +4947,7 @@ const definitions: Definition[] = [ [0x6b, 'touch', tuya.valueConverterBasic.lookup({'ON': 1, 'OFF': 0})], //? [0x6c, '', tuya.valueConverter.onOff], [0x6d, 'program', tuya.valueConverter.raw], - // ? [0x70, '', tuya.valueConverter.raw], + //? [0x70, '', tuya.valueConverter.raw], ], }, }, From 5979bd0bd4d24b68881f0f57504445fac6f0e84a Mon Sep 17 00:00:00 2001 From: Kirov Ilya Date: Sun, 18 Jun 2023 21:40:46 +0300 Subject: [PATCH 11/15] fxi --- src/devices/tuya.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/devices/tuya.ts b/src/devices/tuya.ts index b4093b5a519d1..c0713123fe657 100644 --- a/src/devices/tuya.ts +++ b/src/devices/tuya.ts @@ -4945,9 +4945,9 @@ const definitions: Definition[] = [ [0x69, 'battery', tuya.valueConverter.raw], [0x6a, 'upper', tuya.valueConverter.raw], [0x6b, 'touch', tuya.valueConverterBasic.lookup({'ON': 1, 'OFF': 0})], - //? [0x6c, '', tuya.valueConverter.onOff], + // ? [0x6c, '', tuya.valueConverter.onOff], [0x6d, 'program', tuya.valueConverter.raw], - //? [0x70, '', tuya.valueConverter.raw], + // ? [0x70, '', tuya.valueConverter.raw], ], }, }, From db1ecfe3e4e5d7bd8f778a28d08b69ece71acc1e Mon Sep 17 00:00:00 2001 From: Ilya Kirov Date: Mon, 19 Jun 2023 10:49:35 +0300 Subject: [PATCH 12/15] fix sending command --- src/devices/tuya.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/devices/tuya.ts b/src/devices/tuya.ts index c0713123fe657..1a568b8f4e704 100644 --- a/src/devices/tuya.ts +++ b/src/devices/tuya.ts @@ -4937,6 +4937,7 @@ const definitions: Definition[] = [ await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ['genOnOff']); }, meta: { + tuyaSendCommand: 'sendData', tuyaDatapoints: [ [0x65, 'mode', tuya.valueConverterBasic.lookup({'click': tuya.enum(0), 'switch': tuya.enum(1), 'program': tuya.enum(2)})], [0x66, 'lower', tuya.valueConverter.raw], From fb35e9650a782b047d35eaeccf5a4a787b9e9a3d Mon Sep 17 00:00:00 2001 From: Kirov Ilya Date: Mon, 19 Jun 2023 21:31:11 +0300 Subject: [PATCH 13/15] fix reverse and touch type --- src/devices/tuya.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/devices/tuya.ts b/src/devices/tuya.ts index 1a568b8f4e704..fa6630c024d4a 100644 --- a/src/devices/tuya.ts +++ b/src/devices/tuya.ts @@ -4942,10 +4942,10 @@ const definitions: Definition[] = [ [0x65, 'mode', tuya.valueConverterBasic.lookup({'click': tuya.enum(0), 'switch': tuya.enum(1), 'program': tuya.enum(2)})], [0x66, 'lower', tuya.valueConverter.raw], [0x67, 'delay', tuya.valueConverter.raw], - [0x68, 'reverse', tuya.valueConverterBasic.lookup({'ON': 1, 'OFF': 0})], + [0x68, 'reverse', tuya.valueConverterBasic.lookup({'ON': tuya.enum(1), 'OFF': tuya.enum(0)})], [0x69, 'battery', tuya.valueConverter.raw], [0x6a, 'upper', tuya.valueConverter.raw], - [0x6b, 'touch', tuya.valueConverterBasic.lookup({'ON': 1, 'OFF': 0})], + [0x6b, 'touch', tuya.valueConverterBasic.lookup({'ON': true, 'OFF': false})], // ? [0x6c, '', tuya.valueConverter.onOff], [0x6d, 'program', tuya.valueConverter.raw], // ? [0x70, '', tuya.valueConverter.raw], From dda70db370d4abd1ede0b7a0a42119ebff0d3821 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Mon, 19 Jun 2023 20:45:59 +0200 Subject: [PATCH 14/15] Update tuya.ts --- src/lib/tuya.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/tuya.ts b/src/lib/tuya.ts index 18d64ee629a4b..a8be745e40d9a 100644 --- a/src/lib/tuya.ts +++ b/src/lib/tuya.ts @@ -776,6 +776,7 @@ const tuyaTz = { 'min_temperature', 'max_temperature', 'window_detection', 'boost_heating', 'alarm_ringtone', 'alarm_time', 'fan_speed', 'reverse_direction', 'border', 'click_control', 'motor_direction', 'opening_mode', 'factory_reset', 'set_upper_limit', 'set_bottom_limit', 'motor_speed', 'timer', 'reset_frost_lock', 'schedule_periodic', 'schedule_weekday', 'backlight_mode', 'calibration', 'motor_steering', + 'mode', 'lower', 'upper', 'delay', 'reverse', 'touch', 'program', ...[1, 2, 3, 4, 5, 6].map((no) => `schedule_slot_${no}`), 'minimum_range', 'maximum_range', 'detection_delay', 'fading_time', ], convertSet: async (entity, key, value, meta) => { From 7825e7a1ae6e48c40c5d73098b9e829fe50fd261 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Mon, 19 Jun 2023 20:47:49 +0200 Subject: [PATCH 15/15] Update tuya.ts --- src/devices/tuya.ts | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/devices/tuya.ts b/src/devices/tuya.ts index fa6630c024d4a..40e8a8e807e97 100644 --- a/src/devices/tuya.ts +++ b/src/devices/tuya.ts @@ -4904,23 +4904,16 @@ const definitions: Definition[] = [ }, { fingerprint: tuya.fingerprint('TS0001', ['_TZ3210_dse8ogfy']), - model: 'FingerBot', + model: 'TS0001_fingerbot', vendor: 'TuYa', description: 'Zigbee fingerbot plus', whiteLabel: [ - tuya.whitelabel('Adaprox', 'TS0001_1', 'Zigbee fingerbot plus', ['_TZ3210_dse8ogfy']), + tuya.whitelabel('Adaprox', 'TS0001_fingerbot_1', 'Zigbee fingerbot plus', ['_TZ3210_dse8ogfy']), ], fromZigbee: [fz.on_off, tuya.fz.datapoints], - toZigbee: [tz.on_off, - { - ...tuya.tz.datapoints, - key: tuya.tz.datapoints.key.concat([ - 'mode', 'lower', 'upper', 'delay', 'reverse', 'touch', 'program', - ]), - }, - ], + toZigbee: [tz.on_off, tuya.tz.datapoints], exposes: [ - e.switch(), + e.switch(), e.battery(), e.enum('mode', ea.STATE_SET, ['click', 'switch', 'program']).withDescription('Working mode'), e.numeric('lower', ea.STATE_SET).withValueMin(50).withValueMax(100).withValueStep(1).withUnit('%') .withDescription('Down movement limit'), @@ -4930,7 +4923,6 @@ const definitions: Definition[] = [ .withDescription('Sustain time'), e.binary('reverse', ea.STATE_SET, 'ON', 'OFF').withDescription('Reverse'), e.binary('touch', ea.STATE_SET, 'ON', 'OFF').withDescription('Touch controll'), - e.battery(), ], configure: async (device, coordinatorEndpoint, logger) => { await tuya.configureMagicPacket(device, coordinatorEndpoint, logger);