[RELEASE] Tuya Zigbee mmWave Sensors (code moved from the Tuya 4 In 1 driver)

Thank you.

Also, it'd be great to expose some more settings like DEFAULT_MIN_REPORTING_TIME (or even a new one called "DEFAULT_MIN_REPORTING_TIME_ILLUM" for more granular setup) as I'm using illuminance from the same sensor in a rule and doing so would make it more responsive. I've overridden it in the code, but having it applied at sensor level instead of app wide would be awesome.

best,
ap

1 Like

Has anyone had any luck with the driver for the Wifi version of this?

If not, does anyone have any idea on the port/url I use to communicate with this presence sensor so that i `ll try to do that? (It's not 80,8080,1883,8883,443)

I have just received a few orders of the Tuya square type. Of the 4 I received only one of them had a known driver. I spent a bit of time tinkering and made up 2 new driver profiles. I am horrible with Git so I will post my findings here with the profile details.

If they hold up maybe @kkossev can add them to the actual driver. All I did was mostly copy working driver profiles and mod them with the DP's I could figure out from the logs and tinkering.

Below are the manufacturer ID's and the driver modifications for them to work. Be warned, last time I tinkered with a zigbee driver was yearrrrrrrs ago.

  1. ManufacturerID: _TZE204_nbkshs6k
    Generic square sensor with image of person and 2 holes.
    Only seems to have a single DP for motion and 1 I could not figure out (dp12).

Driver Profile Details

'TS0601_NBKSHS6K_RADAR'   : [        //5GHz Tuya Thick White Square with Sqr Button
            description   : '5GHz Tuya Generic White Square Basic',
            models        : ['TS0601'],
            device        : [type: 'radar', powerSource: 'dc', isSleepy:false],
            capabilities  : ['MotionSensor': true],
            preferences   : ["unknownDP12":"12"],
            commands      : ['resetStats':'resetStats'],
            fingerprints  : [
                [profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_nbkshs6k', deviceJoinName: '5GHz Tuya Generic White Square Basic']
            ],
            tuyaDPs:        [
                [dp:1,   name:'motion',         type:'enum',   rw: 'ro', min:0, max:1,    defVal: '0', map:[0:'active', 1:'inactive'],     description:'Presence'],
                //[dp:12,   name:'unknownDP12',         type:'number',   rw: 'rw', min:0, max:9999,    defVal: 1,      description:'UnknownDP12'],

            ],
            spammyDPsToIgnore : [],           
            spammyDPsToNotTrace : [],    
            deviceJoinName: '5GHz Tuya Generic White Square Basic'
    ],
  1. ManufacturerID: _TZE204_dapwryy7
    Generic square sensor with image of person and 2 holes with square square reset button. A bit thicker than most.
    Seems to give offl Illumination as well as motion and distance (fairly certain) DPs. I was also able figure out the DP for maximum distance and (i think) sensitivity.

Driver Profile Details:

'TS0601_DAPWRYY7_RADAR'   : [        //5GHz Tuya Thick White Square with Sqr Button
            description   : '5GHz Tuya Thick White Square with Sqr Button',
            models        : ['TS0601'],
            device        : [type: 'radar', powerSource: 'dc', isSleepy:false],
            capabilities  : ['MotionSensor': true, 'DistanceMeasurement':true, 'IlluminanceMeasurement': true],
            preferences   : ['fadingTime':'103', 'radarSensitivity':'105', 'maximumDistance':'107'], //BUG? - the dp103 is tested to set the fading time or motion reset with outbound commands BUT it is also the inbound illuminance dp
            commands      : ['resetStats':'resetStats'],
            fingerprints  : [
                [profileId:'0104', endpointId:'01', inClusters:'0004,0005,EF00,0000', outClusters:'0019,000A', model:'TS0601', manufacturer:'_TZE204_dapwryy7', deviceJoinName: '5GHz Tuya Thick White Square with Sqr Button']
            ],
            tuyaDPs:        [
                [dp:1,   name:'motion',         type:'enum',   rw: 'ro', min:0, max:4,    defVal: '0', map:[0:'inactive', 4:'active'],     description:'Presence'],
                [dp:101, name:'distance', type:'decimal', rw: 'ro', min:0.0, max:9999.0, scale:100,   unit:'m',    description:'Distance'],
                [dp:103, name:'illuminance',            type:'number',  rw: 'ro',                     scale:1,    unit:'lx',       description:'Illuminance'], // BUG? - see above preferences

                //[dp:102, name:'unknownDP102', type:'number', rw: 'ro', min:0, max:9999, scale:1, unit:'', description:''],
                //[dp:104, name:'unknownDP104', type:'number', rw: 'ro', min:0, max:9999, scale:1, unit:'', description:''],

                [dp:105,   name:'radarSensitivity',       type:'number',  rw: 'rw', min:1,   max:9 ,    defVal:5,    scale:1,    unit:'',        title:'<b>Radar Sensitivity</b>',    description:'<i>Sensitivity of the radar</i>'],
                //[dp:106,   name:'minimumDistance',        type:'decimal', rw: 'ro', min:0.0, max:10.0,  defVal:0.1,  scale:100,  unit:'meters',   title:'<b>Minimum distance</b>',     description:'<i>Minimum detection distance</i>'],
                [dp:107,   name:'maximumDistance',        type:'decimal', rw: 'rw', min:0.0, max:10.0,  defVal:10.0,  scale:100,  unit:'meters',   title:'<b>Maximum distance</b>',     description:'<i>Maximum detection distance</i>'],
                
                //[dp:108, name:'unknownDP108', type:'number', rw: 'ro', min:0, max:9999, scale:1, unit:'', description:'Unkown DP108'],
                //[dp:109, name:'unknownDP109', type:'number', rw: 'ro', min:0, max:9999, scale:1, unit:'', description:'Unkown DP109'],
                //[dp:110, name:'unknownDP110', type:'number', rw: 'ro', min:0, max:9999, scale:1, unit:'', description:'Unkown DP110'],
                
                //[dp:114, name:'unknownDP114', type:'number', rw: 'rw', min:0, max:9999, scale:1, unit:'', description:'Unkown DP114'],
                //[dp:115, name:'unknownDP115', type:'number', rw: 'ro', min:0, max:9999, scale:1, unit:'', description:'Unkown DP115'],
                //[dp:116, name:'unknownDP116', type:'number', rw: 'ro', min:0, max:9999, scale:1, unit:'', description:'Unkown DP116'],
                //[dp:117, name:'unknownDP117', type:'number', rw: 'ro', min:0, max:9999, scale:1, unit:'', description:'Unkown DP117'],
                //[dp:118, name:'unknownDP118', type:'number', rw: 'ro', min:0, max:9999, scale:1, unit:'', description:'Unkown DP118'],
                //[dp:119, name:'unknownDP119', type:'number', rw: 'ro', min:0, max:9999, scale:1, unit:'', description:'Unkown DP119'],

            ],
            spammyDPsToIgnore : [],           
            spammyDPsToNotTrace : [],    
            deviceJoinName: '5GHz Tuya Thick White Square with Sqr Button'
    ],
1 Like

Hi @CheesyPotato ,

Both sensors are new and I can't find information in GitHub. Hopefully someone will post the DP details soon.

When you turn the power off and then power on the device, do you see in the live logs debug messages for the unknown DPs? Some Tuya radars will dump most (not all!) of the DPs and their values during the power on, although it is still not easy to guess what is what.

The easier way to get all the needed information for new Tuya devices is when you pair them to a Tuya Zigbee gateway :

I have included your code in the latest dev. branch ver. 3.2.3 2024/06/21 7:46 AM - thank you for your contribution !

Thats how I got the DP's I have commented out in the profiles I posted that I could not figure out.
TS0601_DAPWRYY7_RADAR - spit out a bunch when being plugged in, i messed with a few of them but in the end was only really confident about a couple.
And I may be crazy but DP103 seemed to be doing double duty - outbound as a fading time or motion reset- inbound seemed to be illuminance (the fading time / motion rest I tested as dp103 a few times and it is possible it was coincidence but time will tell i guess.)

I am considering getting a bridge just to keep tinkering

I can recommend purchasing some of the new Tuya Matter Gateways - get the cheapest one that you can find, no matter what the white label is.

It is unusual for one and the same DP to have different functions when written and when used in a reporting message. But knowing Tuya - not impossible! : )

Some (most of) the Tuya radars can be very spammy. So it may be a good idea to add the DPs for the distance reports and the illuminance reports in the product profile this way :

spammyDPsToIgnore : [101],
spammyDPsToNotTrace : [103],

Got a presence sensor and used your new driver.... here is details below...


    deviceProfile : TS0225_2AAELWXK_RADAR
    deviceType : mmWaveSensor
    lastTx : {cmdTime=1719341134216, pingTime=1719341134189}
    lastRx : {illumTime=1719341195225}
    stats : {cfgCtr=1, rxCtr=38, txCtr=28, illumCtr=4, pingsFail=1}
    driverVersion : 3.2.3 2024/06/21 7:46 AM (TS0225 _TZE200_2aaelwxk) (C-7 2.3.9.142)
    health : {checkCtr3=0, offlineCtr=0}
    motionStarted : 2024-06-25 13:53:21.718
    states : {isRefresh=false, isDigital=false, isPing=true, isTimeoutCheck=false}

and here is output


    Status : clear
    healthStatus : online
    humanMotionState : large
    illuminance : 147
    motion : active
    motionDetectionDistance : 8.0
    motionDetectionSensitivity : 7
    radarAlarmMode : 1
    radarAlarmVolume : 3
    rtt : timeout
    smallMotionDetectionSensitivity : 7
    staticDetectionDistance : 5.0
    staticDetectionSensitivity : 7

it appears it does not have "presence" do I look at motion or humanMotionState to tell if something present ?

also THANKs so much for the dedicated driver!!

Currently experimenting with the same Tuya battery powered mmWave + PIR (Zigbee version) that others have discovered. https://www.aliexpress.us/item/3256806664768243.html. Pretty decent sensor with good static sensitivity & nice not having to always have to supply mains power to provide location flexibility.

Is it somehow possible to expose (extract?) a parameter similar to the Linptech mmWave's "occupiedTime" so that when the motion state is active - an elapsed timer/counter (hh:mm:ss) starts & ultimately stops when states change to no motion? I really like the ability of knowing how long a room was occupied as my use case and currently use a RM rule to notify me when the room was no longer occupied & for how long it had been occupied & wanted to avoid using an ancillary custom timer app if possible.

Here's what that Tuya sensor shows:
Screenshot 2024-07-03 at 14-29-04 Tuya Battery mmWave PIR

Screenshot 2024-07-03 at 14-28-11 Tuya Battery mmWave PIR

@kkossev - any & all thoughts welcomed. Your driver contributions are consistently outstanding BTW ... thanks for sharing your coding prowess with the rest of us.

2 Likes

I see you added TS0601 _TZE204_7gclukjs in ver. 3.1.3 and I'm currently running 3.2.2
So I wanted to ask, what device profile should I use with the following sensor?

  • manufacturer: _TZE204_7gclukjs
  • model: TS0601

Hi @user5319,
The correct device profile should be selected automatically when you select 'LOAD ALL DEFAULTS' option under the 'Configure' button.

It should be seen as ''Tuya Human Presence Detector 7GCLUKJS'' in the 'Device Profile' , or as 'TS0601_7GCLUKJS_RADAR' in the State Variables section.

2 Likes

Thank you. Setting it to ''Tuya Human Presence Detector 7GCLUKJS'' worked. by default it was using "Tuya Human Presence Detector SXM7L9XA"

Did the ‘LOAD ALL DEFAULTS’ select the right device profile?

If not, this means this device fingerprint is wrong in the driver…

Can you temporarily switch to the HE inbuilt ‘Device’ driver, click on ‘Get Info’ button and select/copy/paste as a text the generated fingerprint from the live logs?

@kkossev - also meant to ask whether the battery level attribute is available/can be exposed with this same Tuya mmWave + PIR sensor. Thoughts?

Hi Mark - yes. the battery can be exposed, but I have to finish some other already started projects first. The most important one is the refactoring of the old 'Tuya 4 In 1' driver to use the same libraries as in the new Tiya mmWave driver.

2 Likes

Trying to understand this presence sensor.... there has been no activity in room for almost 3 hours but it still says motion is active.
It seemed like some of the drivers had a timer that would change active to inactive...does this do that at all ?
How does this sensor handle sensing a person that is NOT moving (i.e. sleeping).... there is no "presence" output just a motion output.
I want to turn off the ceiling fan if no one is in the room and its during the day... i was hoping this did detect presence and not just motion...
Also there is settings for alarm which I've enabled but I've never heard a sound...do they make sounds?
image

Hi Tim,

I have commented many times - these devices are NOT presence sensors. I never use the term 'presence sensor'. They are simply very sensitive motion sensors, that process and analyze the the radio wave reflections from any moving object. It may be a human breathing or a plant leaf moving from the air flow - the reflections are (nearly) the same.

In your case, the ceiling fan may be detected as a moving object...

Making a difference between a human and a fan often involves AI (or Machine Learning algorithms) - I think this is the case with Aqara FP2 and Aqara Cloud servers.

1 Like

thank you! really appreciate the clarification... I will turn off the fan and see if it goes inactive.

I notice also that 'smallMotionDetectionSensitivity' parameter is set to 10 - is this the maximum sensitivity for this device? If yes - try decreasing it ...
There are a lot of fine-tune parameters for this mmWave sensor - are there any details on the leaflet that comes with the sensor?

1 Like

Geeze..... motion is inactive ...you were spot on...
ha...so not the right application for turning off the fan : (

2 Likes

Experiment with re-positioning the sensor - lower it toward the floor if possible.