deconz-rest-plugin icon indicating copy to clipboard operation
deconz-rest-plugin copied to clipboard

Yet another Tuya mmWave sensor

Open kutagh opened this issue 1 year ago • 4 comments

Is there already an existing issue for this?

  • [X] I have searched the existing issues and there is none for my device

Product name

Tuya Smart Human Presence Sensor

Manufacturer

_TZE204_mhxn2jso

Model identifier

TS0601

Device type to add

Sensor

Node info

image

Endpoints and clusters

image

Basic

image

Further relevant clusters

Power Configuration

On/Off

Level Control

Color Control

Thermostat

Simple Metering

Electrical Measurement

Any other cluster of relevance/interest

image

kutagh avatar Jan 16 '24 09:01 kutagh

As there has not been any response in 21 days, this issue has been automatically marked as stale. At OP: Please either close this issue or keep it active It will be closed in 7 days if no further activity occurs.

github-actions[bot] avatar Feb 07 '24 01:02 github-actions[bot]

It's not stale, as far as I'm aware support for this device type has not yet been added.

kutagh avatar Feb 13 '24 12:02 kutagh

@Smanar can you check in :)?

Mimiix avatar Feb 13 '24 20:02 Mimiix

Hello, so first try


{
  "schema": "devcap1.schema.json",
  "manufacturername": "_TZE204_mhxn2jso",
  "modelid": "TS0601",
  "product": "Tuya Human Presence Detector",
  "sleeper": false,
  "status": "Gold",
  "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",
          "parse": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001", "script": "tuya_swversion.js"},
          "read": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001"}
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/dark"
        },
        {
          "name": "config/tholddark"
        },
        {
          "name": "config/tholdoffset"
        },
        {
          "name": "state/daylight"
        },
        {
          "name": "state/lightlevel"
        },
        {
          "name": "state/lux",
          "read": {
            "fn": "none"
          },
          "parse": {
            "dpid": 20,
            "script": "../generic/illuminance_cluster/lux_to_lightlevel.js",
            "fn": "tuya"
          },
          "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",
          "parse": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001", "script": "tuya_swversion.js"},
          "read": {"fn": "zcl:attr", "ep": 1, "cl": "0x0000", "at": "0x0001"}
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "config/delay",
          "read": {
            "fn": "none"
          },
          "write": {
            "dpid": 12,
            "dt": "0x2b",
            "eval": "Item.val;",
            "fn": "tuya"
          },
          "parse": {
            "dpid": 12,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 1
        },
        {
          "name": "config/fadingtime",
          "range": [
            5,
            36000
          ],
          "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",
          "range": [
            1,
            10
          ],
          "read": {
            "fn": "none"
          },
          "write": {
            "dpid": 101,
            "dt": "0x2b",
            "eval": "Item.val;",
            "fn": "tuya"
          },
          "parse": {
            "dpid": 101,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 7
        },
        {
          "name": "config/triggerdistance",
          "read": {
            "fn": "none"
          },
          "write": {
            "dpid": 19,
            "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": 19,
            "eval": "Item.val = String(Attr.val/100);",
            "fn": "tuya"
          },
          "values": [
            [
              "\"1\"",
              "1m"
            ],
            [
              "\"2\"",
              "2m"
            ],
            [
              "\"3\"",
              "3m"
            ],
            [
              "\"4\"",
              "4m"
            ],
            [
              "\"5\"",
              "5m"
            ],
            [
              "\"6\"",
              "6m"
            ],
            [
              "\"7\"",
              "7m"
            ],
            [
              "\"8\"",
              "8m"
            ],
            [
              "\"9\"",
              "9m"
            ],
            [
              "\"10\"",
              "10m"
            ],
            [
              "\"0\"",
              "Off"
            ]
          ],
          "default": "10"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/presence",
          "read": {
            "fn": "none"
          },
          "parse": {
            "dpid": 1,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": false
        }
      ]
    }
  ]
}

Better to wait for the device send first values for setting and compare them, I don't know the convertion needed.

  • config/delay : 0 > 10 (probably need to / or * 10)
  • config/fadingtime : 5 > 36000
  • config/sensitivity : 1 > 10 (probably need to / or * 10)
  • config/triggerdistance : "1" to "10", string values

The problem is the DDF limit values

          "name": "config/sensitivity",
          "range": [
            1,
            10
          ],

So if values need to be 100 (*10), you will have an error using the DDF, if you can get the debug line from the device using deconz log, will be usefull.

The DDF need to be in "devices/tuya" folder because of the relative path, else if you are on docker you need this file too (and change the path ofc)

"script": "../generic/illuminance_cluster/lux_to_lightlevel.js",

Smanar avatar Feb 14 '24 16:02 Smanar

As there has not been any response in 21 days, this issue has been automatically marked as stale. At OP: Please either close this issue or keep it active It will be closed in 7 days if no further activity occurs.

github-actions[bot] avatar Mar 07 '24 01:03 github-actions[bot]

Still looking at it (missed a notification & not experienced with adding DDFs)

kutagh avatar Mar 08 '24 12:03 kutagh

As there has not been any response in 21 days, this issue has been automatically marked as stale. At OP: Please either close this issue or keep it active It will be closed in 7 days if no further activity occurs.

github-actions[bot] avatar Mar 30 '24 01:03 github-actions[bot]

Still trying to debug values as it keeps showing presence when it shouldn't

kutagh avatar Mar 30 '24 09:03 kutagh

On deconz/help/debug view with flag "info" and "info_l2" you will request made by the device The one on dpid 0x01 is the presence detection, if you have it, there is no problem, try to decrease settings.

Smanar avatar Mar 30 '24 13:03 Smanar

As there has not been any response in 21 days, this issue has been automatically marked as stale. At OP: Please either close this issue or keep it active It will be closed in 7 days if no further activity occurs.

github-actions[bot] avatar Apr 21 '24 01:04 github-actions[bot]

Sorry but I'm giving up on it. The zigbee network has many devices and it's hard to find the values for this sensor only. I already tried tweaking the settings but it kept showing presence all the time.

kutagh avatar Apr 27 '24 10:04 kutagh