/* groovylint-disable CouldBeSwitchStatement, IfStatementBraces, ImplementationAsType, ImplicitReturnStatement, LineLength, MethodReturnTypeRequired, NoDouble, NoFloat, NoJavaUtilDate, NoWildcardImports, ParameterName, ReturnNullFromCatchBlock, StaticMethodsBeforeInstanceMethods, UnusedPrivateMethod, VariableName, VariableTypeRequired */
/**
* Tuya Multi Sensor 4 In 1 driver for Hubitat
*
* https://community.hubitat.com/t/alpha-tuya-zigbee-multi-sensor-4-in-1/92441
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
* for the specific language governing permissions and limitations under the License.
*
* ver. 1.0.0 2022-04-16 kkossev - Inital test version
* ver. 1.0.1 2022-04-18 kkossev - IAS cluster multiple TS0202, TS0210 and RH3040 Motion Sensors fingerprints; ignore repeated motion inactive events
* ver. 1.0.2 2022-04-21 kkossev - setMotion command; state.HashStringPars; advancedOptions: ledEnable (4in1); all DP info logs for 3in1!; _TZ3000_msl6wxk9 and other TS0202 devices inClusters correction
* ver. 1.0.3 2022-05-05 kkossev - '_TZE200_ztc6ggyl' 'Tuya ZigBee Breath Presence Sensor' tests; Illuminance unit changed to 'lx'
* ver. 1.0.4 2022-05-06 kkossev - DeleteAllStatesAndJobs; added isHumanPresenceSensorAIR(); isHumanPresenceSensorScene(); isHumanPresenceSensorFall(); convertTemperatureIfNeeded
* ver. 1.0.5 2022-06-11 kkossev - _TZE200_3towulqd +battery; 'Reset Motion to Inactive' made explicit option; sensitivity and keepTime for IAS sensors (TS0202-tested OK) and TS0601(not tested); capability "PowerSource" used as presence
* ver. 1.0.6 2022-07-10 kkossev - battery set to 0% and motion inactive when the device goes OFFLINE;
* ver. 1.0.7 2022-07-17 kkossev - _TZE200_ikvncluo (MOES) and _TZE200_lyetpprm radars; scale fadingTime and detectionDelay by 10; initialize() will resets to defaults; radar parameters update bug fix; removed unused states and attributes for radars
* ver. 1.0.8 2022-07-24 kkossev - _TZE200_auin8mzr (HumanPresenceSensorAIR) unacknowledgedTime; setLEDMode; setDetectionMode commands and vSensitivity; oSensitivity, vacancyDelay preferences; _TZE200_9qayzqa8 (black sensor) Attributes: motionType; preferences: inductionTime; targetDistance.
* ver. 1.0.9 2022-08-11 kkossev - degrees Celsius symbol bug fix; added square black radar _TZE200_0u3bj3rc support, temperatureOffset bug fix; decimal/number type prferences bug fix
* ver. 1.0.10 2022-08-15 kkossev - added Lux threshold parameter; square black radar LED configuration is resent back when device is powered on; round black PIR sensor powerSource is set to DC; added OWON OCP305 Presence Sensor
* ver. 1.0.11 2022-08-22 kkossev - IAS devices initialization improvements; presence threshold increased to 4 hours; 3in1 exceptions bug fixes; 3in1 and 4in1 exceptions bug fixes;
* ver. 1.0.12 2022-09-05 kkossev - added _TZE200_wukb7rhc MOES radar
* ver. 1.0.13 2022-09-25 kkossev - added _TZE200_jva8ink8 AUBESS radar; 2-in-1 Sensitivity setting bug fix
* ver. 1.0.14 2022-10-31 kkossev - added Bond motion sensor ZX-BS-J11W fingerprint for tests
* ver. 1.0.15 2022-12-03 kkossev - OWON 0x0406 cluster binding; added _TZE204_ztc6ggyl _TZE200_ar0slwnd _TZE200_sfiy5tfs _TZE200_mrf6vtua (was wrongly 3in1) mmWave radards;
* ver. 1.0.16 2022-12-10 kkossev - _TZE200_3towulqd (2-in-1) motion detection inverted; excluded from IAS group;
* ver. 1.1.0 2022-12-25 kkossev - SetPar() command; added 'Send Event when parameters change' option; code cleanup; added _TZE200_holel4dk; added 4-in-1 _TZ3210_rxqls8v0, _TZ3210_wuhzzfqg
* ver. 1.1.1 2023-01-08 kkossev - illuminance event bug fix; fadingTime minimum value 0.5; SetPar command shows in the UI the list of all possible parameters; _TZ3000_6ygjfyll bug fix;
* ver. 1.2.0 2023-02-07 kkossev - healthStatus; supressed repetative Radar detection delay and Radar fading time Info messages in the logs; logsOff missed when hub is restarted bug fix; capability 'Health Check'; _TZE200_3towulqd (2in1) new firmware versions fix for motion;
* ver. 1.2.1 2023-02-10 kkossev - reverted the unsuccessful changes made in the latest 1.2.0 version for _TZE200_3towulqd (2in1); added _TZE200_v6ossqfy as BlackSquareRadar; removed the wrongly added TUYATEC T/H sensor...
* ver. 1.2.2 2023-03-18 kkossev - typo in a log transaction fixed; added TS0202 _TZ3000_kmh5qpmb as a 3-in-1 type device'; added _TZE200_xpq2rzhq radar; bug fix in setMotion()
* ver. 1.3.0 2023-03-22 kkossev -'_TYST11_7hfcudw5' moved to 3-in-1 group; added deviceProfiles; fixed initializaiton missing on the first pairing; added batteryVoltage; added tuyaVersion; added delayed battery event;
* removed state.lastBattery; caught sensitivity par exception; fixed forcedProfile was not set automatically on Initialize;
* ver. 1.3.1 2023-03-29 kkossev - added 'invertMotion' option; 4in1 (Fantem) Refresh Tuya Magic; invertMotion is set to true by default for _TZE200_3towulqd;
* ver. 1.3.2 2023-04-17 kkossev - 4-in-1 parameter for adjusting the reporting time; supressed debug logs when ignoreDistance is flipped on; 'Send Event when parameters change' parameter is removed (events are always sent when there is a change); fadingTime and detectionDelay change was not logged and not sent as an event;
* ver. 1.3.3 2023-05-14 kkossev - code cleanup; added TS0202 _TZ3210_cwamkvua [Motion Sensor and Scene Switch]; added _TZE204_sooucan5 radar in a new TS0601_YXZBRB58_RADAR group (for tests); added reportingTime4in1 to setPar command options;
* ver. 1.3.4 2023-05-19 kkossev - added _TZE204_sxm7l9xa mmWave radar to TS0601_YXZBRB58_RADAR group; isRadar() bug fix;
* ver. 1.3.5 2023-05-28 kkossev - fixes for _TZE200_lu01t0zlTS0601_RADAR_MIR-TY-FALL mmWave radar (only the basic Motion and radarSensitivity is supported for now).
* ver. 1.3.6 2023-06-25 kkossev - chatty radars excessive debug logging bug fix
* ver. 1.3.7 2023-07-27 kkossev - fixes for _TZE204_sooucan5; moved _TZE204_sxm7l9xa to a new Device Profile TS0601_SXM7L9XA_RADAR; added TS0202 _TZ3040_bb6xaihh _TZ3040_wqmtjsyk; added _TZE204_qasjif9e radar;
* ver. 1.4.0 2023-08-06 kkossev - added new TS0225 _TZE200_hl0ss9oa 24GHz radar (TS0225_HL0SS9OA_RADAR); added basic support for the new TS0601 _TZE204_sbyx0lm6 radar w/ relay; added Hive MOT003; added sendCommand; added TS0202 _TZ3040_6ygjfyll
* ver. 1.4.1 2023-08-15 kkossev - TS0225_HL0SS9OA_RADAR ignoring ZCL illuminance and IAS motion reports; added radarAlarmMode, radarAlarmVolume, radarAlarmTime, Radar Static Detection Minimum Distance; added TS0225_AWARHUSB_RADAR TS0225_EGNGMRZH_RADAR
* ver. 1.4.2 2023-08-15 kkossev - 'Tuya Motion Sensor and Scene Switch' driver clone (Button capabilities enabled)
* ver. 1.4.3 2023-08-17 kkossev - TS0225 _TZ3218_awarhusb device profile changed to TS0225_LINPTECH_RADAR; cluster 0xE002 parser; added TS0601 _TZE204_ijxvkhd0 to TS0601_IJXVKHD0_RADAR; added _TZE204_dtzziy1e, _TZE200_ypprdwsl _TZE204_xsm7l9xa; YXZBRB58 radar illuminance and fadingTime bug fixes; added new TS0225_2AAELWXK_RADAR profile
* ver. 1.4.4 2023-08-18 kkossev - Method too large: Script1.processTuyaCluster ... :( TS0225_LINPTECH_RADAR: myParseDescriptionAsMap & swapOctets(); deleteAllCurrentStates(); TS0225_2AAELWXK_RADAR preferences configuration and commands; added Illuminance correction coefficient; code cleanup
* ver. 1.4.5 2023-08-26 kkossev - reduced debug logs;
* ver. 1.5.0 2023-08-27 kkossev - added TS0601 _TZE204_yensya2c radar; refactoring: deviceProfilesV2: tuyaDPs; unknownDPs; added _TZE204_clrdrnya; _TZE204_mhxn2jso; 2in1: _TZE200_1ibpyhdc, _TZE200_bh3n6gk8; added TS0202 _TZ3000_jmrgyl7o _TZ3000_hktqahrq _TZ3000_kmh5qpmb _TZ3040_usvkzkyn; added TS0601 _TZE204_kapvnnlk new device profile TS0601_KAPVNNLK_RADAR
* ver. 1.5.1 2023-09-09 kkossev - _TZE204_kapvnnlk fingerprint and DPs correction; added 2AAELWXK preferences; TS0225_LINPTECH_RADAR known preferences using E002 cluster
* ver. 1.5.2 2023-09-14 kkossev - TS0601_IJXVKHD0_RADAR ignore dp1 dp2; Distance logs changed to Debug; Refresh() updates driver version;
* ver. 1.5.3 2023-09-30 kkossev - humanMotionState re-enabled for TS0225_HL0SS9OA_RADAR; tuyaVersion is updated on Refresh; LINPTECH: added existance_time event; illuminance parsing exception changed to debug level; leave_time changed to fadingTime; fadingTime configuration
*
* ver. 1.6.0 2023-10-08 kkossev - (dev. branch) major refactoring of the preferences input; all preference settings are reset to defaults when changing device profile; added 'all' attribute; present state 'motionStarted' in a human-readable form.
* setPar and sendCommand major refactoring +parameters changed from enum to string; TS0601_KAPVNNLK_RADAR parameters support;
* ver. 1.6.1 2023-10-12 kkossev - (dev. branch) TS0601_KAPVNNLK_RADAR TS0225_HL0SS9OA_RADAR TS0225_2AAELWXK_RADAR TS0601_RADAR_MIR-HE200-TY TS0601_YXZBRB58_RADAR TS0601_SXM7L9XA_RADAR TS0601_IJXVKHD0_RADAR TS0601_YENSYA2C_RADAR TS0601_SBYX0LM6_RADAR TS0601_PIR_AIR TS0601_PIR_PRESENCE refactoring; radar enum preferences;
* ver. 1.6.2 2023-10-14 kkossev - (dev. branch) LINPTECH preferences changed to enum type; enum preferences - set defVal; TS0601_PIR_PRESENCE - preference inductionTime changed to fadingTime, humanMotionState sent as event; TS0225_2AAELWXK_RADAR - preferences setting; _TZE204_ijxvkhd0 fixes; Linptech fixes; added radarAlarmMode radarAlarmVolume;
* ver. 1.6.3 2023-10-15 kkossev - (dev. branch) setPar() and preferences updates bug fixes; automatic fix for preferences which type was changed between the versions, including bool;
* ver. 1.6.4 2023-10-18 kkossev - (dev. branch) added TS0601 _TZE204_e5m9c5hl to SXM7L9XA profile; added a bunch of new manufacturers to SBYX0LM6 profile;
* ver. 1.6.5 2023-10-23 kkossev - (dev. branch) bugfix: setPar decimal values for enum types; added SONOFF_SNZB-06P_RADAR; added SIHAS_USM-300Z_4_IN_1; added SONOFF_MOTION_IAS; TS0202_MOTION_SWITCH _TZ3210_cwamkvua refactoring; luxThreshold hardcoded to 0 and not configurable!; do not try to input preferences of a type bool
* TS0601_2IN1 refactoring; added keepTime and sensitivity attributes for PIR sensors; added _TZE200_ppuj1vem 3-in-1; TS0601_3IN1 refactoring; added _TZ3210_0aqbrnts 4in1;
* ver. 1.6.6 2023-11-02 kkossev - _TZE204_ijxvkhd0 staticDetectionSensitivity bug fix; SONOFF radar clusters binding; assign profile UNKNOWN for unknown devices; SONOFF radar cluster FC11 attr 2001 processing as occupancy; TS0601_IJXVKHD0_RADAR sensitivity as number; number type pars are scalled also!; _TZE204_ijxvkhd0 sensitivity settings changes; added preProc function; TS0601_IJXVKHD0_RADAR - removed multiplying by 10
* ver. 1.6.7 2023-11-09 kkossev - (dev. branch) divideBy10 fix for TS0601_IJXVKHD0_RADAR; added new TS0202_MOTION_IAS_CONFIGURABLE group
* ver. 1.6.8 2023-11-20 kkossev - SONOFF SNZB-06P RADAR bug fixes; added radarSensitivity and fadingTime preferences; update parameters for Tuya radars bug fix;
* ver. 1.7.0 2024-01-14 kkossev - (dev.branch) Groovy linting; added TS0225_O7OE4N9A_RADAR TS0225 _TZFED8_o7oe4n9a for tests; TS0601 _TZE200_3towulqd new fingerprint @JdThomas24
* ver. 1.8.0 2024-03-23 kkossev - (dev.branch) more Groovy linting; fixed 'This driver requires HE version 2.2.7 (May 2021) or newer!' bug; device.latestState('battery') exception bug fixes;
* ver. 1.8.1 2024-04-16 kkossev - (dev.branch) tuyaDPs list of maps bug fixes; added _TZE204_kyhbrfyl; added smallMotionDetectionSensitivity;
*
* TODO: W.I.P. TS0202_4IN1 refactoring
* TODO: TS0601_3IN1 - process Battery/USB powerSource change events! (0..4)
* TODO: ignore invalid humidity reprots (>100 %)
* TODO: publish examples of SetPar usage : https://community.hubitat.com/t/4-in-1-parameter-for-adjusting-reporting-time/115793/12?u=kkossev
* TODO: quickRef
* TODO: Linptech spammyDPsToIgnore[] !
* TODO: delete all previous preferencies when changing the device profile ?
* TODO: do not show errors/warnings for new settings ie breath , led etc if the preferences setsetare not set and saved - https://community.hubitat.com/t/the-new-tuya-human-presence-sensors-ts0225-tze200-hl0ss9oa-tze200-2aaelwxk-have-actually-5-8ghz-modules-inside/122283/294?u=kkossev
* TODO: check why only voltage is reported for SONOFF_MOTION_IAS;
* TODO: hide motionKeepTime and motionSensitivity for SONOFF_MOTION_IAS;
* TODO: if isSleepy - store in state.cmds and send when the device wakes up! (on both update() and refresh()
* TODO: TS0202_MOTION_IAS missing sensitivity and retrigger time settings bug fix;
* TODO: handle preferences of a type TEXT
* TODO: add Sensitivity Levels Presets
* TODO: when device rejoins the network, read the battry percentage again!
* TODO: Black Square Radar validateAndFixPreferences: map not found for preference indicatorLight
* TODO: command for black radar LED
* TODO: TS0225_2AAELWXK_RADAR dont see an attribute as mentioned that shows the distance at which the motion was detected. - https://community.hubitat.com/t/the-new-tuya-human-presence-sensors-ts0225-tze200-hl0ss9oa-tze200-2aaelwxk-have-actually-5-8ghz-modules-inside/122283/294?u=kkossev
* TODO: TS0225_2AAELWXK_RADAR led setting not working - https://community.hubitat.com/t/the-new-tuya-human-presence-sensors-ts0225-tze200-hl0ss9oa-tze200-2aaelwxk-have-actually-5-8ghz-modules-inside/122283/294?u=kkossev
* TODO: radars - ignore the change of the presence/motion being turned off when changing parameters for a period of 10 seconds ?
* TODO: TS0225_HL0SS9OA_RADAR - add presets
* TOOD: Tuya 2in1 illuminance_interval (dp=102) !
* TODO: humanMotionState - add preference: enum "disabled", "enabled", "enabled w/ timing" ...; add delayed event
* TODO: use getKeepTimeOpts() for processing dp=0x0A (10) keep time ! ( 2-in-1 time is wrong)
* TODO: add to state 'last battery' the time when the battery was last reported.
* TODO: check the bindings commands in configure()
* TODO: implement getActiveEndpoints()
*/
/* groovylint-disable-next-line ImplicitReturnStatement */
static String version() { '1.8.1' }
static String timeStamp() { '2024/04/16 10:34 PM' }
import groovy.json.*
import groovy.transform.Field
import hubitat.zigbee.clusters.iaszone.ZoneStatus
import hubitat.zigbee.zcl.DataType
import java.util.concurrent.ConcurrentHashMap
@Field static final Boolean _DEBUG = false
@Field static final Boolean _TRACE_ALL = false // trace all messages, including the spammy ones
metadata {
definition(name: 'Tuya Multi Sensor 4 In 1', namespace: 'kkossev', author: 'Krassimir Kossev', importUrl: 'https://raw.githubusercontent.com/kkossev/Hubitat/development/Drivers/Tuya%20Multi%20Sensor%204%20In%201/Tuya%20Multi%20Sensor%204%20In%201.groovy', singleThreaded: true ) {
capability 'Sensor'
//capability "Configuration"
capability 'Battery'
capability 'MotionSensor'
capability 'TemperatureMeasurement'
capability 'RelativeHumidityMeasurement'
capability 'IlluminanceMeasurement'
capability 'TamperAlert'
capability 'PowerSource'
capability 'HealthCheck'
capability 'Refresh'
//capability "PushableButton" // uncomment for TS0202 _TZ3210_cwamkvua [Motion Sensor and Scene Switch]
//capability "DoubleTapableButton"
//capability "HoldableButton"
//attribute "occupancy", "enum", ["occupied", "unoccupied"] // https://developer.smartthings.com/docs/devices/capabilities/capabilities-reference // https://developer.smartthings.com/capabilities/occupancySensor
attribute 'all', 'string'
attribute 'batteryVoltage', 'number'
attribute 'healthStatus', 'enum', ['offline', 'online']
attribute 'distance', 'number' // Tuya Radar
attribute 'unacknowledgedTime', 'number' // AIR models
attribute 'existance_time', 'number' // BlackSquareRadar & LINPTECH
attribute 'leave_time', 'number' // BlackSquareRadar only
attribute' pushed', 'number' // TS0202 _TZ3210_cwamkvua [Motion Sensor and Scene Switch]
attribute 'keepTime', 'enum', ['10 seconds', '30 seconds', '60 seconds', '120 seconds']
attribute 'sensitivity', 'enum', ['low', 'medium', 'high']
attribute 'radarSensitivity', 'number'
attribute 'staticDetectionSensitivity', 'number' // added 10/29/2023
attribute 'smallMotionDetectionSensitivity', 'number' // added 04/16/2024
attribute 'detectionDelay', 'decimal'
attribute 'fadingTime', 'decimal'
attribute 'minimumDistance', 'decimal'
attribute 'maximumDistance', 'decimal'
attribute 'radarStatus', 'enum', ['checking', 'check_success', 'check_failure', 'others', 'comm_fault', 'radar_fault']
attribute 'humanMotionState', 'enum', ['none', 'moving', 'small_move', 'stationary', 'presence', 'peaceful', 'large_move']
attribute 'radarAlarmMode', 'enum', ['0 - arm', '1 - off', '2 - alarm', '3 - doorbell']
attribute 'radarAlarmVolume', 'enum', ['0 - low', '1 - medium', '2 - high', '3 - mute']
command 'configure', [[name: 'Configure the sensor after switching drivers']]
command 'initialize', [[name: 'Initialize the sensor after switching drivers. \n\r ***** Will load device default values! *****' ]]
command 'setMotion', [[name: 'setMotion', type: 'ENUM', constraints: ['No selection', 'active', 'inactive'], description: 'Force motion active/inactive (for tests)']]
command 'refresh', [[name: 'May work for some DC/mains powered sensors only']]
command 'setPar', [
[name:'par', type: 'STRING', description: 'preference parameter name', constraints: ['STRING']],
[name:'val', type: 'STRING', description: 'preference parameter value', constraints: ['STRING']]
]
command 'sendCommand', [[name: 'sendCommand', type: 'STRING', constraints: ['STRING'], description: 'send Tuya Radar commands']]
if (_DEBUG == true) {
command 'testTuyaCmd', [
[name:'dpCommand', type: 'STRING', description: 'Tuya DP Command', constraints: ['STRING']],
[name:'dpValue', type: 'STRING', description: 'Tuya DP value', constraints: ['STRING']],
[name:'dpType', type: 'ENUM', constraints: ['DP_TYPE_VALUE', 'DP_TYPE_BOOL', 'DP_TYPE_ENUM'], description: 'DP data type']
]
command 'testParse', [[name:'val', type: 'STRING', description: 'description', constraints: ['STRING']]]
command 'test', [[name:'val', type: 'STRING', description: 'preference parameter value', constraints: ['STRING']]]
}
deviceProfilesV2.each { profileName, profileMap ->
if (profileMap.fingerprints != null) {
profileMap.fingerprints.each {
fingerprint it
}
}
}
}
preferences {
if (advancedOptions == true || advancedOptions == false) { // Groovy ... :)
//input (name: "quickref", type: "hidden", title: "$ttStyleStrQuick Reference v${version()}")
input(name: 'txtEnable', type: 'bool', title: 'Description text logging', description: 'Display sensor states on HE log page. The recommended value is true', defaultValue: true)
input(name: 'logEnable', type: 'bool', title: 'Debug logging', description: 'Debug information, useful for troubleshooting. The recommended value is false', defaultValue: true)
if (('motionReset' in DEVICE?.preferences) && (DEVICE?.preferences.motionReset == true)) {
input(name: 'motionReset', type: 'bool', title: 'Reset Motion to Inactive', description: 'Software Reset Motion to Inactive after timeout. Recommended value is false', defaultValue: false)
if (motionReset.value == true) {
input('motionResetTimer', 'number', title: 'Motion Reset Timer', description: 'After motion is detected, wait ___ second(s) until resetting to inactive state. Default = 60 seconds', range: '0..7200', defaultValue: 60)
}
}
/* groovylint-disable-next-line ConstantIfExpression */
if (false) { // TODO!
input('temperatureOffset', 'decimal', title: 'Temperature offset', description: 'Select how many degrees to adjust the temperature.', range: '-100..100', defaultValue: 0.0)
input('humidityOffset', 'decimal', title: 'Humidity offset', description: 'Enter a percentage to adjust the humidity.', range: '-50..50', defaultValue: 0.0)
}
}
if (('reportingTime4in1' in DEVICE?.preferences)) { // 4in1()
input('reportingTime4in1', 'number', title: '4-in-1 Reporting Time', description: '4-in-1 Reporting Time configuration, minutes.
0 will enable real-time (10 seconds) reporting!', range: '0..7200', defaultValue: DEFAULT_REPORTING_4IN1)
}
if (('ledEnable' in DEVICE?.preferences)) { // 4in1()
input(name: 'ledEnable', type: 'bool', title: 'Enable LED', description: 'Enable LED blinking when motion is detected (4in1 only)', defaultValue: true)
}
if (advancedOptions == true || advancedOptions == false) {
if ((DEVICE?.capabilities?.IlluminanceMeasurement == true) && (DEVICE?.preferences.luxThreshold != false)) {
input('luxThreshold', 'number', title: 'Lux threshold', description: 'Minimum change in the lux which will trigger an event', range: '0..999', defaultValue: 5)
input name: 'illuminanceCoeff', type: 'decimal', title: 'Illuminance Correction Coefficient', description: 'Illuminance correction coefficient, range (0.10..10.00)', range: '0.10..10.00', defaultValue: 1.00
}
}
if (('DistanceMeasurement' in DEVICE?.capabilities)) {
input(name: 'ignoreDistance', type: 'bool', title: 'Ignore distance reports', description: 'If not used, ignore the distance reports received every 1 second!', defaultValue: true)
}
// itterate over DEVICE.preferences map and inputIt all!
(DEVICE?.preferences).each { key, value ->
Map map = inputIt(key)
if (map != null && map != [:]) {
input map
}
}
/* groovylint-disable-next-line ConstantIfExpression */
if (false) {
if ('textLargeMotion' in DEVICE?.preferences) {
input(name: 'textLargeMotion', type: 'text', title: 'Motion Detection Settigs ⇨', description: 'Settings for movement types such as walking, trotting, fast running, circling, jumping and other movements ')
}
if ('textSmallMotion' in DEVICE?.preferences) {
input(name: 'textSmallMotion', type: 'text', title: 'Small Motion Detection Settigs ⇒', description: 'Settings for small movement types such as tilting the head, waving, raising the hand, flicking the body, playing with the mobile phone, turning over the book, etc.. ')
}
if ('textStaticDetection' in DEVICE?.preferences) {
input(name: 'textStaticDetection', type: 'text', title: 'Static Detection Settigs ⇨', description: 'The sensor can detect breathing within a certain range to determine people presence in the detection area (for example, while sleeping or reading).')
}
}
input(name: 'advancedOptions', type: 'bool', title: 'Advanced Options', description: 'Enables showing the advanced options/preferences. Hit F5 in the browser to refresh the Preferences list
.May not work for all device types!', defaultValue: false)
if (advancedOptions == true) {
input(name: 'forcedProfile', type: 'enum', title: 'Device Profile', description: 'Forcely change the Device Profile, if the model/manufacturer was not recognized automatically.
Warning! Manually setting a device profile may not always work!',
options: getDeviceProfilesMap())
if ('Battery' in DEVICE?.capabilities) {
input(name: 'batteryDelay', type: 'enum', title: 'Battery Events Delay', description:'Select the Battery Events Delay
(default is no delay)', options: delayBatteryOpts.options, defaultValue: delayBatteryOpts.defaultValue)
}
if ('invertMotion' in DEVICE?.preferences) {
input(name: 'invertMotion', type: 'bool', title: 'Invert Motion Active/Not Active', description: 'Some Tuya motion sensors may report the motion active/inactive inverted...', defaultValue: false)
}
}
input(name: 'allStatusTextEnable', type: 'bool', title: "Enable 'all' Status Attribute Creation?", description: 'Status attribute for Devices/Rooms', defaultValue: false)
}
}
@Field static final Boolean _IGNORE_ZCL_REPORTS = true
@Field static final String UNKNOWN = 'UNKNOWN'
@Field static final Map blackRadarLedOptions = [ '0' : 'Off', '1' : 'On' ] // HumanPresenceSensorAIR
@Field static final Map TS0225humanMotionState = [ '0': 'none', '1': 'moving', '2': 'small_move', '3': 'stationary' ]
@Field static String ttStyleStr = ''
/*
LivingRoom Bedroom Washroom Aisle Kitchen
Motion detection distance - 800 500 300 900 1000
Motion detection sensitivity - 6x 6x 5x 8x 6x
Small motion detection distance - 600 400 400 400 600
Small motion detection sensitivity 9 6 8 5 8
Static detection distance 600 600 400 0 0
Static detection sensitivity 9x 9x 8x 8x 8x
*/
// TODO - remove all the usused sensitivity and keepTime static maps!
@Field static final Map sensitivityOpts = [ defaultValue: 2, options: [0: 'low', 1: 'medium', 2: 'high']]
@Field static final Map keepTime4in1Opts = [ defaultValue: 0, options: [0: '10 seconds', 1: '30 seconds', 2: '60 seconds', 3: '120 seconds', 4: '240 seconds', 5: '480 seconds']]
@Field static final Map keepTime2in1Opts = [ defaultValue: 0, options: [0: '10 seconds', 1: '30 seconds', 2: '60 seconds', 3: '120 seconds']]
@Field static final Map keepTime3in1Opts = [ defaultValue: 0, options: [0: '30 seconds', 1: '60 seconds', 2: '120 seconds']]
@Field static final Map keepTimeIASOpts = [ defaultValue: 0, options: [0: '30 seconds', 1: '60 seconds', 2: '120 seconds']]
@Field static final Map powerSourceOpts = [ defaultValue: 0, options: [0: 'unknown', 1: 'mains', 2: 'mains', 3: 'battery', 4: 'dc', 5: 'emergency mains', 6: 'emergency mains']]
@Field static final Map delayBatteryOpts = [ defaultValue: 0, options: [0: 'No delay', 30: '30 seconds', 3600: '1 hour', 14400: '4 hours', 28800: '8 hours', 43200: '12 hours']]
Map getKeepTimeOpts() { return is4in1() ? keepTime4in1Opts : is3in1() ? keepTime3in1Opts : is2in1() ? keepTime2in1Opts : keepTimeIASOpts }
@Field static final Integer presenceCountTreshold = 4
@Field static final Integer defaultPollingInterval = 3600
@Field static final Integer DEFAULT_REPORTING_4IN1 = 5 // time in minutes
String getDeviceProfile() { state.deviceProfile ?: 'UNKNOWN' }
Map getDEVICE() { deviceProfilesV2[getDeviceProfile()] }
List getDeviceProfiles() { deviceProfilesV2.keySet() }
List getDeviceProfilesMap() { deviceProfilesV2.values().description as List }
boolean is4in1() { return getDeviceProfile().contains('TS0202_4IN1') }
boolean is3in1() { return getDeviceProfile().contains('TS0601_3IN1') }
boolean is2in1() { return getDeviceProfile().contains('TS0601_2IN1') }
boolean isMotionSwitch() { return getDeviceProfile().contains('TS0202_MOTION_SWITCH') }
boolean isIAS() { DEVICE?.device?.isIAS == true }
BigDecimal getTemperatureDiv() { isSiHAS() ? 100.0 : 10.0 } // temperatureEvent
BigDecimal getHumidityDiv() { isSiHAS() ? 100.0 : 1.0 } // humidityEvent
boolean isZY_M100Radar() { return getDeviceProfile().contains('TS0601_TUYA_RADAR') }
boolean isBlackPIRsensor() { return getDeviceProfile().contains('TS0601_PIR_PRESENCE') }
boolean isBlackSquareRadar() { return getDeviceProfile().contains('TS0601_BLACK_SQUARE_RADAR') }
boolean isHumanPresenceSensorAIR() { return getDeviceProfile().contains('TS0601_PIR_AIR') } // isHumanPresenceSensorScene() removed in version 1.6.1
boolean isYXZBRB58radar() { return getDeviceProfile().contains('TS0601_YXZBRB58_RADAR') }
boolean isSXM7L9XAradar() { return getDeviceProfile().contains('TS0601_SXM7L9XA_RADAR') }
boolean isIJXVKHD0radar() { return getDeviceProfile().contains('TS0601_IJXVKHD0_RADAR') }
boolean isHL0SS9OAradar() { return getDeviceProfile().contains('TS0225_HL0SS9OA_RADAR') }
boolean is2AAELWXKradar() { return getDeviceProfile().contains('TS0225_2AAELWXK_RADAR') } // same as HL0SS9OA, but another set of DPs
boolean isSBYX0LM6radar() { return getDeviceProfile().contains('TS0601_SBYX0LM6_RADAR') }
boolean isLINPTECHradar() { return getDeviceProfile().contains('TS0225_LINPTECH_RADAR') }
boolean isEGNGMRZHradar() { return getDeviceProfile().contains('TS0225_EGNGMRZH_RADAR') }
boolean isKAPVNNLKradar() { return getDeviceProfile().contains('TS0601_KAPVNNLK_RADAR') }
boolean isSONOFF() { return getDeviceProfile().contains('SONOFF_SNZB-06P_RADAR') }
boolean isSiHAS() { return getDeviceProfile().contains('SIHAS_USM-300Z_4_IN_1') }
// TODO - check if DPs are declared in the device profiles and remove this function
boolean isChattyRadarReport(final Map descMap) {
if ((isZY_M100Radar() || isSBYX0LM6radar()) && (settings?.ignoreDistance == true)) {
return (descMap?.clusterId == 'EF00' && (descMap.command in ['01', '02']) && descMap.data?.size > 2 && descMap.data[2] == '09')
}
else if ((isYXZBRB58radar() || isSXM7L9XAradar()) && (settings?.ignoreDistance == true)) {
return (descMap?.clusterId == 'EF00' && (descMap.command in ['01', '02']) && descMap.data?.size > 2 && descMap.data[2] == '6D')
} /* TODO - check !
else if (isKAPVNNLKradar() && settings?.ignoreDistance == true) {
return (descMap?.clusterId == "EF00" && (descMap.command in ["01", "02"]) && descMap.data?.size > 2 && descMap.data[2] == "13")
} */
// if (isHL0SS9OAradar()) { // humanMotionState
// return (descMap?.clusterId == "EF00" && (descMap.command in ["01", "02"]) && descMap.data?.size > 2 && descMap.data[2] == "0B")
// }
/* groovylint-disable-next-line UnnecessaryElseStatement */
else {
return false
}
}
@Field static final Map deviceProfilesV2 = [
// is4in1()
'TS0202_4IN1' : [
description : 'Tuya 4in1 (motion/temp/humi/lux) sensor',
models : ['TS0202'], // model: 'ZB003-X' vendor: 'Fantem'
device : [type: 'PIR', isIAS:true, powerSource: 'dc', isSleepy:false], // check powerSource
capabilities : ['MotionSensor': true, 'TemperatureMeasurement': true, 'RelativeHumidityMeasurement': true, 'IlluminanceMeasurement': true, 'tamper': true, 'Battery': true],
preferences : ['motionReset':true, 'reportingTime4in1':true, 'ledEnable':true, 'keepTime':true, 'sensitivity':true],
commands : ['reportingTime4in1':'reportingTime4in1', 'resetStats':'resetStats', 'refresh':'refresh', 'initialize':'initialize', 'updateAllPreferences': 'updateAllPreferences', 'resetPreferencesToDefaults':'resetPreferencesToDefaults', 'validateAndFixPreferences':'validateAndFixPreferences'],
fingerprints : [
[profileId:'0104', endpointId:'01', inClusters:'0000,0001,0500,EF00', outClusters:'0019,000A', model:'TS0202', manufacturer:'_TZ3210_zmy9hjay', deviceJoinName: 'Tuya TS0202 Multi Sensor 4 In 1'], // pairing: double click!
[profileId:'0104', endpointId:'01', inClusters:'0000,0001,0500,EF00', outClusters:'0019,000A', model:'5j6ifxj', manufacturer:'_TYST11_i5j6ifxj', deviceJoinName: 'Tuya TS0202 Multi Sensor 4 In 1'],
[profileId:'0104', endpointId:'01', inClusters:'0000,0001,0500,EF00', outClusters:'0019,000A', model:'hfcudw5', manufacturer:'_TYST11_7hfcudw5', deviceJoinName: 'Tuya TS0202 Multi Sensor 4 In 1'],
[profileId:'0104', endpointId:'01', inClusters:'0000,0001,0500,EF00', outClusters:'0019,000A', model:'TS0202', manufacturer:'_TZ3210_rxqls8v0', deviceJoinName: 'Tuya TS0202 Multi Sensor 4 In 1'], // not tested
[profileId:'0104', endpointId:'01', inClusters:'0000,0001,0500,EF00', outClusters:'0019,000A', model:'TS0202', manufacturer:'_TZ3210_wuhzzfqg', deviceJoinName: 'Tuya TS0202 Multi Sensor 4 In 1'], // https://community.hubitat.com/t/release-tuya-zigbee-multi-sensor-4-in-1-pir-motion-sensors-and-mmwave-presence-radars/92441/282?u=kkossev
[profileId:'0104', endpointId:'01', inClusters:'0000,0001,0500,EF00', outClusters:'0019,000A', model:'TS0202', manufacturer:'_TZ3210_0aqbrnts', deviceJoinName: 'Tuya TS0202 Multi Sensor 4 In 1 is-thpl-zb']
],
tuyaDPs: [
[dp:1, name:'motion', type:'enum', rw: 'ro', min:0, max:1 , defVal:'0', scale:1, map:[0:'inactive', 1:'active'] , unit:'', description:'Motion'],
// ??? check ^^
[dp:5, name:'tamper', type:'enum', rw: 'ro', min:0, max:1 , defVal:'0', scale:1, map:[0:'clear', 1:'detected'] , unit:'', description:'Tamper detection'],
// ??? IAS cluster is used instead? {occupancy: (zoneStatus & 1) > 0, tamper: (zoneStatus & 4) > 0};
[dp:9, name:'sensitivity', type:'enum', rw: 'rw', min:0, max:2, defVal:'2', unit:'', map:[0:'low', 1:'medium', 2:'high'], title:'Sensitivity', description:'PIR sensor sensitivity (update at the time motion is activated)'],
// check ^^^^^ hasOwnProperty('currentZoneSensitivityLevel') .read('ssIasZone', ['currentZoneSensitivityLevel', 61441, 'zoneStatus']
[dp:10, name:'keepTime', type:'enum', rw: 'rw', min:0, max:5, defVal:'0', unit:'seconds', map:[0:'0 seconds', 1:'30 seconds', 2:'60 seconds', 3:'120 seconds', 4:'240 seconds', 5:'480 seconds'], title:'Keep Time', description:'PIR keep time in seconds (update at the time motion is activated)'],
// check ^^^^^ hasOwnProperty('61441')
[dp:25, name:'battery2', type:'number', rw: 'ro', min:0, max:100, defVal:100, scale:1, unit:'%', description:'Remaining battery 2 in %'],
// ^^^TODO^^^
[dp:102, name:'reportingTime4in1', type:'number', rw: 'ro', min:0, max:1440, defVal:10, step:5, scale:1, unit:'minutes', title:'Reporting Interval', description:'Reporting interval in minutes'],
[dp:104, name:'tempCalibration', type:'decimal', rw:'ro', min:-2.0, max:2.0, defVal:0.0, scale:10, unit:'deg.', title:'Temperature Calibration', description:'Temperature calibration (-2.0...2.0)'],
// ^^^TODO^^ pre-process negative values !
[dp:105, name:'humiCalibration', type:'number', rw: 'ro', min:-15, max:15, defVal:0, scale:1, unit:'%RH', title:'Huidity Calibration', description:'Humidity Calibration'],
[dp:106, name:'illumCalibration', type:'number', rw: 'ro', min:-20, max:20, defVal:0, scale:1, unit:'Lx', title:'Illuminance Calibration', description:'Illuminance calibration in lux/i>'],
[dp:107, name:'temperature', type:'decimal', rw: 'ro', min:-20.0, max:80.0, defVal:0.0, scale:10, unit:'deg.', description:'Temperature'],
[dp:108, name:'humidity', type:'number', rw: 'ro', min:1, max:100, defVal:100, scale:1, unit:'%RH', description:'Humidity'],
[dp:109, name:'pirSensorEnable', type:'enum', rw: 'ro', min:0, max:1 , defVal:'1', scale:1, map:[0:'disabled', 1:'enabled'] , unit:'', title:'MoPIR Sensor Enable', description:'Enable PIR sensor'],
[dp:110, name:'battery', type:'number', rw: 'ro', min:0, max:100, defVal:100, scale:1, unit:'%', description:'Battery level'],
// ^^^TODO^^^
[dp:111, name:'ledEnable', type:'enum', rw: 'ro', min:0, max:1 , defVal:'0', scale:1, map:[0:'disabled', 1:'enabled'] , unit:'', title:'LED Enable', description:'Enable LED'],
[dp:112, name:'reportingEnable', type:'enum', rw: 'ro', min:0, max:1 , defVal:'0', scale:1, map:[0:'disabled', 1:'enabled'] , unit:'', title:'Reporting Enable', description:'Enable reporting'],
],
deviceJoinName: 'Tuya Multi Sensor 4 In 1',
configuration : ['battery': false]
],
// is3in1()
'TS0601_3IN1' : [ // https://szneo.com/en/products/show.php?id=239 // https://www.banggood.com/Tuya-Smart-Linkage-ZB-Motion-Sensor-Human-Infrared-Detector-Mobile-Phone-Remote-Monitoring-PIR-Sensor-p-1858413.html?cur_warehouse=CN
description : 'Tuya 3in1 (Motion/Temp/Humi) sensor',
models : ['TS0601'],
device : [type: 'PIR', powerSource: 'dc', isSleepy:false], // powerSource changes batt/DC dynamically!
capabilities : ['MotionSensor': true, 'TemperatureMeasurement': true, 'RelativeHumidityMeasurement': true, 'tamper': true, 'Battery': true],
preferences : ['motionReset':true],
commands : ['resetStats':'resetStats', 'refresh':'refresh', 'initialize':'initialize', 'updateAllPreferences': 'updateAllPreferences', 'resetPreferencesToDefaults':'resetPreferencesToDefaults', 'validateAndFixPreferences':'validateAndFixPreferences'],
fingerprints : [
[profileId:'0104', endpointId:'01', inClusters:'0000,0004,0005,EF00', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_7hfcudw5', deviceJoinName: 'Tuya NAS-PD07 Multi Sensor 3 In 1'],
[profileId:'0104', endpointId:'01', inClusters:'0000,0004,0005,EF00', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_ppuj1vem', deviceJoinName: 'Tuya NAS-PD07 Multi Sensor 3 In 1']
],
tuyaDPs: [
[dp:101, name:'motion', type:'enum', rw: 'ro', min:0, max:1 , defVal:'0', scale:1, map:[0:'inactive', 1:'active'] , unit:'', description:'Motion'],
[dp:102, name:'battery', type:'number', rw: 'ro', min:0, max:100, defVal:100, scale:1, unit:'%', description:'Battery level'],
// ^^^TODO^^^
[dp:103, name:'tamper', type:'enum', rw: 'ro', min:0, max:1 , defVal:'0', scale:1, map:[0:'clear', 1:'detected'] , unit:'', description:'Tamper detection'],
[dp:104, name:'temperature', type:'decimal', rw: 'ro', min:-20.0, max:80.0, defVal:0.0, scale:10, unit:'deg.', description:'Temperature'],
[dp:105, name:'humidity', type:'number', rw: 'ro', min:1, max:100, defVal:100, scale:1, unit:'%RH', description:'Humidity'],
[dp:106, name:'tempScale', type:'enum', rw: 'ro', min:0, max:1 , defVal:'0', scale:1, map:[0:'Celsius', 1:'Fahrenheit'] , unit:'', description:'Temperature scale'],
[dp:107, name:'minTemp', type:'number', rw: 'ro', min:-20, max:80, defVal:0, scale:1, unit:'deg.', description:'Minimal temperature'],
[dp:108, name:'maxTemp', type:'number', rw: 'ro', min:-20, max:80, defVal:0, scale:1, unit:'deg.', description:'Maximal temperature'],
[dp:109, name:'minHumidity', type:'number', rw: 'ro', min:0, max:100, defVal:0, scale:1, unit:'%RH', description:'Minimal humidity'],
[dp:110, name:'maxHumidity', type:'number', rw: 'ro', min:0, max:100, defVal:0, scale:1, unit:'%RH', description:'Maximal humidity'],
[dp:111, name:'tempAlarm', type:'enum', rw: 'ro', min:0, max:1 , defVal:'0', scale:1, map:[0:'inactive', 1:'active'] , unit:'', description:'Temperature alarm'],
[dp:112, name:'humidityAlarm', type:'enum', rw: 'ro', min:0, max:1 , defVal:'0', scale:1, map:[0:'inactive', 1:'active'] , unit:'', description:'Humidity alarm'],
[dp:113, name:'alarmType', type:'enum', rw: 'ro', min:0, max:1 , defVal:'0', scale:1, map:[0:'type0', 1:'type1'] , unit:'', description:'Alarm type'],
],
deviceJoinName: 'Tuya Multi Sensor 3 In 1',
configuration : ['battery': false]
],
// is2in1()
'TS0601_2IN1' : [ // https://github.com/Koenkk/zigbee-herdsman-converters/blob/bf32ce2b74689328048b407e56ca936dc7a54a0b/src/devices/tuya.ts#L4568
description : 'Tuya 2in1 (Motion and Illuminance) sensor',
models : ['TS0601'],
device : [type: 'PIR', isIAS:false, powerSource: 'battery', isSleepy:true],
capabilities : ['MotionSensor': true, 'IlluminanceMeasurement': true, 'Battery': true],
preferences : ['motionReset':true, 'invertMotion':true, 'keepTime':'10', 'sensitivity':'9'],
commands : ['resetStats':'resetStats', 'refresh':'refresh', 'initialize':'initialize', 'updateAllPreferences': 'updateAllPreferences', 'resetPreferencesToDefaults':'resetPreferencesToDefaults', 'validateAndFixPreferences':'validateAndFixPreferences'],
fingerprints : [
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_3towulqd', deviceJoinName: 'Tuya 2 in 1 Zigbee Mini PIR Motion Detector + Bright Lux ZG-204ZL'], // https://www.aliexpress.com/item/1005004095233195.html
[profileId:'0104', endpointId:'01', inClusters:'0000,0500,0001,0400', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_3towulqd', deviceJoinName: 'Tuya 2 in 1 Zigbee Mini PIR Motion Detector + Bright Lux ZG-204ZL'], // https://community.hubitat.com/t/release-tuya-zigbee-multi-sensor-4-in-1-pir-motion-sensors-and-mmwave-presence-radars-w-healthstatus/92441/934?u=kkossev
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_bh3n6gk8', deviceJoinName: 'Tuya 2 in 1 Zigbee Mini PIR Motion Detector + Bright Lux ZG-204ZL'], // https://community.hubitat.com/t/tze200-bh3n6gk8-motion-sensor-not-working/123213?u=kkossev
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_1ibpyhdc', deviceJoinName: 'Tuya 2 in 1 Zigbee Mini PIR Motion Detector + Bright Lux ZG-204ZL'] //
],
tuyaDPs: [
[dp:1, name:'motion', type:'enum', rw: 'ro', min:0, max:1 , defVal:'0', scale:1, map:[0:'inactive', 1:'active'] , unit:'', description:'Motion'],
[dp:4, name:'battery', type:'number', rw: 'ro', min:0, max:100, defVal:100, scale:1, unit:'%', title:'Battery level', description:'Battery level'],
[dp:9, name:'sensitivity', type:'enum', rw: 'rw', min:0, max:2, defVal:'2', unit:'', map:[0:'low', 1:'medium', 2:'high'], title:'Sensitivity', description:'PIR sensor sensitivity (update at the time motion is activated)'],
[dp:10, name:'keepTime', type:'enum', rw: 'rw', min:0, max:3, defVal:'0', unit:'seconds', map:[0:'10 seconds', 1:'30 seconds', 2:'60 seconds', 3:'120 seconds'], title:'Keep Time', description:'PIR keep time in seconds (update at the time motion is activated)'],
[dp:12, name:'illuminance', type:'number', rw: 'ro', min:0, max:1000, defVal:0, scale:1, unit:'lx', title:'illuminance', description:'illuminance'],
[dp:102, name:'illuminance_interval', type:'number', rw: 'rw', min:1, max:720, defVal:1, scale:1, unit:'minutes', title:'Illuminance Interval', description:'Brightness acquisition interval (update at the time motion is activated)'],
],
deviceJoinName: 'Tuya Multi Sensor 2 In 1',
configuration : ['battery': false]
],
'TS0202_MOTION_IAS' : [
description : 'Tuya TS0202 Motion sensor (IAS)',
models : ['TS0202', 'RH3040'],
device : [type: 'PIR', isIAS:true, powerSource: 'battery', isSleepy:true],
capabilities : ['MotionSensor': true, 'Battery': true],
preferences : ['motionReset':true, 'keepTime':false, 'sensitivity':false],
fingerprints : [
[profileId:'0104', endpointId:'01', inClusters:'0000,0003,0001,0500', outClusters:'0000,0003,0001,0500', model:'TS0202', manufacturer:'_TYZB01_dl7cejts', deviceJoinName: 'Tuya TS0202 Motion Sensor'], // KK model: 'ZM-RT201'// 5 seconds (!) reset period for testing
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0003,0000', outClusters:'1000,0006,0019,000A', model:'TS0202', manufacturer:'_TZ3000_mmtwjmaq', deviceJoinName: 'Tuya TS0202 Motion Sensor'],
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0003,0000', outClusters:'1000,0006,0019,000A', model:'TS0202', manufacturer:'_TZ3000_otvn3lne', deviceJoinName: 'Tuya TS0202 Motion Sensor'],
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0003,0000', outClusters:'1000,0006,0019,000A', model:'TS0202', manufacturer:'_TYZB01_jytabjkb', deviceJoinName: 'Tuya TS0202 Motion Sensor'],
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0003,0000', outClusters:'1000,0006,0019,000A', model:'TS0202', manufacturer:'_TYZB01_ef5xlc9q', deviceJoinName: 'Tuya TS0202 Motion Sensor'],
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0003,0000', outClusters:'1000,0006,0019,000A', model:'TS0202', manufacturer:'_TYZB01_vwqnz1sn', deviceJoinName: 'Tuya TS0202 Motion Sensor'],
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0003,0000', outClusters:'1000,0006,0019,000A', model:'TS0202', manufacturer:'_TYZB01_2b8f6cio', deviceJoinName: 'Tuya TS0202 Motion Sensor'],
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0003,0000', outClusters:'1000,0006,0019,000A', model:'TS0202', manufacturer:'_TZE200_bq5c8xfe', deviceJoinName: 'Tuya TS0202 Motion Sensor'],
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0003,0000', outClusters:'1000,0006,0019,000A', model:'TS0202', manufacturer:'_TYZB01_qjqgmqxr', deviceJoinName: 'Tuya TS0202 Motion Sensor'],
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0003,0000', outClusters:'1000,0006,0019,000A', model:'TS0202', manufacturer:'_TYZB01_zwvaj5wy', deviceJoinName: 'Tuya TS0202 Motion Sensor'],
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0003,0000', outClusters:'1000,0006,0019,000A', model:'TS0202', manufacturer:'_TZ3000_bsvqrxru', deviceJoinName: 'Tuya TS0202 Motion Sensor'],
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0003,0000', outClusters:'1000,0006,0019,000A', model:'TS0202', manufacturer:'_TYZB01_tv3wxhcz', deviceJoinName: 'Tuya TS0202 Motion Sensor'],
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0003,0000', outClusters:'1000,0006,0019,000A', model:'TS0202', manufacturer:'_TYZB01_hqbdru35', deviceJoinName: 'Tuya TS0202 Motion Sensor'],
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0003,0000', outClusters:'1000,0006,0019,000A', model:'TS0202', manufacturer:'_TZ3000_tiwq83wk', deviceJoinName: 'Tuya TS0202 Motion Sensor'],
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0003,0000', outClusters:'1000,0006,0019,000A', model:'TS0202', manufacturer:'_TZ3000_ykwcwxmz', deviceJoinName: 'Tuya TS0202 Motion Sensor'],
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0003,0000', outClusters:'1000,0006,0019,000A', model:'TS0202', manufacturer:'_TZ3000_hgu1dlak', deviceJoinName: 'Tuya TS0202 Motion Sensor'],
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0003,0000', outClusters:'1000,0006,0019,000A', model:'TS0202', manufacturer:'_TZ3000_hktqahrq', deviceJoinName: 'Tuya TS0202 Motion Sensor'],
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0003,0000', outClusters:'1000,0006,0019,000A', model:'TS0202', manufacturer:'_TZ3000_jmrgyl7o', deviceJoinName: 'Tuya TS0202 Motion Sensor'], // not tested! //https://zigbee.blakadder.com/Luminea_ZX-5311.html
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0003,0000', outClusters:'1000,0006,0019,000A', model:'WHD02', manufacturer:'_TZ3000_kmh5qpmb', deviceJoinName: 'Tuya TS0202 Motion Sensor'],
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0003,0000', outClusters:'1000,0006,0019,000A', model:'TS0202', manufacturer:'_TZ3040_usvkzkyn', deviceJoinName: 'Tuya TS0202 Motion Sensor'], // not tested // https://www.amazon.ae/Rechargeable-Detector-Security-Devices-Required/dp/B0BKKJ48QH
[profileId:'0104', endpointId:'01', inClusters:'0000,0001,0003,0500', model:'RH3040', manufacturer:'TUYATEC-53o41joc', deviceJoinName: 'TUYATEC RH3040 Motion Sensor'], // 60 seconds reset period
[profileId:'0104', endpointId:'01', inClusters:'0000,0001,0003,0500', model:'RH3040', manufacturer:'TUYATEC-b5g40alm', deviceJoinName: 'TUYATEC RH3040 Motion Sensor'],
[profileId:'0104', endpointId:'01', inClusters:'0000,0001,0003,0500', model:'RH3040', manufacturer:'TUYATEC-deetibst', deviceJoinName: 'TUYATEC RH3040 Motion Sensor'],
[profileId:'0104', endpointId:'01', inClusters:'0000,0001,0003,0500', model:'RH3040', manufacturer:'TUYATEC-bd5faf9p', deviceJoinName: 'Nedis/Samotech RH3040 Motion Sensor'],
[profileId:'0104', endpointId:'01', inClusters:'0000,0001,0003,0500', model:'RH3040', manufacturer:'TUYATEC-zn9wyqtr', deviceJoinName: 'Samotech RH3040 Motion Sensor'], // vendor: 'Samotech', model: 'SM301Z'
[profileId:'0104', endpointId:'01', inClusters:'0000,0001,0003,0500', model:'RH3040', manufacturer:'TUYATEC-b3ov3nor', deviceJoinName: 'Zemismart RH3040 Motion Sensor'], // vendor: 'Nedis', model: 'ZBSM10WT'
[profileId:'0104', endpointId:'01', inClusters:'0000,0001,0003,0500', model:'RH3040', manufacturer:'TUYATEC-2gn2zf9e', deviceJoinName: 'TUYATEC RH3040 Motion Sensor'],
[profileId:'0104', endpointId:'01', inClusters:'0000,0001,0003,0500,0B05', outClusters:'0019', model:'TY0202', manufacturer:'_TZ1800_fcdjzz3s', deviceJoinName: 'Lidl TY0202 Motion Sensor'],
[profileId:'0104', endpointId:'01', inClusters:'0000,0001,0003,0500,0B05,FCC0', outClusters:'0019,FCC0', model:'TY0202', manufacturer:'_TZ3000_4ggd8ezp', deviceJoinName: 'Bond motion sensor ZX-BS-J11W'], // https://community.hubitat.com/t/what-driver-to-use-for-this-motion-sensor-zx-bs-j11w-or-ty0202/103953/4
[profileId:'0104', endpointId:'01', inClusters:'0001,0003,0004,0500,0000', outClusters:'0004,0006,1000,0019,000A', model:'TS0202', manufacturer:'_TZ3040_bb6xaihh', deviceJoinName: 'Tuya TS0202 Motion Sensor'], // https://github.com/Koenkk/zigbee2mqtt/issues/17364
[profileId:'0104', endpointId:'01', inClusters:'0001,0003,0004,0500,0000', outClusters:'0004,0006,1000,0019,000A', model:'TS0202', manufacturer:'_TZ3040_wqmtjsyk', deviceJoinName: 'Tuya TS0202 Motion Sensor'], // not tested
[profileId:'0104', endpointId:'01', inClusters:'0001,0003,0004,0500,0000', outClusters:'0004,0006,1000,0019,000A', model:'TS0202', manufacturer:'_TZ3000_h4wnrtck', deviceJoinName: 'Tuya TS0202 Motion Sensor'] // not tested
],
deviceJoinName: 'Tuya TS0202 Motion Sensor',
configuration : ['battery': false]
],
'TS0202_MOTION_IAS_CONFIGURABLE' : [
description : 'Tuya TS0202 Motion sensor (IAS) configurable',
models : ['TS0202'],
device : [type: 'PIR', isIAS:true, powerSource: 'battery', isSleepy:true],
capabilities : ['MotionSensor': true, 'Battery': true],
preferences : ['motionReset':true, 'keepTime':'0x0500:0xF001', 'sensitivity':'0x0500:0x0013'],
fingerprints : [
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0003,0000', outClusters:'1000,0006,0019,000A', model:'TS0202', manufacturer:'_TZ3000_mcxw5ehu', deviceJoinName: 'Tuya TS0202 ZM-35H-Q Motion Sensor'], // TODO: PIR sensor sensitivity and PIR keep time in seconds ['30', '60', '120']
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0003,0000', outClusters:'1000,0006,0019,000A', model:'TS0202', manufacturer:'_TZ3000_msl6wxk9', deviceJoinName: 'Tuya TS0202 ZM-35H-Q Motion Sensor'], // TODO: fz.ZM35HQ_attr ['30', '60', '120']
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0003,0000', outClusters:'1000,0006,0019,000A', model:'TS0202', manufacturer:'_TZ3040_msl6wxk9', deviceJoinName: 'Tuya TS0202 ZM-35H-Q Motion Sensor'],
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0003,0000', outClusters:'1000,0006,0019,000A', model:'TS0202', manufacturer:'_TZ3040_fwxuzcf4', deviceJoinName: 'Tuya TS0202 ZM-35H-Q Motion Sensor'],
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0003,0000', outClusters:'1000,0006,0019,000A', model:'TS0202', manufacturer:'_TZ3000_6ygjfyll', deviceJoinName: 'Tuya TS0202 Motion Sensor'], // https://community.hubitat.com/t/release-tuya-zigbee-multi-sensor-4-in-1-pir-motion-sensors-and-mmwave-presence-radars/92441/289?u=kkossev
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,0003,0000', outClusters:'1000,0006,0019,000A', model:'TS0202', manufacturer:'_TZ3040_6ygjfyll', deviceJoinName: 'Tuya TS0202 Motion Sensor'], // https://community.hubitat.com/t/tuya-motion-sensor-driver/72000/54?u=kkossev
],
attributes: [
[at:'0x0500:0x0013', name:'sensitivity', type:'enum', rw: 'rw', min:0, max:2, defVal:'2', unit:'', map:[0:'low', 1:'medium', 2:'high'], title:'Sensitivity', description:'PIR sensor sensitivity (update at the time motion is activated)'],
[at:'0x0500:0xF001', name:'keepTime', type:'enum', rw: 'rw', min:0, max:2, defVal:'0', unit:'seconds', map:[0:'30 seconds', 1:'60 seconds', 2:'120 seconds'], title:'Keep Time', description:'PIR keep time in seconds (update at the time motion is activated)'],
],
deviceJoinName: 'Tuya TS0202 Motion Sensor configurable',
configuration : ['battery': false]
],
// isMotionSwitch()
'TS0202_MOTION_SWITCH': [
description : 'Tuya Motion Sensor and Scene Switch',
models : ['TS0202'],
device : [type: 'PIR', isIAS:true, powerSource: 'battery', isSleepy:true],
capabilities : ['MotionSensor':true, 'IlluminanceMeasurement':true, 'switch':true, 'Battery':true],
preferences : ['motionReset':true, 'keepTime':false, 'sensitivity':false, 'luxThreshold':false], // keepTime is hardcoded 60 seconds, no sensitivity configuration
fingerprints : [
[profileId:'0104', endpointId:'01', inClusters:'0001,0500,EF00,0000', outClusters:'0019,000A', model:'TS0202', manufacturer:'_TZ3210_cwamkvua', deviceJoinName: 'Tuya Motion Sensor and Scene Switch'] // vendor: 'Linkoze', model: 'LKMSZ001'
],
tuyaDPs: [
[dp:101, name:'pushed', type:'enum', rw: 'ro', min:0, max:2, defVal:'0', scale:1, map:[0:'pushed', 1:'doubleTapped', 2:'held'] , unit:'', title:'Presence state', description:'Presence state'],
[dp:102, name:'illuminance', type:'number', rw: 'ro', min:0, max:1, defVal:0, scale:1, unit:'lx', title:'illuminance', description:'illuminance'],
],
deviceJoinName: 'Tuya Motion Sensor and Scene Switch',
configuration : ['battery': false]
],
'TS0601_PIR_PRESENCE' : [ // isBlackPIRsensor() // https://github.com/zigpy/zha-device-handlers/issues/1618
description : 'Tuya PIR Human Motion Presence Sensor (Black)',
models : ['TS0601'],
device : [type: 'radar', powerSource: 'dc', isSleepy:false],
capabilities : ['MotionSensor': true, 'Battery': true],
preferences : ['fadingTime':'102', 'targetDistance':'105'],
commands : ['resetStats':'resetStats', 'resetPreferencesToDefaults':'resetPreferencesToDefaults'],
fingerprints : [
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_9qayzqa8', deviceJoinName: 'Smart PIR Human Motion Presence Sensor (Black)'] // https://www.aliexpress.com/item/1005004296422003.html
],
tuyaDPs: [ // TODO - defaults !!
[dp:102, name:'fadingTime', type:'number', rw: 'rw', min:24, max:300 , defVal:24, scale:1, unit:'seconds', title:'Fading time', description:'Fading(Induction) time'],
[dp:105, name:'targetDistance', type:'enum', rw: 'rw', min:0, max:9 , defVal:'6', scale:1, map:[0:'0.5 m', 1:'1.0 m', 2:'1.5 m', 3:'2.0 m', 4:'2.5 m', 5:'3.0 m', 6:'3.5 m', 7:'4.0 m', 8:'4.5 m', 9:'5.0 m'] , unit:'meters', title:'Target Distance', description:'Target Distance'],
[dp:119, name:'motion', type:'enum', rw: 'ro', min:0, max:1 , defVal:'0', scale:1, map:[0:'inactive', 1:'active'] , unit:'', title:'Presence state', description:'Presence state'],
[dp:141, name:'humanMotionState', type:'enum', rw: 'ro', min:0, max:4 , defVal:'0', scale:1, map:[0:'none', 1:'presence', 2:'peaceful', 3:'small_move', 4:'large_move'] , unit:'', title:'Presence state', description:'Presence state'],
],
deviceJoinName: 'Tuya PIR Human Motion Presence Sensor LQ-CG01-RDR',
configuration : ['battery': false]
],
'TS0601_PIR_AIR' : [ // isHumanPresenceSensorAIR() - Human presence sensor AIR (PIR sensor!) - o_sensitivity, v_sensitivity, led_status, vacancy_delay, light_on_luminance_prefer, light_off_luminance_prefer, mode, luminance_level, reference_luminance, vacant_confirm_time
description : 'Tuya PIR Human Motion Presence Sensor AIR',
models : ['TS0601'],
device : [type: 'radar', powerSource: 'dc', isSleepy:false],
capabilities : ['MotionSensor': true, 'IlluminanceMeasurement': true, 'Battery': true], // TODO - check if battery powered?
preferences : ['vacancyDelay':'103', 'ledStatusAIR':'110', 'detectionMode':'104', 'vSensitivity':'101', 'oSensitivity':'102', 'lightOnLuminance':'107', 'lightOffLuminance':'108' ],
commands : ['resetStats':'resetStats'],
fingerprints : [
[profileId:'0104', endpointId:'01', inClusters:'0000,0004,0005,EF00', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_auin8mzr', deviceJoinName: 'Tuya PIR Human Motion Presence Sensor AIR'] // Tuya LY-TAD-K616S-ZB
],
tuyaDPs: [ // TODO - defaults !!
[dp:101, name:'vSensitivity', type:'enum', rw: 'rw', min:0, max:1, defVal:'0', scale:1, map:[0:'Speed Priority', 1:'Standard', 2:'Accuracy Priority'] , unit:'-', title:'vSensitivity options', description:'V-Sensitivity mode'],
[dp:102, name:'oSensitivity', type:'enum', rw: 'rw', min:0, max:1, defVal:'0', scale:1, map:[0:'Sensitive', 1:'Normal', 2:'Cautious'] , unit:'', title:'oSensitivity options', description:'O-Sensitivity mode'],
[dp:103, name:'vacancyDelay', type:'number', rw: 'rw', min:0, max:1000, defVal:10, scale:1, unit:'seconds', title:'Vacancy Delay', description:'Vacancy Delay'],
[dp:104, name:'detectionMode', type:'enum', rw: 'rw', min:0, max:1 , defVal:'0', scale:1, map:[0:'General Model', 1:'Temporary Stay', 2:'Basic Detecton', 3:'PIR Sensor Test'] , unit:'', title:'Detection Mode', description:'Detection Mode'],
[dp:105, name:'unacknowledgedTime', type:'number', rw: 'ro', min:0, max:9 , defVal:7, scale:1, unit:'seconds', description:'unacknowledgedTime'],
[dp:106, name:'illuminance', type:'number', rw: 'ro', min:0, max:2000, defVal:0, scale:1, unit:'lx', title:'illuminance', description:'illuminance'],
[dp:107, name:'lightOnLuminance', type:'number', rw: 'rw', min:0, max:2000, defVal:0, scale:1, unit:'lx', title:'lightOnLuminance', description:'lightOnLuminance'], // Ligter, Medium, ... ?// TODO =- check range 0 - 10000 ?
[dp:108, name:'lightOffLuminance', type:'number', rw: 'rw', min:0, max:2000, defVal:0, scale:1, unit:'lx', title:'lightOffLuminance', description:'lightOffLuminance'],
[dp:109, name:'luminanceLevel', type:'number', rw: 'ro', min:0, max:2000, defVal:0, scale:1, unit:'lx', title:'luminanceLevel', description:'luminanceLevel'], // Ligter, Medium, ... ?
[dp:110, name:'ledStatusAIR', type:'enum', rw: 'rw', min:0, max:1 , defVal:'0', scale:1, map:[0: 'Switch On', 1:'Switch Off', 2: 'Default'] , unit:'', title:'LED status', description:'Led status switch'],
],
deviceJoinName: 'Tuya PIR Human Motion Presence Sensor AIR',
configuration : ['battery': false]
],
'SONOFF_MOTION_IAS' : [
description : 'Sonoff/eWeLink Motion sensor',
models : ['eWeLink'],
device : [type: 'PIR', isIAS:true, powerSource: 'battery', isSleepy:true], // very sleepy !!
capabilities : ['MotionSensor': true, 'Battery': true],
preferences : ['motionReset':true, 'keepTime':false, 'sensitivity':false], // just enable or disable showing the motionReset preference, no link to tuyaDPs or attributes map!
fingerprints : [
[profileId:'0104', endpointId:'01', inClusters:'0000,0003,0500,0001', outClusters:'0003', model:'ms01', manufacturer:'eWeLink', deviceJoinName: 'eWeLink Motion Sensor'], // for testL 60 seconds re-triggering period!
[profileId:'0104', endpointId:'01', inClusters:'0000,0003,0500,0001', outClusters:'0003', model:'msO1', manufacturer:'eWeLink', deviceJoinName: 'eWeLink Motion Sensor'], // second variant
[profileId:'0104', endpointId:'01', inClusters:'0000,0003,0500,0001', outClusters:'0003', model:'MS01', manufacturer:'eWeLink', deviceJoinName: 'eWeLink Motion Sensor'] // third variant
],
deviceJoinName: 'Sonoff/eWeLink Motion sensor',
configuration : [
'0x0001':[['bind':true], ['reporting':'0x21, 0x20, 3600, 7200, 0x02']], // TODO - use the reproting values
'0x0500':[['bind':false], ['sensitivity':false], ['keepTime':false]], // TODO - use in update function
] // battery percentage, min 3600, max 7200, UINT8, delta 2
],
'NONTUYA_MOTION_IAS' : [
description : 'Other OEM Motion sensors (IAS)',
models : ['MOT003', 'XXX'],
device : [type: 'PIR', isIAS:true, powerSource: 'battery', isSleepy:true],
capabilities : ['MotionSensor': true, 'Battery': true],
preferences : ['motionReset':true, 'keepTime':'0x0500:0xF001', 'sensitivity':'0x0500:0x0013'],
fingerprints : [
[profileId:'0104', endpointId:'01', inClusters:'0000,0001,0003,0020,0400,0402,0500', outClusters:'0019', model:'MOT003', manufacturer:'HiveHome.com', deviceJoinName: 'Hive Motion Sensor'] // https://community.hubitat.com/t/hive-motion-sensors-can-we-get-custom-driver-sorted/108177?u=kkossev
],
attributes: [
[at:'0x0500:0x0013', name:'sensitivity', type:'enum', rw: 'rw', min:0, max:2, defVal:'2', unit:'', map:[0:'low', 1:'medium', 2:'high'], title:'Sensitivity', description:'PIR sensor sensitivity (update at the time motion is activated)'],
[at:'0x0500:0xF001', name:'keepTime', type:'enum', rw: 'rw', min:0, max:2, defVal:'0', unit:'seconds', map:[0:'30 seconds', 1:'60 seconds', 2:'120 seconds'], title:'Keep Time', description:'PIR keep time in seconds (update at the time motion is activated)'],
],
deviceJoinName: 'Other OEM Motion sensor (IAS)',
configuration : ['battery': false]
],
'---' : [
description : '--------------------------------------',
models : [],
fingerprints : [],
],
// ------------------------------------------- mmWave Radars ------------------------------------------------//
'TS0601_TUYA_RADAR' : [ // isZY_M100Radar() // spammy devices!
description : 'Tuya Human Presence mmWave Radar ZY-M100',
models : ['TS0601'],
device : [type: 'radar', powerSource: 'dc', isSleepy:false],
capabilities : ['MotionSensor': true, 'IlluminanceMeasurement': true, 'DistanceMeasurement':true],
preferences : ['radarSensitivity':'2', 'detectionDelay':'101', 'fadingTime':'102', 'minimumDistance':'3', 'maximumDistance':'4'],
commands : ['resetStats':'resetStats'],
fingerprints : [
[profileId:'0104', endpointId:'01', inClusters:'0000,0004,0005,EF00', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_ztc6ggyl', deviceJoinName: 'Tuya ZigBee Breath Presence Sensor ZY-M100'], // KK
[profileId:'0104', endpointId:'01', inClusters:'0000,0004,0005,EF00', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_ztc6ggyl', deviceJoinName: 'Tuya ZigBee Breath Presence Sensor ZY-M100'], // KK
[profileId:'0104', endpointId:'01', inClusters:'0000,0004,0005,EF00', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_ikvncluo', deviceJoinName: 'Moes TuyaHuman Presence Detector Radar 2 in 1'], // jw970065
[profileId:'0104', endpointId:'01', inClusters:'0000,0004,0005,EF00', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_lyetpprm', deviceJoinName: 'Tuya ZigBee Breath Presence Sensor'],
[profileId:'0104', endpointId:'01', inClusters:'0000,0004,0005,EF00', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_wukb7rhc', deviceJoinName: 'Moes Smart Human Presence Detector'], // https://www.moeshouse.com/collections/smart-sensor-security/products/smart-zigbee-human-presence-detector-pir-mmwave-radar-detection-sensor-ceiling-mount
[profileId:'0104', endpointId:'01', inClusters:'0000,0004,0005,EF00', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_jva8ink8', deviceJoinName: 'AUBESS Human Presence Detector'], // https://www.aliexpress.com/item/1005004262109070.html
[profileId:'0104', endpointId:'01', inClusters:'0000,0004,0005,EF00', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_mrf6vtua', deviceJoinName: 'Tuya Human Presence Detector'], // not tested
[profileId:'0104', endpointId:'01', inClusters:'0000,0004,0005,EF00', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_ar0slwnd', deviceJoinName: 'Tuya Human Presence Detector'], // not tested
[profileId:'0104', endpointId:'01', inClusters:'0000,0004,0005,EF00', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_sfiy5tfs', deviceJoinName: 'Tuya Human Presence Detector'], // not tested
[profileId:'0104', endpointId:'01', inClusters:'0000,0004,0005,EF00', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_holel4dk', deviceJoinName: 'Tuya Human Presence Detector'], // https://community.hubitat.com/t/release-tuya-zigbee-multi-sensor-4-in-1-pir-motion-sensors-and-mmwave-presence-radars/92441/280?u=kkossev
[profileId:'0104', endpointId:'01', inClusters:'0000,0004,0005,EF00', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_xpq2rzhq', deviceJoinName: 'Tuya Human Presence Detector'], // https://community.hubitat.com/t/release-tuya-zigbee-multi-sensor-4-in-1-pir-motion-sensors-and-mmwave-presence-radars-w-healthstatus/92441/432?u=kkossev
[profileId:'0104', endpointId:'01', inClusters:'0000,0004,0005,EF00', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_qasjif9e', deviceJoinName: 'Tuya Human Presence Detector'], //
[profileId:'0104', endpointId:'01', inClusters:'0000,0004,0005,EF00', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_xsm7l9xa', deviceJoinName: 'Tuya Human Presence Detector'] //
],
tuyaDPs: [
[dp:1, name:'motion', type:'enum', rw: 'ro', min:0, max:1 , defVal:'0', scale:1, map:[0:'inactive', 1:'active'] , unit:'', title:'Presence state', description:'Presence state'],
[dp:2, name:'radarSensitivity', type:'number', rw: 'rw', min:0, max:9 , defVal:7, scale:1, unit:'', title:'Radar sensitivity', description:'Sensitivity of the radar'],
[dp:3, name:'minimumDistance', type:'decimal', rw: 'rw', min:0.0, max:10.0, defVal:0.1, scale:100, unit:'meters', title:'Minimim detection distance', description:'Minimim (near) detection distance'],
[dp:4, name:'maximumDistance', type:'decimal', rw: 'rw', min:0.0, max:10.0, defVal:6.0, scale:100, unit:'meters', title:'Maximum detection distance', description:'Maximum (far) detection distance'],
[dp:6, name:'radarStatus', type:'enum', rw: 'ro', min:0, max:5 , defVal:'1', scale:1, map:[ 0:'checking', 1:'check_success', 2:'check_failure', 3:'others', 4:'comm_fault', 5:'radar_fault'] , unit:'TODO', title:'Radar self checking status', description:'Radar self checking status'], // radarSeradarSelfCheckingStatus[fncmd.toString()]
[dp:9, name:'distance', type:'decimal', rw: 'ro', min:0.0, max:10.0 , defVal:0.0, scale:100, unit:'meters', title:'Distance', description:'detected distance'],
[dp:101, name:'detectionDelay', type:'decimal', rw: 'rw', min:0.0, max:10.0, defVal:0.2, scale:10, unit:'seconds', title:'Detection delay', description:'Presence detection delay timer'],
[dp:102, name:'fadingTime', type:'decimal', rw: 'rw', min:0.5, max:500.0, defVal:60.0, scale:10, unit:'seconds', title:'Fading time', description:'Presence inactivity delay timer'], // aka 'nobody time'
[dp:103, name:'debugCLI', type:'number', rw: 'ro', min:0, max:99999, defVal:0, scale:1, unit:'?', title:'debugCLI', description:'debug CLI'],
[dp:104, name:'illuminance', type:'number', rw: 'ro', min:0, max:2000, defVal:0, scale:1, unit:'lx', title:'illuminance', description:'illuminance'],
],
spammyDPsToIgnore : [9],
spammyDPsToNotTrace : [9, 103],
deviceJoinName: 'Tuya Human Presence Detector ZY-M100',
configuration : [:]
// status: completed
],
'TS0601_KAPVNNLK_RADAR' : [ // 24GHz spammy radar w/ battery backup - no illuminance!
description : 'Tuya TS0601_KAPVNNLK 24GHz Radar', // https://www.amazon.com/dp/B0CDRBX1CQ?psc=1&ref=ppx_yo2ov_dt_b_product_details // https://www.aliexpress.com/item/1005005834366702.html // https://github.com/Koenkk/zigbee2mqtt/issues/18632
models : ['TS0601'], // https://www.aliexpress.com/item/1005005858609756.html // https://www.aliexpress.com/item/1005005946786561.html // https://www.aliexpress.com/item/1005005946931559.html
device : [type: 'radar', powerSource: 'dc', isSleepy:false],
capabilities : ['MotionSensor': true, 'DistanceMeasurement':true, 'HumanMotionState':true],
preferences : ['radarSensitivity':'15', 'fadingTime':'12', 'maximumDistance':'13', 'smallMotionDetectionSensitivity':'16'],
commands : ['resetStats':'resetStats', 'initialize':'initialize', 'updateAllPreferences': 'updateAllPreferences'],
fingerprints : [
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_kapvnnlk', deviceJoinName: 'Tuya 24 GHz Human Presence Detector NEW'], // https://community.hubitat.com/t/tuya-smart-human-presence-sensor-micromotion-detect-human-motion-detector-zigbee-ts0601-tze204-sxm7l9xa/111612/71?u=kkossev
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_kyhbrfyl', deviceJoinName: 'Tuya 24 GHz Human Presence Detector NEW'], // https://community.hubitat.com/t/release-tuya-zigbee-multi-sensor-4-in-1-pir-motion-sensors-and-mmwave-presence-radars-w-healthstatus/92441/1042?u=kkossev
],
tuyaDPs: [
[dp:1, name:'motion', type:'enum', rw: 'ro', min:0, max:1 , defVal:'0', scale:1, map:[0:'inactive', 1:'active'] , unit:'', title:'Presence state', description:'Presence state'],
[dp:11, name:'humanMotionState', type:'enum', rw: 'ro', min:0, max:2, defVal:'0', map:[0:'none', 1:'small_move', 2:'large_move'], description:'Human motion state'], // "none", "small_move", "large_move"]
[dp:12, name:'fadingTime', type:'number', rw: 'rw', min:3, max:600, defVal:60, scale:1, unit:'seconds', title:'Fading time', description:'Presence inactivity delay timer'], // aka 'nobody time'
[dp:13, name:'maximumDistance', type:'decimal', rw: 'rw', min:1.5, max:6.0, defVal:4.0, step:75, scale:100, unit:'meters', title:'Maximum detection distance', description:'Maximum (far) detection distance'], // aka 'Large motion detection distance'
[dp:15, name:'radarSensitivity', type:'number', rw: 'rw', min:0, max:7 , defVal:5, scale:1, unit:'', title:'Radar sensitivity', description:'Large motion detection sensitivity of the radar'],
[dp:16 , name:'smallMotionDetectionSensitivity', type:'number', rw: 'rw', min:0, max:7, defVal:5, scale:1, unit:'', title:'Small motion sensitivity', description:'Small motion detection sensitivity'],
[dp:19, name:'distance', type:'decimal', rw: 'ro', min:0.0, max:10.0, defVal:0.0, scale:100, unit:'meters', title:'Distance', description:'detected distance'],
[dp:101, name:'batteryLevel', type:'number', rw: 'ro', min:0, max:100, defVal:100, scale:1, unit:'%', title:'Battery level', description:'Battery level']
],
spammyDPsToIgnore : [19],
spammyDPsToNotTrace : [19],
deviceJoinName: 'Tuya 24 GHz Human Presence Detector NEW',
configuration : [:]
],
// https://github.com/Koenkk/zigbee-herdsman-converters/blob/f277bef2f84d50aea70c25261db0c2ded84b7396/src/devices/tuya.ts#L4164
'TS0601_RADAR_MIR-HE200-TY' : [ // Human presence sensor radar 'MIR-HE200-TY' - illuminance, presence, occupancy, motion_speed, motion_direction, radar_sensitivity, radar_scene ('default', 'area', 'toilet', 'bedroom', 'parlour', 'office', 'hotel')
description : 'Tuya Human Presence Sensor MIR-HE200-TY',
models : ['TS0601'],
device : [type: 'radar', powerSource: 'dc', isSleepy:false],
capabilities : ['MotionSensor': true, 'IlluminanceMeasurement': true],
preferences : ['radarSensitivity':'2', 'tumbleSwitch':'105', 'tumbleAlarmTime':'106', /*"radarScene":"112",*/ 'fallSensitivity':'118'],
commands : ['resetStats':'resetStats'],
fingerprints : [
[profileId:'0104', endpointId:'01', inClusters:'0000,0004,0005,EF00', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_vrfecyku', deviceJoinName: 'Tuya Human presence sensor MIR-HE200-TY'],
[profileId:'0104', endpointId:'01', inClusters:'0000,0004,0005,EF00', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_lu01t0zl', deviceJoinName: 'Tuya Human presence sensor with fall function'],
[profileId:'0104', endpointId:'01', inClusters:'0000,0004,0005,EF00', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_ypprdwsl', deviceJoinName: 'Tuya Human presence sensor with fall function']
],
tuyaDPs: [
[dp:1, name:'motion', type:'enum', rw: 'ro', min:0, max:1, defVal:'0', scale:1, map:[0:'inactive', 1:'active'] , unit:'', title:'Presence state', description:'Presence state'],
[dp:2, name:'radarSensitivity', type:'number', rw: 'rw', min:0, max:10, defVal:7, scale:1, unit:'', title:'Radar sensitivity', description:'Sensitivity of the radar'],
[dp:102, name:'motionState', type:'enum', rw: 'ro', min:0, max:1, defVal:'0', scale:1, map:[0:'inactive', 1:'active'] , unit:'', title:'Motion state', description:'Motion state (occupancy)'],
[dp:103, name:'illuminance', type:'number', rw: 'ro', min:0, max:2000, defVal:0, scale:1, unit:'lx', title:'illuminance', description:'illuminance'],
[dp:105, name:'tumbleSwitch', type:'enum', rw: 'rw', min:0, max:1, defVal:'0', scale:1, map:[0:'OFF', 1:'ON'] , unit:'', title:'Tumble status switch', description:'Tumble status switch'],
[dp:106, name:'tumbleAlarmTime', type:'number', rw: 'rw', min:1, max:5, defVal:1, scale:1, unit:'minutes', title:'Tumble alarm time', description:'Tumble alarm time'],
[dp:112, name:'radarScene', type:'enum', rw: 'rw', min:0, max:6, defVal:'0', scale:1, map:[ 0:'default', 1:'area', 2:'toilet', 3:'bedroom', 4:'parlour', 5:'office', 6:'hotel'] , unit:'-', title:'Radar Presets', description:'Presets for sensitivity for presence and movement'],
[dp:114, name:'motionDirection', type:'enum', rw: 'ro', min:0, max:2, defVal:'0', scale:1, map:[ 0:'standing_still', 1:'moving_forward', 2:'moving_backward'] , unit:'-', title:'Movement direction', description:'direction of movement from the point of view of the radar'],
[dp:115, name:'motionSpeed', type:'number', rw: 'ro', min:0, max:9999, defVal:0, scale:1, unit:'-', title:'Movement speed', description:'Speed of movement'],
[dp:116, name:'fallDownStatus', type:'enum', rw: 'ro', min:0, max:2, defVal:'0', scale:1, map:[ 0:'none', 1:'maybe_fall', 2:'fall'] , unit:'-', title:'Fall down status', description:'Fall down status'],
//[dp:117, name:'staticDwellAalarm', type:"text", rw: "ro", min:0, max:9999, defVal:0, scale:1, unit:"-", title:"Static dwell alarm", description:'Static dwell alarm'],
[dp:118, name:'fallSensitivity', type:'number', rw: 'rw', min:1, max:10, defVal:7, scale:1, unit:'', title:'Fall sensitivity', description:'Fall sensitivity of the radar'],
],
deviceJoinName: 'Tuya Human Presence Sensor MIR-HE200-TY',
configuration : [:]
],
'TS0601_BLACK_SQUARE_RADAR' : [ // // 24GHz Big Black Square Radar w/ annoying LED // isBlackSquareRadar()
description : 'Tuya Black Square Radar',
models : ['TS0601'],
device : [type: 'radar', powerSource: 'dc', isSleepy:false],
capabilities : ['MotionSensor':true],
preferences : ['indicatorLight':103],
commands : ['resetStats':'resetStats'],
fingerprints : [
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_0u3bj3rc', deviceJoinName: '24GHz Black Square Human Presence Radar w/ LED'],
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_v6ossqfy', deviceJoinName: '24GHz Black Square Human Presence Radar w/ LED'],
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_mx6u6l4y', deviceJoinName: '24GHz Black Square Human Presence Radar w/ LED']
],
tuyaDPs: [
[dp:1, name:'motion', type:'enum', rw: 'ro', min:0, max:1, defVal: '0', map:[0:'inactive', 1:'active'], description:'Presence'],
[dp:101, name:'existance_time', type:'number', rw: 'ro', min:0, max:9999, scale:1, unit:'minutes', description:'Shows the presence duration in minutes'],
[dp:102, name:'leave_time', type:'number', rw: 'ro', min:0, max:9999, scale:1, unit:'minutes', description:'Shows the duration of the absence in minutes'],
[dp:103, name:'indicatorLight', type:'enum', rw: 'rw', min:0, max:1, defVal: '0', map:[0:'OFF', 1:'ON'], title:'Indicator Light', description:'Turns the onboard LED on or off']
],
spammyDPsToIgnore : [103], // we don't need to know the LED status every 4 seconds!
spammyDPsToNotTrace : [1, 101, 102, 103], // very spammy device - 4 packates are sent every 4 seconds!
deviceJoinName: '24GHz Black Square Human Presence Radar w/ LED',
],
'TS0601_YXZBRB58_RADAR' : [ // Seller: shenzhenshixiangchuangyeshiyey Manufacturer: Shenzhen Eysltime Intelligent LTD Item model number: YXZBRB58 isYXZBRB58radar()
description : 'Tuya YXZBRB58 Radar',
models : ['TS0601'],
device : [type: 'radar', powerSource: 'dc', isSleepy:false],
capabilities : ['MotionSensor': true, 'IlluminanceMeasurement': true, 'DistanceMeasurement':true], // https://github.com/Koenkk/zigbee2mqtt/issues/18318
preferences : ['radarSensitivity':'2', 'detectionDelay':'103', 'fadingTime':'102', 'minimumDistance':'3', 'maximumDistance':'4'],
commands : ['resetStats':'resetStats'],
fingerprints : [
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_sooucan5', deviceJoinName: 'Tuya Human Presence Detector YXZBRB58'] // https://www.amazon.com/dp/B0BYDCY4YN
],
tuyaDPs: [ // TODO - use already defined DPs and preferences !!
[dp:1, name:'motion', type:'enum', rw: 'ro', min:0, max:2, defVal:'0', map:[0:'inactive', 1:'active'], description:'Presence state'],
[dp:2, name:'radarSensitivity', type:'number', rw: 'rw', min:0, max:9 , defVal:7, scale:1, unit:'', title:'Radar Sensitivity', description:'Sensitivity of the radar'],
[dp:3, name:'minimumDistance', type:'decimal', rw: 'rw', min:0.0, max:10.0, defVal:0.5, scale:100, unit:'meters', title:'Minimum distance', description:'Minimum detection distance'],
[dp:4, name:'maximumDistance', type:'decimal', rw: 'rw', min:0.0, max:10.0, defVal:6.0, scale:100, unit:'meters', title:'Maximum distance', description:'Maximum detection distance'],
[dp:101, name:'illuminance', type:'number', rw: 'ro', scale:1, unit:'lx', description:'Illuminance'],
[dp:102, name:'fadingTime', type:'number', rw: 'rw', min:5, max:1500, defVal:60, scale:1, unit:'seconds', title:'Fading time', description:'Presence inactivity timer, seconds'],
[dp:103, name:'detectionDelay', type:'decimal', rw: 'rw', min:0.0, max:10.0, defVal:1.0, scale:10, unit:'seconds', title:'Detection delay', description:'Detection delay'],
[dp:104, name:'radar_scene', type:'enum', rw: 'rw', min:0, max:4, defVal:'0', map:[0:'default', 1:'bathroom', 2:'bedroom', 3:'sleeping'], description:'Presets for sensitivity for presence and movement'], // https://github.com/kirovilya/zigbee-herdsman-converters/blob/b9bb6695fdf5d26ab4195cca9fcb1f2bd73afa71/src/devices/tuya.ts
[dp:105, name:'distance', type:'decimal', rw: 'ro', min:0.0, max:10.0, scale:100, unit:'meters', description:'Distance']
], // https://github.com/zigpy/zha-device-handlers/issues/2429
spammyDPsToIgnore : [105],
spammyDPsToNotTrace : [105],
deviceJoinName: 'Tuya Human Presence Detector YXZBRB58', // https://www.aliexpress.com/item/1005005764168560.html
configuration : [:]
],
// isSXM7L9XAradar() // https://github.com/dresden-elektronik/deconz-rest-plugin/issues/6998#issuecomment-1612113340
'TS0601_SXM7L9XA_RADAR' : [ // https://gist.github.com/Koenkk/9295fc8afcc65f36027f9ab4d319ce64
description : 'Tuya Human Presence Detector SXM7L9XA', // https://github.com/zigpy/zha-device-handlers/issues/2378#issuecomment-1558777494
models : ['TS0601'], // https://github.com/wzwenzhi/Wenzhi-ZigBee2mqtt/tree/main
device : [type: 'radar', powerSource: 'dc', isSleepy:false], // https://github.com/wzwenzhi/Wenzhi-ZigBee2mqtt/blob/main/wenzhi_tuya_M100-230908.js
capabilities : ['MotionSensor': true, 'IlluminanceMeasurement': true, 'DistanceMeasurement':true],
preferences : ['radarSensitivity':'106', 'detectionDelay':'111', 'fadingTime':'110', 'minimumDistance':'108', 'maximumDistance':'107'],
commands : ['resetStats':'resetStats'],
fingerprints : [
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_sxm7l9xa', deviceJoinName: 'Tuya Human Presence Detector SXM7L9XA'], // https://www.aliexpress.com/item/1005004788260949.html // https://community.hubitat.com/t/release-tuya-zigbee-multi-sensor-4-in-1-pir-motion-sensors-and-mmwave-presence-radars-w-healthstatus/92441/539?u=kkossev
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_e5m9c5hl', deviceJoinName: 'Tuya Human Presence Detector WZ-M100'] // https://www.aliexpress.com/item/1005004788260949.html // https://community.hubitat.com/t/release-tuya-zigbee-multi-sensor-4-in-1-pir-motion-sensors-and-mmwave-presence-radars-w-healthstatus/92441/745?u=kkossev
],
tuyaDPs: [
[dp:104, name:'illuminance', type:'number', rw: 'ro', scale:1, unit:'lx', description:'illuminance'],
[dp:105, name:'motion', type:'enum', rw: 'ro', min:0, max:1, defVal:'0', map:[0:'inactive', 1:'active'], description:'Presence state'],
[dp:106, name:'radarSensitivity', type:'number', rw: 'rw', min:1, max:10 , defVal:7, scale:1, unit:'', title:'Motion sensitivity', description:'Motion sensitivity'],
[dp:107, name:'maximumDistance', type:'decimal', rw: 'rw', min:0.0, max:9.5, defVal:6.0, scale:100, unit:'meters', title:'Maximum distance', description:'Max detection distance'],
[dp:108, name:'minimumDistance', type:'decimal', rw: 'rw', min:0.0, max:9.5, defVal:0.5, scale:100, unit:'meters', title:'Minimum distance', description:'Min detection distance'], // TODO - check DP!
[dp:109, name:'distance', type:'decimal', rw: 'ro', min:0.0, max:10.0, scale:100, unit:'meters', description:'Distance'],
[dp:110, name:'fadingTime', type:'decimal', rw: 'rw', min:0.5, max:150.0, defVal:60.0, step:5, scale:10, unit:'seconds', title: 'Fading time', description:'Presence inactivity timer'],
[dp:111, name:'detectionDelay', type:'decimal', rw: 'rw', min:0.0, max:10.0, defVal:0.5, scale:10, unit:'seconds', title: 'Detection delay', description:'Detection delay']
],
spammyDPsToIgnore : [109],
spammyDPsToNotTrace : [109],
deviceJoinName: 'Tuya Human Presence Detector SXM7L9XA',
configuration : [:],
],
// isIJXVKHD0radar() '24G MmWave radar human presence motion sensor'
'TS0601_IJXVKHD0_RADAR' : [
description : 'Tuya Human Presence Detector IJXVKHD0', // https://github.com/Koenkk/zigbee-herdsman-converters/blob/5acadaf16b0e85c1a8401223ddcae3d31ce970eb/src/devices/tuya.ts#L5747
models : ['TS0601'],
device : [type: 'radar', powerSource: 'dc', isSleepy:false],
capabilities : ['MotionSensor': true, 'IlluminanceMeasurement': true, 'DistanceMeasurement':true],
preferences : ['radarSensitivity':'106', 'staticDetectionSensitivity':'111', 'fadingTime':'110', 'maximumDistance':'107'],
commands : ['resetStats':'resetStats'],
fingerprints : [
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_ijxvkhd0', deviceJoinName: 'Tuya Human Presence Detector ZY-M100-24G'] //
],
tuyaDPs: [ // https://github.com/Koenkk/zigbee2mqtt/issues/18237
[dp:1, name:'unknownDp1', type:'enum', rw: 'ro', min:0, max:1, defVal:'0', map:[0:'inactive', 1:'active'], description:'unknown state dp1'],
[dp:2, name:'unknownDp2', type:'enum', rw: 'ro', min:0, max:1, defVal:'0', map:[0:'inactive', 1:'active'], description:'unknown state dp2'],
[dp:104, name:'illuminance', type:'number', rw: 'ro', scale:1, unit:'lx', description:'illuminance'],
[dp:105, name:'humanMotionState', type:'enum', rw: 'ro', min:0, max:2, defVal:'0', map:[0:'none', 1:'present', 2:'moving'], description:'Presence state'],
[dp:106, name:'radarSensitivity', preProc:'divideBy10', type:'number', rw: 'rw', min:1, max:9, defVal:2 , scale:1, unit:'', title:'Motion sensitivity', description:'Radar motion sensitivity
1 is highest, 9 is lowest!'],
[dp:107, name:'maximumDistance', type:'decimal', rw: 'rw', min:1.5, max:5.5, defVal:5.5, scale:100, unit:'meters', title:'Maximum distance', description:'Max detection distance'],
[dp:109, name:'distance', type:'decimal', rw: 'ro', min:0.0, max:10.0, defVal:0.0, scale:100, unit:'meters', description:'Target distance'],
[dp:110, name:'fadingTime', type:'number', rw: 'rw', min:1, max:1500, defVal:5, scale:1, unit:'seconds', title:'', description:'Delay (fading) time'],
[dp:111, name:'staticDetectionSensitivity', preProc:'divideBy10', type:'number', rw: 'rw', min:1, max:9, defVal:3, scale:1, unit:'', title:'Static detection sensitivity', description:'Presence sensitivity
1 is highest, 9 is lowest!'],
[dp:112, name:'motion', type:'enum', rw: 'ro', min:0, max:1, defVal:'0', scale:1, map:[0:'inactive', 1:'active'] , unit:'', title:'Presence state', description:'Presence state'],
[dp:123, name:'presence', type:'enum', rw: 'ro', min:0, max:1, defVal:'0', map:[0:'none', 1:'presence'], description:'Presence'] // TODO -- check if used?
],
spammyDPsToIgnore : [109, 9], // dp 9 test
spammyDPsToNotTrace : [109, 104], // illuminance reporting is extremly spammy !
deviceJoinName: 'Tuya Human Presence Detector ZY-M100-24G',
configuration : [:]
],
/*
SmartLife radarSensitivity staticDetectionSensitivity
L1 7 9
L2 6 7
L3 4 6
L4 2 4
L5 2 3
*/
'TS0601_YENSYA2C_RADAR' : [ // Loginovo Zigbee Mmwave Human Presence Sensor (rectangular) // TODO: update thread first post
description : 'Tuya Human Presence Detector YENSYA2C', // https://github.com/Koenkk/zigbee2mqtt/issues/18646
models : ['TS0601'], // https://www.aliexpress.com/item/1005005677110270.html
device : [type: 'radar', powerSource: 'dc', isSleepy:false],
capabilities : ['MotionSensor': true, 'IlluminanceMeasurement': true, 'DistanceMeasurement':true],
preferences : ['radarSensitivity':'101', 'presence_time':'12', 'detectionDelay':'102', 'fadingTime':'116', 'minimumDistance': '111', 'maximumDistance':'112'],
commands : ['resetStats':'resetStats'],
fingerprints : [
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_yensya2c', deviceJoinName: 'Tuya Human Presence Detector YENSYA2C'], //
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_mhxn2jso', deviceJoinName: 'Tuya Human Presence Detector New'] // https://github.com/Koenkk/zigbee2mqtt/issues/18623
// ^^^similar DPs, but not a full match? ^^^ TODO - make a new profile ? // https://raw.githubusercontent.com/kvazis/training/master/z2m_converters/converters/_TZE204_mhxn2jso.js
],
tuyaDPs: [
[dp:1, name:'motion', type:'enum', rw: 'ro', min:0, max:1, defVal:'0', scale:1, map:[0:'inactive', 1:'active'] , unit:'', title:'Presence state', description:'Presence state'],
[dp:12, name:'presence_time', type:'decimal', rw: 'rw', min:0.1, max:360.0, defVal:0.5, scale:10, unit:'seconds', title:'Presence time', description:'Presence time'], // for _TZE204_mhxn2jso
[dp:19, name:'distance', type:'decimal', rw: 'ro', min:0.0, max:10.0, defVal:0.0, scale:100, unit:'meters', description:'Distance'],
[dp:20, name:'illuminance', type:'number', rw: 'ro', min:0, max:10000, scale:1, unit:'lx', description:'illuminance'],
[dp:101, name:'radarSensitivity', type:'number', rw: 'rw', min:0, max:10, defVal:7, scale:1, unit:'', title:'Radar sensitivity', description:'Radar sensitivity'],
[dp:102, name:'detectionDelay', type:'decimal', rw: 'rw', min:0.5, max:360.0, defVal:1.0, scale:10, unit:'seconds', title:'Delay time', description:'Presence detection delay time'],
[dp:111, name:'minimumDistance', type:'decimal', rw: 'rw', min:0.0, max:10.0, defVal:0.1, scale:100, unit:'meters', title:'Minimum distance', description:'Breath detection minimum distance'],
[dp:112, name:'maximumDistance', type:'decimal', rw: 'rw', min:0.5, max:10.0, defVal:7.0, scale:100, unit:'meters', title:'Maximum distance', description:'Breath detection maximum distance'],
[dp:113, name:'breathe_flag', type:'enum', rw: 'rw'],
[dp:114, name:'small_flag', type:'enum', rw: 'rw'],
[dp:115, name:'large_flag', type:'enum', rw: 'rw'],
[dp:116, name:'fadingTime', type:'number', rw: 'rw', min:0, max:3600, defVal:30, scale:1, unit:'seconds', title:'Fading time', description:'Presence (fading) delay time']
],
spammyDPsToIgnore : [19],
spammyDPsToNotTrace : [19],
deviceJoinName: 'Tuya Human Presence Detector YENSYA2C',
configuration : [:]
],
// the new 5.8 GHz radar w/ humanMotionState and a lot of configuration options, 'not-so-spammy' ! - pedestal mount form-factor
'TS0225_HL0SS9OA_RADAR' : [
description : 'Tuya TS0225_HL0SS9OA Radar', // https://www.aliexpress.com/item/1005005761971083.html
models : ['TS0225'],
device : [type: 'radar', powerSource: 'dc', isSleepy:false],
capabilities : ['MotionSensor': true, 'IlluminanceMeasurement': true, 'HumanMotionState':true],
preferences : ['presenceKeepTime':'12', 'ledIndicator':'24', 'radarAlarmMode':'105', 'radarAlarmVolume':'102', 'radarAlarmTime':'101', \
/*"textLargeMotion":"NONE",*/ 'motionFalseDetection':'112', 'motionDetectionSensitivity':'15', 'motionMinimumDistance':'106', 'motionDetectionDistance':'13', \
/*"textSmallMotion":"NONE",*/ 'smallMotionDetectionSensitivity':'16', 'smallMotionMinimumDistance':'107', 'smallMotionDetectionDistance':'14', \
/*"textStaticDetection":"NONE",*/ 'breatheFalseDetection':'115', 'staticDetectionSensitivity':'104', 'staticDetectionMinimumDistance':'108', 'staticDetectionDistance':'103' \
],
commands : ['resetSettings':'resetSettings', 'moveSelfTest':'moveSelfTest', 'smallMoveSelfTest':'smallMoveSelfTest', 'breatheSelfTest':'breatheSelfTest', \
'resetStats':'resetStats', 'initialize':'initialize', 'updateAllPreferences': 'updateAllPreferences'
],
fingerprints : [
[profileId:'0104', endpointId:'01', inClusters:'0000,0003,0500,E002,EF00', outClusters:'0019,000A', model:'TS0225', manufacturer:'_TZE200_hl0ss9oa', deviceJoinName: 'Tuya TS0225_HL0SS9OA Human Presence Detector'] // https://www.aliexpress.com/item/1005004788260949.html // https://community.hubitat.com/t/release-tuya-zigbee-multi-sensor-4-in-1-pir-motion-sensors-and-mmwave-presence-radars-w-healthstatus/92441/539?u=kkossev
],
tuyaDPs: [ // W.I.P - use already defined DPs and preferences !! TODO - verify teh default values !
[dp:1, name:'motion', type:'enum', rw: 'ro', min:0, max:1, defVal:'0', scale:1, map:[0:'inactive', 1:'active'] , unit:'', title:'Presence state', description:'Presence state'],
[dp:11, name:'humanMotionState', type:'enum', rw: 'ro', min:0, max:3, defVal:'0', map:[0:'none', 1:'large', 2:'small', 3:'static'], description:'Human motion state'],
[dp:12, name:'presenceKeepTime', type:'number', rw: 'rw', min:5, max:3600, defVal:30, scale:1, unit:'seconds', title:'Presence keep time', description:'Presence keep time'],
[dp:13, name:'motionDetectionDistance', type:'decimal', rw: 'rw', min:0.0, max:10.0, defVal:6.0, scale:100, unit:'meters', title:'Motion Detection Distance', description:'Large motion detection distance, meters'], //dt: "UINT16"
[dp:14, name:'smallMotionDetectionDistance', type:'decimal', rw: 'rw', min:0.0, max:6.0, defVal:5.0, scale:100, unit:'meters', title:'Small motion detection distance', description:'Small motion detection distance'],
[dp:15, name:'motionDetectionSensitivity', type:'number', rw: 'rw', min:0, max:10, defVal:7, scale:1, unit:'', title:'Motion Detection Sensitivity', description:'Large motion detection sensitivity'], // dt: "UINT8" aka Motionless Detection Sensitivity
[dp:16, name:'smallMotionDetectionSensitivity', type:'number', rw: 'rw', min:0, max:10 , defVal:7, scale:1, unit:'', title:'Small motion detection sensitivity', description:'Small motion detection sensitivity'],
[dp:20, name:'illuminance', type:'number', rw: 'ro', scale:10, unit:'lx', description:'Illuminance'],
[dp:24, name:'ledIndicator', type:'enum', rw: 'rw', min:0, max:1, defVal:'0', map:[0:'0 - OFF', 1:'1 - ON'], title:'LED indicator mode', description:'LED indicator mode'],
[dp:101, name:'radarAlarmTime', type:'number', rw: 'rw', min:0, max:60 , defVal:1, scale:1, unit:'seconds', title:'Alarm time', description:'Alarm time'],
[dp:102, name:'radarAlarmVolume', type:'enum', rw: 'rw', min:0, max:3, defVal:'3', map:[0:'0 - low', 1:'1 - medium', 2:'2 - high', 3:'3 - mute'], title:'Alarm volume', description:'Alarm volume'],
[dp:103, name:'staticDetectionDistance', type:'decimal', rw: 'rw', min:0.0, max:6.0, defVal:4.0, scale:100, unit:'meters', title:'Static detection distance', description:'Static detection distance'],
[dp:104, name:'staticDetectionSensitivity', type:'number', rw: 'rw', min:0, max:10, defVal:7, scale:1, unit:'', title: 'Static Detection Sensitivity', description:'Static detection sensitivity'], // dt: "UINT8", aka Motionless Detection Sensitivity
[dp:105, name:'radarAlarmMode', type:'enum', rw: 'rw', min:0, max:3, defVal:'1', map:[0:'0 - arm', 1:'1 - off', 2:'2 - alarm', 3:'3 - doorbell'], title:'Alarm mode', description:'Alarm mode'],
[dp:106, name:'motionMinimumDistance', type:'decimal', rw: 'rw', min:0.0, max:6.0, defVal:0.5, scale:100, unit:'meters', title:'Motion minimum distance', description:'Motion minimum distance'],
[dp:107, name:'smallMotionMinimumDistance', type:'decimal', rw: 'rw', min:0.0, max:6.0, defVal:0.5, scale:100, unit:'meters', title:'Small Motion Minimum Distance', description:'Small Motion Minimum Distance'],
[dp:108, name:'staticDetectionMinimumDistance', type:'decimal', rw: 'rw', min:0.0, max:6.0, defVal:0.5, scale:100, unit:'meters', title:'Static detection minimum distance', description:'Static detection minimum distance'],
[dp:109, name:'checkingTime', type:'decimal', rw: 'ro', scale:10, unit:'seconds', description:'Checking time'],
[dp:110, name:'radarStatus', type:'enum', rw: 'ro', min:0, max:1, defVal:'0', map:[0:'0 - disabled', 1:'1 - enabled'], description:'Radar small move self-test'],
[dp:111, name:'radarStatus', type:'enum', rw: 'ro', min:0, max:1, defVal:'0', map:[0:'0 - disabled', 1:'1 - enabled'], description:'Radar breathe self-test'],
[dp:112, name:'motionFalseDetection', type:'enum', rw: 'rw', min:0, max:1, defVal:'0', map:[0:'0 - disabled', 1:'1 - enabled'], title:'Motion false detection', description:'Motion false detection'],
[dp:113, name:'radarReset', type:'enum', rw: 'rw', min:0, max:1, defVal:'0', map:[0:'0 - disabled', 1:'1 - enabled'], description:'Radar reset'],
[dp:114, name:'radarStatus', type:'enum', rw: 'ro', min:0, max:1, defVal:'0', map:[0:'0 - disabled', 1:'1 - enabled'], description:'Radar move self-test'],
[dp:115, name:'breatheFalseDetection', type:'enum', rw: 'rw', min:0, max:1, defVal:'0', map:[0:'0 - disabled', 1:'1 - enabled'], title:'Breathe false detection', description:'Breathe false detection'],
[dp:116, name:'existance_time', type:'number', rw: 'ro', min:0, max:60 , scale:1, unit:'seconds', description:'Radar presence duration'], // not received
[dp:117, name:'leave_time', type:'number', rw: 'ro', min:0, max:60 , scale:1, unit:'seconds', description:'Radar absence duration'], // not received
[dp:118, name:'radarDurationStatus', type:'number', rw: 'ro', min:0, max:60 , scale:1, unit:'seconds', description:'Radar duration status'] // not received
],
spammyDPsToIgnore : [],
spammyDPsToNotTrace : [11],
deviceJoinName: 'Tuya TS0225_HL0SS9OA Human Presence Detector',
configuration : [:]
],
// the new 5.8GHz radar w/ humanMotionState and a lot of configuration options, 'not-so-spammy' ! - wall mount form-factor is2AAELWXKradar()
'TS0225_2AAELWXK_RADAR' : [ // https://github.com/Koenkk/zigbee2mqtt/issues/18612
description : 'Tuya TS0225_2AAELWXK 5.8 GHz Radar', // https://community.hubitat.com/t/the-new-tuya-24ghz-human-presence-sensor-ts0225-tze200-hl0ss9oa-finally-a-good-one/122283/72?u=kkossev
models : ['TS0225'], // ZG-205Z https://github.com/Koenkk/zigbee-herdsman-converters/blob/38bf79304292c380dc8366966aaefb71ca0b03da/src/devices/tuya.ts#L4793
device : [type: 'radar', powerSource: 'dc', isSleepy:false],
capabilities : ['MotionSensor': true, 'IlluminanceMeasurement': true, 'HumanMotionState':true],
// TODO - preferences and DPs !!!!!!!!!!!!!!!!!!!!
preferences : ['presenceKeepTime':'102', 'ledIndicator':'107', 'radarAlarmMode':'117', 'radarAlarmVolume':'116', 'radarAlarmTime':'115', \
/*"textLargeMotion":"NONE",*/ 'motionFalseDetection':'103', 'motionDetectionSensitivity':'2', 'motionMinimumDistance':'3', 'motionDetectionDistance':'4', \
/*"textSmallMotion":"NONE",*/ 'smallMotionDetectionSensitivity':'105', 'smallMotionMinimumDistance':'110', 'smallMotionDetectionDistance':'104', \
/*"textStaticDetection":"NONE",*/ 'breatheFalseDetection':'113', 'staticDetectionSensitivity':'109', /*"staticDetectionMinimumDistance":'108',*/ 'staticDetectionDistance':'108' \
],
commands : ['resetSettings':'resetSettings', 'moveSelfTest':'moveSelfTest', 'smallMoveSelfTest':'smallMoveSelfTest', 'breatheSelfTest':'breatheSelfTest', \
'resetStats':'resetStats', 'initialize':'initialize', 'updateAllPreferences': 'updateAllPreferences', 'resetPreferencesToDefaults':'resetPreferencesToDefaults', 'validateAndFixPreferences':'validateAndFixPreferences' \
],
fingerprints : [ // reports illuminance and motion using clusters 0x400 and 0x500 !
[profileId:'0104', endpointId:'01', inClusters:'0000,0003,0500,E002,EF00,EE00,E000,0400', outClusters:'0019,000A', model:'TS0225', manufacturer:'_TZE200_2aaelwxk', deviceJoinName: 'Tuya TS0225_2AAELWXK 24Ghz Human Presence Detector'] // https://community.hubitat.com/t/release-tuya-zigbee-multi-sensor-4-in-1-pir-motion-sensors-and-mmwave-presence-radars-w-healthstatus/92441/539?u=kkossev
],
tuyaDPs: [ // W.I.P. - use already defined DPs and preferences !!
[dp:1, name:'motion', type:'enum', rw: 'ro', min:0, max:1, defVal:'0', scale:1, map:[0:'inactive', 1:'active'] , unit:'', title:'Presence state', description:'Presence state'],
[dp:2, name:'motionDetectionSensitivity', type:'number', rw: 'rw', min:0, max:10, defVal:7, scale:1, unit:'', title:'Motion Detection Sensitivity', description:'Large motion detection sensitivity'], // dt: "UINT8" aka Motionless Detection Sensitivity
[dp:3, name:'motionMinimumDistance', type:'decimal', rw: 'rw', min:0.0, max:6.0, defVal:0.5, scale:100, unit:'meters', title:'Motion minimum distance', description:'Motion minimum distance'],
[dp:4, name:'motionDetectionDistance', type:'decimal', rw: 'rw', min:0.0, max:10.0, defVal:6.0, scale:100, unit:'meters', title:'Motion Detection Distance', description:'Large motion detection distance, meters'], //dt: "UINT16"
[dp:101, name:'humanMotionState', type:'enum', rw: 'ro', min:0, max:3, defVal:'0', map:[0:'none', 1:'large', 2:'small', 3:'static'], description:'Human motion state'],
[dp:102, name:'presenceKeepTime', type:'number', rw: 'rw', min:5, max:3600, defVal:30, scale:1, unit:'seconds', title:'Presence keep time', description:'Presence keep time'],
[dp:103, name:'motionFalseDetection', type:'enum', rw: 'rw', min:0, max:1, defVal:'0', map:[0:'0 - disabled', 1:'1 - enabled'], title:'Motion false detection', description:'Disable/enable Motion false detection'],
[dp:104, name:'smallMotionDetectionDistance', type:'decimal', rw: 'rw', min:0.0, max:6.0, defVal:5.0, scale:100, unit:'meters', title:'Small motion detection distance', description:'Small motion detection distance'],
[dp:105, name:'smallMotionDetectionSensitivity', type:'number', rw: 'rw', min:0, max:10 , defVal:7, scale:1, unit:'', title:'Small motion detection sensitivity', description:'Small motion detection sensitivity'],
[dp:106, name:'illuminance', type:'number', rw: 'ro', scale:10, unit:'lx', description:'Illuminance'],
[dp:107, name:'ledIndicator', type:'enum', rw: 'rw', min:0, max:1, defVal:'0', map:[0:'0 - OFF', 1:'1 - ON'], title:'LED indicator', description:'LED indicator mode'],
[dp:108, name:'staticDetectionDistance', type:'decimal', rw: 'rw', min:0.0, max:6.0, defVal:4.0, scale:100, unit:'meters', title:'Static detection distance', description:'Static detection distance'],
[dp:109, name:'staticDetectionSensitivity', type:'number', rw: 'rw', min:0, max:10, defVal:7, scale:1, unit:'', title:'Static Detection Sensitivity', description:'Static detection sensitivity'], // dt: "UINT8", aka Motionless Detection Sensitivity
[dp:110, name:'smallMotionMinimumDistance', type:'decimal', rw: 'rw', min:0.0, max:6.0, defVal:0.5, scale:100, unit:'meters', title:'Small Motion Minimum Distance', description:'Small Motion Minimum Distance'],
//[dp:111, name:'staticDetectionMinimumDistance', type:"decimal", rw: "rw", min:0.0, max:6.0, defVal:0.5, scale:100, unit:"meters", title:'Static detection minimum distance', description:'Static detection minimum distance'],
[dp:112, name:'radarReset', type:'enum', rw: 'rw', min:0, max:1, defVal:'0', map:[0:'0 - disabled', 1:'1 - enabled'], description:'Radar reset'],
[dp:113, name:'breatheFalseDetection', type:'enum', rw: 'rw', min:0, max:1, defVal:'0', map:[0:'0 - disabled', 1:'1 - enabled'], title:'Breathe false detection', description:'Disable/enable Breathe false detection'],
[dp:114, name:'checkingTime', type:'decimal', rw: 'ro', scale:10, unit:'seconds', description:'Checking time'],
[dp:115, name:'radarAlarmTime', type:'number', rw: 'rw', min:0, max:60 , defVal:1, scale:1, unit:'seconds', title:'Alarm time', description:'Alarm time'],
[dp:116, name:'radarAlarmVolume', type:'enum', rw: 'rw', min:0, max:3, defVal:'3', map:[0:'0 - low', 1:'1 - medium', 2:'2 - high', 3:'3 - mute'], title:'Alarm volume', description:'Alarm volume'],
[dp:117, name:'radarAlarmMode', type:'enum', rw: 'rw', min:0, max:3, defVal:'1', map:[0:'0 - arm', 1:'1 - off', 2:'2 - alarm', 3:'3 - doorbell'], title:'Alarm mode', description:'Alarm mode'],
[dp:118, name:'radarStatus', type:'enum', rw: 'rw', min:0, max:1, defVal:'0', map:[0:'0 - disabled', 1:'1 - enabled'], description:'Radar small move self-test'],
[dp:119, name:'radarStatus', type:'enum', rw: 'rw', min:0, max:1, defVal:'0', map:[0:'0 - disabled', 1:'1 - enabled'], description:'Radar breathe self-test'],
[dp:120, name:'radarStatus', type:'enum', rw: 'rw', min:0, max:1, defVal:'0', map:[0:'0 - disabled', 1:'1 - enabled'], description:'Radar move self-test']
/*
[dp:116, name:'existance_time', type:"number", rw: "ro", min:0, max:60 , scale:1, unit:"seconds", description:'Radar presence duration'], // not received
[dp:117, name:'leave_time', type:"number", rw: "ro", min:0, max:60 , scale:1, unit:"seconds", description:'Radar absence duration'], // not received
[dp:118, name:'radarDurationStatus', type:"number", rw: "ro", min:0, max:60 , scale:1, unit:"seconds", description:'Radar duration status'] // not received
*/
],
deviceJoinName: 'Tuya TS0225_2AAELWXK 5.8 Ghz Human Presence Detector',
configuration : [:]
],
// isSBYX0LM6radar() // https://github.com/Koenkk/zigbee-herdsman-converters/issues/5930#issuecomment-1662456347
'TS0601_SBYX0LM6_RADAR' : [ // _TZE204_sbyx0lm6 TS0601 model: 'MTG075-ZB-RL', '5.8G Human presence sensor with relay',
description : 'Tuya Human Presence Detector SBYX0LM6', // https://github.com/vit-um/hass/blob/main/zigbee2mqtt/tuya_h_pr.js
models : ['TS0601'], // https://github.com/Koenkk/zigbee-herdsman-converters/issues/5930 https://github.com/Koenkk/zigbee-herdsman-converters/issues/5930#issuecomment-1651270524
device : [type: 'radar', powerSource: 'dc', isSleepy:false], // https://github.com/wzwenzhi/Wenzhi-ZigBee2mqtt/blob/main/ts0601_radar_X75-X25-230705.js
capabilities : ['MotionSensor': true, 'IlluminanceMeasurement': true, 'DistanceMeasurement':true],
preferences : ['radarSensitivity':'2', 'minimumDistance':'3', 'maximumDistance':'4', 'detectionDelay':'101', 'fadingTime':'102', 'entrySensitivity':'105', 'entryDistanceIndentation':'106', 'breakerMode':'107', \
'breakerStatus':'108', 'statusIndication':'109', 'illuminThreshold':'110', 'breakerPolarity':'111', 'blockTime':'112'
],
commands : ['resetSettings':'resetSettings'],
fingerprints : [
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_sbyx0lm6', deviceJoinName: 'Tuya 5.8GHz Human Presence Detector MTG075-ZB-RL'], // https://www.aliexpress.com/item/1005004788260949.html // https://community.hubitat.com/t/release-tuya-zigbee-multi-sensor-4-in-1-pir-motion-sensors-and-mmwave-presence-radars-w-healthstatus/92441/539?u=kkossev
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_sbyx0lm6', deviceJoinName: 'Tuya 5.8GHz Human Presence Detector MTG075-ZB-RL'],
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_dtzziy1e', deviceJoinName: 'Tuya 24GHz Human Presence Detector MTG275-ZB-RL'], // https://www.aliexpress.com/item/1005004788260949.html // https://community.hubitat.com/t/release-tuya-zigbee-multi-sensor-4-in-1-pir-motion-sensors-and-mmwave-presence-radars-w-healthstatus/92441/539?u=kkossev
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_dtzziy1e', deviceJoinName: 'Tuya 24GHz Human Presence Detector MTG275-ZB-RL'], // https://www.aliexpress.com/item/1005004788260949.html // https://community.hubitat.com/t/release-tuya-zigbee-multi-sensor-4-in-1-pir-motion-sensors-and-mmwave-presence-radars-w-healthstatus/92441/539?u=kkossev
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_clrdrnya', deviceJoinName: 'Tuya Human Presence Detector MTG235-ZB-RL'], // https://www.aliexpress.com/item/1005005865536713.html // https://github.com/Koenkk/zigbee2mqtt/issues/18677?notification_referrer_id=NT_kwDOAF5zfrI3NDQ1Mzc2NTAxOjYxODk5NTA
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_clrdrnya', deviceJoinName: 'Tuya Human Presence Detector MTG235-ZB-RL'],
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_cfcznfbz', deviceJoinName: 'Tuya Human Presence Detector MTG075-ZB2'],
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_iaeejhvf', deviceJoinName: 'Tuya Human Presence Detector MTG075-ZB2-RL'],
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_mtoaryre', deviceJoinName: 'Tuya Human Presence Detector MTG035-ZB2-RL'],
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_8s6jtscb', deviceJoinName: 'Tuya Human Presence Detector MTG035-ZB2'],
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_rktkuel1', deviceJoinName: 'Tuya Human Presence Detector MTD065-ZB2'],
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_mp902om5', deviceJoinName: 'Tuya Human Presence Detector MTG075-ZB'],
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_mp902om5', deviceJoinName: 'Tuya Human Presence Detector MTG075-ZB'],
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_w5y5slkq', deviceJoinName: 'Tuya Human Presence Detector MTG275-ZB'],
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_w5y5slkq', deviceJoinName: 'Tuya Human Presence Detector MTG275-ZB'],
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_xnaqu2pc', deviceJoinName: 'Tuya Human Presence Detector MTD065-ZB'],
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_xnaqu2pc', deviceJoinName: 'Tuya Human Presence Detector MTD065-ZB'],
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_wk7seszg', deviceJoinName: 'Tuya Human Presence Detector MTG235-ZB'],
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_wk7seszg', deviceJoinName: 'Tuya Human Presence Detector MTG235-ZB'],
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_0wfzahlw', deviceJoinName: 'Tuya Human Presence Detector MTD021-ZB'],
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_0wfzahlw', deviceJoinName: 'Tuya Human Presence Detector MTD021-ZB'],
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_pfayrzcw', deviceJoinName: 'Tuya Human Presence Detector MTG035-ZB-RL'],
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_pfayrzcw', deviceJoinName: 'Tuya Human Presence Detector MTG035-ZB-RL'],
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE200_z4tzr0rg', deviceJoinName: 'Tuya Human Presence Detector MTG035-ZB'],
[profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_z4tzr0rg', deviceJoinName: 'Tuya Human Presence Detector MTG035-ZB']
],
tuyaDPs: [
[dp:1, name:'motion', type:'enum', rw: 'ro', min:0, max:1, defVal:'0', scale:1, map:[0:'inactive', 1:'active'] , unit:'', title:'Presence state', description:'Presence state'],
[dp:2, name:'radarSensitivity', type:'number', rw: 'rw', min:1, max:9, defVal:5, scale:1, unit:'', title:'Radar sensitivity', description:'Sensitivity of the radar'],
[dp:3, name:'minimumDistance', type:'decimal', rw: 'rw', min:0.0, max:10.0, defVal:0.1, step:10, scale:100, unit:'meters', title:'Minimum distance', description:'Shield range of the radar'], // was shieldRange
[dp:4, name:'maximumDistance', type:'decimal', rw: 'rw', min:1.5, max:10.0, defVal:7.0, step:10, scale:100, unit:'meters', title:'Maximum distance', description:'Detection range of the radar'], // was detectionRange
[dp:6, name:'radarStatus', type:'enum', rw: 'ro', min:0, max:5 , defVal:'1', scale:1, map:[ 0:'checking', 1:'check_success', 2:'check_failure', 3:'others', 4:'comm_fault', 5:'radar_fault'] , unit:'', title:'Radar self checking status', description:'Radar self checking status'],
[dp:9, name:'distance', type:'decimal', rw: 'ro', min:0.0, max:10.0, defVal:0.0, scale:100, unit:'meters', description:'detected distance'],
[dp:101, name:'detectionDelay', type:'decimal', rw: 'rw', min:0.0, max:1.0, defVal:0.2, scale:10, unit:'seconds', title:'Detection delay', description:'Entry filter time'],
[dp:102, name:'fadingTime', type:'decimal', rw: 'rw', min:0.5, max:150.0, defVal:30.0, scale:10, unit:'seconds', title:'Fading time', description:'Presence inactivity delay timer'], // aka 'nobody time'
[dp:103, name:'debugCLI', type:'number', rw: 'ro', min:0, max:99999, defVal:0, scale:1, unit:'?', title:'debugCLI', description:'debug CLI'],
[dp:104, name:'illuminance', type:'number', rw: 'ro', min:0, max:2000, defVal:0, scale:10, unit:'lx', title:'illuminance', description:'illuminance'], // divideBy10 !
[dp:105, name:'entrySensitivity', type:'number', rw: 'rw', min:1, max:9, defVal:5, scale:1, unit:'', title:'Entry sensitivity', description:'Radar entry sensitivity'],
[dp:106, name:'entryDistanceIndentation', type:'decimal', rw: 'rw', min:0.0, max:10.0, defVal:6.0, step:10, scale:100, unit:'meters', title:'Entry distance indentation', description:'Entry distance indentation'], // aka 'Detection range reduce when unoccupied'
[dp:107, name:'breakerMode', type:'enum', rw: 'rw', min:0, max:3, defVal:'0', map:[0:'standalone', 1:'local', 2:'manual', 3:'unavailable'], title:'Breaker mode', description:'Status Breaker mode: standalone is external, local is auto'],
[dp:108, name:'breakerStatus', type:'enum', rw: 'rw', min:0, max:1, defVal:'0', map:[0:'OFF', 1:'ON'], title:'Breaker status', description:'on/off state of the switch'],
[dp:109, name:'statusIndication', type:'enum', rw: 'rw', min:0, max:1, defVal:'0', map:[0:'OFF', 1:'ON'], title:'Status indication', description:'Led backlight when triggered'],
[dp:110, name:'illuminThreshold', type:'decimal', rw: 'rw', min:0.0, max:420.0, defVal:100.0, scale:10, unit:'lx', title:'Illuminance Threshold', description:'Illumination threshold for switching on'],
[dp:111, name:'breakerPolarity', type:'enum', rw: 'rw', min:0, max:1, defVal:'0', map:[0:'NC', 1:'NO'], title:'Breaker polarity', description:'Normally open / normally closed factory setting'],
[dp:112, name:'blockTime', type:'number', rw: 'rw', min:0, max:100, defVal:30, scale:1, unit:'seconds', title:"Block time'", description:'Sensor inhibition time after presence or relay state changed'], // aka 'nobody time'
[dp:113, name:'parameterSettingResult', type:'enum', rw: 'ro', min:0, max:6 , defVal:'1', scale:1, map:[ 0:'none', 1:'invalid detection range reduce', 2:'invalid minimum detection range', 3:'invalid maximum detection range', 4:'switch unavailable', 5:'invalid inhibition time', 6:'switch polarity unsupported'] , unit:'', description:'Config error'],
[dp:114, name:'factoryParameters', type:'number', rw: 'ro', scale:1, unit:'-', description:'Factory Reset'],
[dp:115, name:'sensor', type:'enum', rw: 'ro', min:0, max:2, defVal:'0', scale:1, map:[0:'on', 1:'off', 2:'report occupy', 3:'report unoccupy'] , unit:'', description:'Sensor state'],
],
spammyDPsToIgnore : [9],
spammyDPsToNotTrace : [9],
deviceJoinName: 'Tuya Human Presence Detector SBYX0LM6',
configuration : [:]
],
// isLINPTECHradar()
'TS0225_LINPTECH_RADAR' : [ // https://github.com/Koenkk/zigbee2mqtt/issues/18637
description : 'Tuya TS0225_LINPTECH 24GHz Radar', // https://community.hubitat.com/t/release-tuya-zigbee-multi-sensor-4-in-1-pir-motion-sensors-and-mmwave-presence-radars-w-healthstatus/92441/646?u=kkossev
models : ['TS0225'],
device : [type: 'radar', powerSource: 'dc', isSleepy:false],
capabilities : ['MotionSensor': true, 'IlluminanceMeasurement': true, 'DistanceMeasurement':true],
preferences : ['fadingTime':'101', 'motionDetectionDistance':'0xE002:0xE00B', 'motionDetectionSensitivity':'0xE002:0xE004', 'staticDetectionSensitivity':'0xE002:0xE005'],
fingerprints : [ // https://www.amazon.com/dp/B0C7C6L66J?ref=ppx_yo2ov_dt_b_product_details&th=1
[profileId:'0104', endpointId:'01', inClusters:'0000,0003,0004,0005,E002,4000,EF00,0500', outClusters:'0019,000A', model:'TS0225', manufacturer:'_TZ3218_awarhusb', deviceJoinName: 'Tuya TS0225_LINPTECH 24Ghz Human Presence Detector'] // https://www.aliexpress.com/item/1005004788260949.html // https://community.hubitat.com/t/release-tuya-zigbee-multi-sensor-4-in-1-pir-motion-sensors-and-mmwave-presence-radars-w-healthstatus/92441/539?u=kkossev
],
commands : ['resetStats':'resetStats', 'refresh':'refresh', 'initialize':'initialize', 'updateAllPreferences': 'updateAllPreferences', 'resetPreferencesToDefaults':'resetPreferencesToDefaults', 'validateAndFixPreferences':'validateAndFixPreferences'],
tuyaDPs: [ // the tuyaDPs revealed from iot.tuya.com are actually not used by the device! The only exception is dp:101
[dp:101, name:'fadingTime', type:'number', rw: 'rw', min:1, max:9999, defVal:10, scale:1, unit:'seconds', title: 'Fading time', description:'Presence inactivity timer, seconds'] // aka 'nobody time'
],
attributes: [ // LINPTECH / MOES are using a custom cluster 0xE002 for the settings (except for the fadingTime), ZCL cluster 0x0400 for illuminance (malformed reports!) and the IAS cluster 0x0500 for motion detection
[at:'0xE002:0xE001', name:'existance_time', type:'number', dt: 'UINT16', rw: 'ro', min:0, max:65535, scale:1, unit:'minutes', title: 'Existance time/b>', description:'existance (presence) time, recommended value is > 10 seconds!'], // aka Presence Time
[at:'0xE002:0xE004', name:'motionDetectionSensitivity', type:'enum', dt: 'UINT8', rw: 'rw', min:1, max:5, defVal:'4', scale:1, map:[1: '1 - low', 2: '2 - medium low', 3: '3 - medium', 4: '4 - medium high', 5: '5 - high'], unit:'', title: 'Motion Detection Sensitivity', description:'Large motion detection sensitivity'], // aka Motionless Detection Sensitivity
[at:'0xE002:0xE005', name:'staticDetectionSensitivity', type:'enum', dt: 'UINT8', rw: 'rw', min:1, max:5, defVal:'3', scale:1, map:[1: '1 - low', 2: '2 - medium low', 3: '3 - medium', 4: '4 - medium high', 5: '5 - high'], unit:'', title: 'Static Detection Sensitivity', description:'Static detection sensitivity'], // aka Motionless Detection Sensitivity
[at:'0xE002:0xE00A', name:'distance', type:'decimal', dt: 'UINT16', rw: 'ro', min:0.0, max:6.0, defVal:0.0, scale:100, unit:'meters', title: 'Distance', description:'Measured distance'], // aka Current Distance
[at:'0xE002:0xE00B', name:'motionDetectionDistance', type:'enum', dt: 'UINT16', rw: 'rw', min:0.75, max:6.0, defVal:'4.50', step:75, scale:100, map:['0.75': '0.75 meters', '1.50': '1.50 meters', '2.25': '2.25 meters', '3.00': '3.00 meters', '3.75': '3.75 meters', '4.50': '4.50 meters', '5.25': '5.25 meters', '6.00' : '6.00 meters'], unit:'meters', title: 'Motion Detection Distance', description:'Large motion detection distance, meters'] // aka Far Detection
],
spammyDPsToIgnore : [19], // TODO
spammyDPsToNotTrace : [19], // TODO
deviceJoinName: 'Tuya TS0225_LINPTECH 24Ghz Human Presence Detector',
configuration : [:]
],
// no-name 240V AC ceiling radar presence sensor
'TS0225_EGNGMRZH_RADAR' : [ // https://github.com/sprut/Hub/issues/2489
description : 'Tuya TS0225_EGNGMRZH 24GHz Radar', // isEGNGMRZHradar()
models : ['TS0225'],
device : [type: 'radar', powerSource: 'dc', isSleepy:false],
capabilities : ['MotionSensor': true, 'IlluminanceMeasurement': true, 'DistanceMeasurement':true],
preferences : ['radarSensitivity':'101', 'presence_time':'12', 'detectionDelay':'102', 'fadingTime':'116', 'minimumDistance': '111', 'maximumDistance':'112'],
commands : ['resetStats':'resetStats'],
fingerprints : [
[profileId:'0104', endpointId:'01', inClusters:'0000,,0500,1000,EF00,0003,0004,0008', outClusters:'0019,000A', model:'TS0225', manufacturer:'_TZFED8_egngmrzh', deviceJoinName: 'Tuya TS0225_EGNGMRZH 24Ghz Human Presence Detector'] // https://www.aliexpress.com/item/1005004788260949.html // https://community.hubitat.com/t/release-tuya-zigbee-multi-sensor-4-in-1-pir-motion-sensors-and-mmwave-presence-radars-w-healthstatus/92441/539?u=kkossev
],
// uses IAS for occupancy!
tuyaDPs: [
[dp:101, name:'illuminance', type:'number', rw: 'ro', min:0, max:10000, scale:1, unit:'lx'], // https://github.com/Koenkk/zigbee-herdsman-converters/issues/6001
[dp:103, name:'distance', type:'decimal', rw: 'ro', min:0.0, max:10.0, defVal:0.0, scale:10, unit:'meters']
/*
[dp:104, name:'unknown 104 0x68', type:'number', rw: 'ro'], //68
[dp:105, name:'unknown 105 0x69', type:'number', rw: 'ro'], //69
[dp:109, name:'unknown 109 0x6D', type:'number', rw: 'ro'], //6D
[dp:110, name:'unknown 110 0x6E', type:'number', rw: 'ro'], //6E
[dp:111, name:'unknown 111 0x6F', type:'number', rw: 'ro'], //6F
[dp:114, name:'unknown 114 0x72', type:'number', rw: 'ro'], //72
[dp:115, name:'unknown 115 0x73', type:'number', rw: 'ro'], //73
[dp:116, name:'unknown 116 0x74', type:'number', rw: 'ro'], //74
[dp:118, name:'unknown 118 0x76', type:'number', rw: 'ro'], //76
[dp:119, name:'unknown 119 0x77', type:'number', rw: 'ro'] //77
*/
],
spammyDPsToIgnore : [103],
spammyDPsToNotTrace : [103],
deviceJoinName: 'Tuya TS0225_AWARHUSB 24Ghz Human Presence Detector',
configuration : ['battery': false]
],
'TS0225_O7OE4N9A_RADAR' : [ // Aubess Zigbee-Human Presence Detector, Smart PIR Human Body Sensor, Wifi Radar, Microwave Motion Sensors, Tuya, 1/24/5G
description : 'Tuya Human Presence Detector YENSYA2C', // https://github.com/Koenkk/zigbee2mqtt/issues/20082#issuecomment-1856204828
models : ['TS0225'], // https://fr.aliexpress.com/item/1005006016522811.html
device : [type: 'radar', powerSource: 'dc', isSleepy:false], // https://community.hubitat.com/t/release-tuya-zigbee-multi-sensor-4-in-1-pir-motion-sensors-and-mmwave-presence-radars-w-healthstatus/92441/926?u=kkossev
capabilities : ['MotionSensor': true, 'IlluminanceMeasurement': true, 'DistanceMeasurement':true],
preferences : ['radarSensitivity':'110', 'motionSensitivity':'114', 'stateLockDuration':'101', 'fadingTime':'116'],
commands : ['resetStats':'resetStats'],
fingerprints : [
[profileId:'0104', endpointId:'01', inClusters:'0000,0003,0004,0500,0008,1000', outClusters:'000A,0019', model:'TS0225', manufacturer:'_TZFED8_o7oe4n9a', deviceJoinName: 'Aubess Human Presence Detector '], //
],
tuyaDPs: [
[dp:1, name:'motion', type:'enum', rw: 'ro', min:0, max:1, defVal:'0', scale:1, map:[0:'inactive', 1:'active'] , unit:'', title:'Presence state', description:'Presence state'],
[dp:101, name:'stateLockDuration', type:'number', rw: 'rw', min:1, max:5, defVal:1, scale:1, unit:'seconds', title:'State Lock Duration', description:'After a change in manned or unmanned status, it will not change for the specified period of time'], // to be checked/clarified
[dp:102, name:'fadingTime', type:'number', rw: 'rw', min:0, max:3600, defVal:30, scale:1, unit:'seconds', title:'Fading time', description:'How many seconds does it take to become unmanned when no one is detected'],
[dp:105, name:'distanceIntervalSwitch', type:'enum', rw: 'ro', min:0, max:1, defVal:'0', scale:1, map:[0:'inactive', 1:'active'] , unit:'', title:'Distance Interval Switch', description:'Distance interval switch'], // to be checked/clarified
[dp:110, name:'radarSensitivity', type:'number', rw: 'rw', min:1, max:10, defVal:1, scale:1, unit:'', title:'Radar sensitivity', description:'Occupancy Sensitivity
1 = Highest 10 = Lowest'],
[dp:114, name:'motionSensitivity', type:'number', rw: 'rw', min:1, max:20, defVal:7, scale:1, unit:'', title:'Motion sensitivity', description:'Motion Sensitivity
1 = Highest 20 = Lowest'],
[dp:126, name:'requestToSendSomeone', type:'enum', rw: 'ro', min:0, max:1, defVal:'0', scale:1, map:[0:'inactive', 1:'active'] , unit:'', title:'Request to send someone', description:'Request to send someone'], // to be checked/clarified
[dp:176, name:'patternChanges', type:'number', rw: 'ro', min:1, max:5, defVal:1, scale:1, unit:'', title:'Pattern Changes', description:'Pattern changes'], // to be checked/clarified
[dp:181, name:'illuminance', type:'number', rw: 'ro', min:0, max:10000, scale:1, unit:'lx', description:'illuminance'],
[dp:182, name:'distance', type:'decimal', rw: 'ro', min:0.0, max:10.0, defVal:0.0, scale:100, unit:'meters', description:'Distance to target'],
[dp:183, name:'distanceIntervalData', type:'number', rw: 'ro', min:0, max:10000, scale:1, unit:'', description:'Distance interval data'], // to be checked/clarified
],
//spammyDPsToIgnore : [182],
//spammyDPsToNotTrace : [182],
deviceJoinName: 'Aubess Human Presence Detector O7OE4N9A',
configuration : [:]
],
'OWON_OCP305_RADAR' : [
description : 'OWON OCP305 Radar',
models : ['OCP305'],
device : [type: 'radar', powerSource: 'dc', isSleepy:false],
capabilities : ['MotionSensor': true, 'Battery': true],
preferences : [:],
fingerprints : [
[profileId:'0104', endpointId:'01', inClusters:'0000,0003,0406', outClusters:'0003', model:'OCP305', manufacturer:'OWON']
],
deviceJoinName: 'OWON OCP305 Radar',
configuration : ['0x0406':'bind']
],
// isSONOFF()
'SONOFF_SNZB-06P_RADAR' : [ // https://github.com/Koenkk/zigbee-herdsman-converters/blob/14dffaa06511876d096aa72e669df4b032f4cf33/src/devices/sonoff.ts#L675
description : 'SONOFF SNZB-06P RADAR',
models : ['SONOFF'],
device : [type: 'radar', powerSource: 'dc', isIAS:false, isSleepy:false],
capabilities : ['MotionSensor': true],
preferences : ['fadingTime':'0x0406:0x0020', 'radarSensitivity':'0x0406:0x0022'],
commands : ['resetStats':'resetStats', 'refresh':'refresh', 'initialize':'initialize', 'updateAllPreferences': 'updateAllPreferences', 'resetPreferencesToDefaults':'resetPreferencesToDefaults', 'validateAndFixPreferences':'validateAndFixPreferences'],
fingerprints : [
[profileId:'0104', endpointId:'01', inClusters:'0000,0003,0406,0500,FC57,FC11', outClusters:'0003,0019', model:'SNZB-06P', manufacturer:'SONOFF', deviceJoinName: 'SONOFF SNZB-06P RADAR'] // https://community.hubitat.com/t/sonoff-zigbee-human-presence-sensor-snzb-06p/126128/14?u=kkossev
],
attributes: [
[at:'0x0406:0x0022', name:'radarSensitivity', type:'enum', rw: 'rw', min:1, max:3, defVal:'2', unit:'', map:[1:'low', 2:'medium', 3:'high'], title:'Radar Sensitivity', description:'Radar Sensitivity'],
[at:'0x0406:0x0020', name:'fadingTime', type:'enum', rw: 'rw', min:10, max:999, defVal:'60', unit:'seconds', map:[10:'10 seconds', 30:'30 seconds', 60:'60 seconds', 120:'120 seconds', 300:'300 seconds'], title:'Fading Time', description:'Radar fading time in seconds'],
],
deviceJoinName: 'SONOFF SNZB-06P RADAR',
configuration : ['0x0406':'bind', '0x0FC57':'bind'/*, "0xFC11":"bind"*/]
],
// isSiHAS()
'SIHAS_USM-300Z_4_IN_1' : [
description : 'SiHAS USM-300Z 4-in-1',
models : ['ShinaSystem'],
device : [type: 'radar', powerSource: 'battery', isIAS:false, isSleepy:false],
capabilities : ['MotionSensor': true, 'TemperatureMeasurement': true, 'RelativeHumidityMeasurement': true, 'IlluminanceMeasurement': true, 'Battery': true],
preferences : [:],
fingerprints : [
[profileId:'0104', endpointId:'01', inClusters:'0000,0400,0003,0406,0402,0001,0405,0500', outClusters:'0004,0003,0019', model:'USM-300Z', manufacturer:'ShinaSystem', deviceJoinName: 'SiHAS MultiPurpose Sensor']
],
commands : ['resetStats':'resetStats', 'refresh':'refresh', 'initialize':'initialize', 'updateAllPreferences': 'updateAllPreferences', 'resetPreferencesToDefaults':'resetPreferencesToDefaults', 'validateAndFixPreferences':'validateAndFixPreferences'],
tuyaDPs : [:],
attributes : [:],
deviceJoinName: 'SiHAS USM-300Z 4-in-1',
//configuration : ["0x0406":"bind"] // TODO !!
configuration : [:]
],
'UNKNOWN' : [ // the Device Profile key (shown in the State Variables)
description : 'Unknown device', // the Device Profile description (shown in the Preferences)
models : ['UNKNOWN'], // used to match a Device profile if the individuak fingerprints do not match
device : [
type: 'PIR', // 'PIR' or 'radar'
isIAS:true, // define it for PIR sensors only!
powerSource: 'dc', // determines the powerSource value - can be 'battery', 'dc', 'mains'
isSleepy:false // determines the update and ping behaviour
],
capabilities : ['MotionSensor': true, 'IlluminanceMeasurement': true, 'Battery': true],
preferences : ['motionReset':true],
commands : ['resetSettings':'resetSettings', 'resetStats':'resetStats', 'initialize':'initialize', 'updateAllPreferences': 'updateAllPreferences', 'resetPreferencesToDefaults':'resetPreferencesToDefaults', 'validateAndFixPreferences':'validateAndFixPreferences' \
],
//fingerprints : [
// [profileId:"0104", endpointId:"01", inClusters:"0000,0003,0406", outClusters:"0003", model:"model", manufacturer:"manufacturer"]
//],
tuyaDPs: [
[
dp:1,
name:'motion',
type:'enum',
rw: 'ro',
min:0,
max:1,
map:[0:'inactive', 1:'active'],
description:'Motion state'
]
],
deviceJoinName: 'Unknown device', // used during the inital pairing, if no individual fingerprint deviceJoinName was found
configuration : ['battery': true],
batteries : 'unknown'
]
]
@Field static final Map deviceProfilesV3 = [
'UNKNOWN_RADAR' : [ // the Device Profile key (shown in the State Variables)
description : 'Unknown Tuya Radar', // the Device Profile description (shown in the Preferences)
models : ['UNKNOWN'], // used to match a Device profile if the individuak fingerprints do not match
device : [
type: 'radar', // 'PIR' or 'radar'
isIAS:false, // define it for PIR sensors only!
powerSource: 'dc', // determines the powerSource value - can be 'battery', 'dc', 'mains'
isSleepy:false // determines the update and ping behaviour
],
capabilities : ['MotionSensor': true, 'IlluminanceMeasurement': true, 'Battery': false],
preferences : ['motionReset':true],
commands : ['resetSettings':'resetSettings', 'resetStats':'resetStats', 'initialize':'initialize', 'updateAllPreferences': 'updateAllPreferences', 'resetPreferencesToDefaults':'resetPreferencesToDefaults', 'validateAndFixPreferences':'validateAndFixPreferences' \
],
//fingerprints : [
// [profileId:"0104", endpointId:"01", inClusters:"0000,0003,0406", outClusters:"0003", model:"model", manufacturer:"manufacturer"]
//],
tuyaDPs: [
[
dp:1,
name:'motion',
type:'enum',
rw: 'ro',
min:0,
max:1,
map:[0:'inactive', 1:'active'],
description:'Motion state'
]
],
deviceJoinName: 'Unknown Tuya Radar', // used during the inital pairing, if no individual fingerprint deviceJoinName was found
configuration : ['battery': false],
batteries : 'unknown'
]
]
// ---------------------------------- deviceProfilesV2 helper functions --------------------------------------------
/**
* Returns the profile key for a given profile description.
* @param valueStr The profile description to search for.
* @return The profile key if found, otherwise null.
*/
/*
String getProfileKey(final String valueStr) {
String key = null
deviceProfilesV2.each { profileName, profileMap ->
if (profileMap.description == valueStr) {
key = profileName
}
}
return key
}
*/
String getProfileKey(final String valueStr) {
String key = deviceProfilesV2.find { _, profileMap -> profileMap.description == valueStr }?.key
if (key == null) {
key = deviceProfilesV3.find { _, profileMap -> profileMap.description == valueStr }?.key
}
return key
}
/**
* Finds the preferences map for the given parameter.
* @param param The parameter to find the preferences map for.
* @param debug Whether or not to output debug logs.
* @return returns either tuyaDPs or attributes map, depending on where the preference (param) is found
* @return empty map [:] if param is not defined for this device.
*/
Map getPreferencesMap(final String param, boolean debug=false) {
Map foundMap = [:]
if (!(param in DEVICE?.preferences)) {
if (debug) { log.warn "getPreferencesMap: preference ${param} not defined for this device!" }
return [:]
}
/* groovylint-disable-next-line NoDef */
def preference
try {
preference = DEVICE?.preferences["$param"]
if (debug) log.debug "getPreferencesMap: preference ${param} found. value is ${preference}"
if (preference in [true, false]) {
// find the preference in the tuyaDPs map
logDebug "getPreferencesMap: preference ${param} is boolean"
return [:] // no maps for predefined preferences !
}
if (preference.isNumber()) {
// find the preference in the tuyaDPs map
int dp = safeToInt(preference)
List