diff --git a/core/config/devices/LISEZMOI.txt b/core/config/devices/LISEZMOI.txt index 85586edd2..117964d57 100644 --- a/core/config/devices/LISEZMOI.txt +++ b/core/config/devices/LISEZMOI.txt @@ -183,6 +183,16 @@ La syntaxe actuelle est la suivante : "function": "rcvValue", "info": "01-measuredValue" }, + + // Fonctions supportées + // 'rcvValue' + // 'rcvValueEnum' + // "function": "rcvValueEnum", + // "enum": { + // "00": "single", + // "01": "double", + // "02": "long" + // } }, "FCC0-0112": { // CLUSTID-ATTRID diff --git a/core/config/devices/TS0021__TZ3210_3ulg9kpo/TS0021__TZ3210_3ulg9kpo.json b/core/config/devices/TS0021__TZ3210_3ulg9kpo/TS0021__TZ3210_3ulg9kpo.json new file mode 100644 index 000000000..37af05ceb --- /dev/null +++ b/core/config/devices/TS0021__TZ3210_3ulg9kpo/TS0021__TZ3210_3ulg9kpo.json @@ -0,0 +1,63 @@ +{ + "TS0021__TZ3210_3ulg9kpo": { + "manufacturer": "Tuya", + "model": "LKWSZ211", + "type": "Tuya 2 keys remote", + "genericType": "Light", + "category": { + "light": "1" + }, + "configuration": { + "icon": "Tuya-2KeysRemote", + "mainEP": "01", + "batteryType": "2x1.5V AAA" + }, + "commands": { + "Battery-Percent": { + "use": "inf_zbAttr-0001-BatteryPercent", + "params": "ep=01" + }, + "Click 1": { + "use": "inf_click", + "comment": "value = single, double or long", + "logicalId": "inf_click1", + "isVisible": 1 + }, + "Click 2": { + "use": "inf_click", + "comment": "value = single, double or long", + "logicalId": "inf_click2", + "isVisible": 1 + } + }, + "private": { + "EF00": { + "type": "tuya", + "01": { + "function": "rcvValueEnum", + "enum": { + "00": "single", + "01": "double", + "02": "long" + }, + "comment": "00=single, 01=double, 02=long", + "info": "inf_click1" + }, + "02": { + "function": "rcvValueEnum", + "enum": { + "00": "single", + "01": "double", + "02": "long" + }, + "comment": "00=single, 01=double, 02=long", + "info": "inf_click2" + }, + "10": { + "function": "rcvValue", + "info": "0001-01-0021" + } + } + } + } +} \ No newline at end of file diff --git a/core/config/devices/TS0021__TZ3210_3ulg9kpo/discovery-TS0021__TZ3210_3ulg9kpo.json b/core/config/devices/TS0021__TZ3210_3ulg9kpo/discovery-TS0021__TZ3210_3ulg9kpo.json new file mode 100644 index 000000000..f738b21bd --- /dev/null +++ b/core/config/devices/TS0021__TZ3210_3ulg9kpo/discovery-TS0021__TZ3210_3ulg9kpo.json @@ -0,0 +1 @@ +{"epCount":1,"endPoints":{"01":{"profId":"0104","devId":"0402","servClusters":{"0001":{"attributes":{"0000":{"dataType":"21","access":"05","value":0},"0020":{"dataType":"20","access":"05","value":0},"0021":{"dataType":"20","access":"05","value":0},"FFFD":{"dataType":"21","access":"05","value":1}},"commandsGenerated":"UNSUPPORTED","commandsReceived":"UNSUPPORTED"},"0500":{"attributes":{"0000":{"dataType":"30","access":"05","value":0},"0001":{"dataType":"31","access":"05","value":40},"0002":{"dataType":"19","access":"05","value":0},"0010":{"dataType":"F0","access":"07","value":"0000000000000000"},"0011":{"dataType":"20","access":"05","value":255},"FFFD":{"dataType":"21","access":"05","value":1}},"commandsReceived":"UNSUPPORTED","commandsGenerated":"UNSUPPORTED"},"EF00":{"attributes":{"0000":{"value":0}},"commandsReceived":"UNSUPPORTED","commandsGenerated":"UNSUPPORTED"},"0000":{"attributes":{"0000":{"dataType":"20","access":"05","value":3},"0001":{"dataType":"20","access":"05","value":66},"0002":{"dataType":"20","access":"05","value":0},"0003":{"dataType":"20","access":"05","value":1},"0004":{"dataType":"42","access":"05","value":"_TZ3210_3ulg9kpo"},"0005":{"dataType":"42","access":"05","value":"TS0021"},"0006":{"dataType":"42","access":"05","value":""},"0007":{"dataType":"30","access":"05","value":3},"FFDE":{"dataType":"20","access":"07","value":13},"FFFD":{"dataType":"21","access":"05","value":2},"FFFE":{"dataType":"30","access":"05","value":0},"FFE2":{"dataType":"20","access":"05","value":54},"FFE3":{"dataType":"48","access":"05","value":"00"}},"commandsGenerated":"UNSUPPORTED","commandsReceived":"UNSUPPORTED"},"0019":{"attributes":{"0008":{"value":65535},"0009":{"value":0},"FFFD":{"value":3},"0000":{"value":"FFFFFFFFFFFFFFFF"},"0001":{"value":4294967295},"0002":{"value":66},"0003":{"value":2},"0004":{"value":4294967295},"0006":{"value":0}}},"000A":{"attributes":{"FFFD":{"value":1}}}},"cliClusters":{"0019":{"attributes":{"0000":{},"0001":{},"0002":{},"0003":{},"0004":{},"0005":{},"0006":{},"0007":{},"0008":{},"0009":{},"FFFD":{}}},"000A":{"attributes":{"FFFD":{}}}}}},"powerSource":"battery","fileSignature":"Abeille discovery file"} \ No newline at end of file diff --git a/core/php/AbeilleParser-Tuya.php b/core/php/AbeilleParser-Tuya.php index 25f60624d..b3c3e2e55 100644 --- a/core/php/AbeilleParser-Tuya.php +++ b/core/php/AbeilleParser-Tuya.php @@ -123,6 +123,7 @@ function tuyaDecodeDp($addr, $ep, $dp, $mapping) { $info = "undefined-info"; $div = 1; // For optional value division $mult = 1; // For optional value multiplication + $enum = []; // For rcvValueEnum if (isset($mapping[$dpId]['function'])) { $func = $mapping[$dpId]['function']; if (isset($mapping[$dpId]['info'])) @@ -131,6 +132,8 @@ function tuyaDecodeDp($addr, $ep, $dp, $mapping) { $div = $mapping[$dpId]['div']; if (isset($mapping[$dpId]['mult'])) $mult = $mapping[$dpId]['mult']; + if (isset($mapping[$dpId]['enum'])) + $enum = $mapping[$dpId]['enum']; } else // This case should no longer be required. Obsolete ! $func = $mapping[$dpId]; @@ -218,6 +221,22 @@ function tuyaDecodeDp($addr, $ep, $dp, $mapping) { 'value' => $val, ); break; + case "rcvValueEnum": // Converting value thru enum + $val = $dp['data']; + // parserLog2("debug", $addr, "val=$val => enum=".json_encode($enum)); + if (isset($enum[$val])) + $valOut = $enum[$val]; + else { + parserLog2("error", $addr, " '".$func."' for dpId=$dpId: Unknown enum"); + $attributeN = false; + break; + } + $logMsg = " ".$dp['m']." => 'rcvValueEnum' => '".$info."'=".$valOut; + $attributeN = array( + 'name' => $info, + 'value' => $valOut, + ); + break; default: parserLog2("error", $addr, " Unknown Tuya function '".$func."' for dpId=".$dpId); diff --git a/docs/fr_FR/Changelog.md b/docs/fr_FR/Changelog.md index 9b13014ac..78cfc430a 100644 --- a/docs/fr_FR/Changelog.md +++ b/docs/fr_FR/Changelog.md @@ -1,5 +1,8 @@ # ChangeLog +- Amélioration: Modèle pour Tuya 2 keys remote (2731). +- Amélioration: Support Tuya: Ajout function générique 'rcvValueEnum'. + ## 241115-BETA-1 - Amélioration: Philips RWL021: Mise-à-jour modèle (1243). diff --git a/images/node_Tuya-2KeysRemote.png b/images/node_Tuya-2KeysRemote.png new file mode 100644 index 000000000..973591a7d Binary files /dev/null and b/images/node_Tuya-2KeysRemote.png differ