DDF for Tuya 24G Radar Motion Sensor _TZE204_ztqnh5cg

Hi all,

I want to share my DDF for a Tuya Human Presence Sensor with 24GHz radar motion detektor.
Here’s the link to the product on aliexpress.

The radar motion detector works fine for me.

{
  "schema": "devcap1.schema.json",
  "manufacturername": "_TZE204_ztqnh5cg",
  "modelid": "TS0601",
  "vendor": "Tuya",
  "product": "Human Presence Detector 24GHz mmWave Radar(TS0601)",
  "sleeper": false,
  "status": "Gold",
  "path": "/devices/tuya/_TZE204_ztqnh5cg_mmwave_radar.json",
  "subdevices": [
    {
      "type": "$TYPE_LIGHT_LEVEL_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x0400"
      ],
      "items": [
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion"
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "config/tholddark",
          "default": 12000
        },
        {
          "name": "config/tholdoffset",
          "default": 7000
        },
        {
          "name": "state/dark",
          "default": false
        },
        {
          "name": "state/daylight",
          "default": false
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/lightlevel",
          "default": 0
        },
        {
          "name": "state/lux",
          "description": "The current light intensity in Lux (max is 3000)",
          "read": {
            "fn": "none"
          },
          "parse": {
            "dpid": 104,
            "fn": "tuya",
            "script": "../generic/illuminance_cluster/lux_to_lightlevel.js"
          },
          "default": 0
        }
      ]
    },
    {
      "type": "$TYPE_PRESENCE_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0xef00"
      ],
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion"
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "config/delay",
          "description": "Detection delay : target confirmation delay time in 10th of second (from 0 to 100). Default 0.1s",
          "read": {
            "fn": "none"
          },
          "write": {
            "dpid": 101,
            "dt": "0x2b",
            "eval": "Item.val;",
            "fn": "tuya"
          },
          "parse": {
            "dpid": 101,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 1
        },
        {
          "name": "config/fadingtime",
          "description": "Fading time : target disapperance delay time in second (from 0 to 15000). Default 90s",
          "read": {
            "fn": "none"
          },
          "write": {
            "dpid": 102,
            "dt": "0x2b",
            "eval": "Item.val;",
            "fn": "tuya"
          },
          "parse": {
            "dpid": 102,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 90
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "config/sensitivity",
          "description": "Radar sensitivity (from 1 to 9). Default 5",
          "read": {
            "fn": "none"
          },
          "write": {
            "dpid": 2,
            "dt": "0x2b",
            "eval": "Item.val;",
            "fn": "tuya"
          },
          "parse": {
            "dpid": 2,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 7
        },
        {
          "name": "config/triggerdistance",
          "description": "Far detection sensitivity",
          "read": {
            "fn": "none"
          },
          "write": {
            "dpid": 4,
            "dt": "0x2b",
            "eval": "Far = ['0','1','2','3','4','5','6','7','8','9','10']; Attr.val = Math.max(0,Far.indexOf(Item.val)*100);",
            "fn": "tuya"
          },
          "parse": {
            "dpid": 4,
            "eval": "Item.val = String(Attr.val/100);",
            "fn": "tuya"
          },
          "default": "10"
        },
        {
          "name": "state/errorcode",
          "description": "Self check result code. \n0 = checking, 1 = check_success, 2 = check_failure, 3 = others, 4 = comm_fault, 5 = radar_fault",
          "read": {
            "fn": "none"
          },
          "parse": {
            "dpid": 6,
            "eval": "Item.val = String(Attr.val);",
            "fn": "tuya"
          },
          "default": "Unknown"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/presence",
          "read": {
            "fn": "tuya"
          },
          "parse": {
            "dpid": 1,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": false
        },
        {
          "name": "state/targetdistance",
          "description": "Distance from detected target in cm (from 0 to 1000).",
          "read": {
            "fn": "none"
          },
          "parse": {
            "dpid": 9,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 0
        }
      ]
    }
  ],
  "bindings": [
    {
      "bind": "unicast",
      "src.ep": 1,
      "cl": "0xEF00"
    }
  ]
}

Hello, thx for it and the second DDF (on the other post), do you want to make a PR to submit officialy, I can explain how to do, or want I make it ?
Other thing, it’s a new complete DDF or this device is just a clone ? Because it’s possible to re-use an existing DDF to work with 2 devices, like

  "manufacturername": [
    "_TZE200_ztc6ggyl",
    "_TZE204_ztc6ggyl",
    "_TZE200_ar0slwnd",
    "_TZE200_sfiy5tfs",
    "_TZE200_mrf6vtua",
    "_TZE204_laokfqwu"
  ],
  "modelid": [
    "TS0601",
    "TS0601",
    "TS0601",
    "TS0601",
    "TS0601",
    "TS0601"
  ],
1 Like

Hello, your’re welcome.
I have no experience wir git PR’s. Much appreciated if you can give me an advise. Feel free if you like to do the PR.
Yes I have used ZY-M100_human_breathing_presence.json as template but I’m not sure if device is exactly the same. Potentially there are more datapoints available but I have not investigated on that. Had not the time to understand how to trace dpids works.