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

Tuya Luminance Motion Sensor Model ZG-204ZL _TZE200_3towulqd

Open Tscheurgen opened this issue 2 years ago • 13 comments

Device

  • Product name: Tuya Luminance Motion Sensor Model ZG-204ZL
  • Manufacturer: _TZE200_3towulqd
  • Model identifier: TS0601
  • Device type :
    • Sensor

Screenshots

Node Info image

Basic Cluster image

Power Configuration image

OTAU image

Tscheurgen avatar Jun 30 '22 21:06 Tscheurgen

Hi,

Are these all the clusters in the cluster list?

Mimiix avatar Jul 01 '22 06:07 Mimiix

Hello! Here the clusterlist image

Indeed IAS Zone has also attributes image

Sorry! Thank you!

Tscheurgen avatar Jul 01 '22 06:07 Tscheurgen

Ha, it seem this device don't use the IAS cluster, but only the tuya one.

Can start with this DDF

{
  "schema": "devcap1.schema.json",
  "manufacturername": "_TZE200_3towulqd",
  "modelid": "TS0601",
  "vendor": "Tuya",
  "product": "ZG-204ZL",
  "status": "Gold",
  "sleeper": true,
  "subdevices": [
    {
      "type": "$TYPE_LIGHT_LEVEL_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x0400"
      ],
      "items": [
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid",
          "awake": true
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion"
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "config/tholddark"
        },
        {
          "name": "config/tholdoffset"
        },
        {
          "name": "state/lightlevel",
          "parse": {
            "fn": "tuya",
            "dpid": 1,
            "eval": "Item.val = Attr.val;"
          },
          "read": {
            "fn": "tuya"
          },
          "default": 0
        },
        {
          "name": "state/presence",
          "parse": {
            "fn": "tuya",
            "dpid": 12,
            "eval": "Item.val = Attr.val == 0;"
          },
          "read": {
            "fn": "none"
          },
          "default": 0
        },
        {
          "name": "state/dark"
        },
        {
          "name": "state/daylight"
        },
        {
          "name": "state/lux"
        },
        {
          "name": "state/lastupdated"
        }
      ]
    }
  ]
}

You can try state/presence and state/lightlevel

Smanar avatar Jul 01 '22 17:07 Smanar

unfortunately presence keeps true and lightlevel changes only between 0 and 1 Thank you!

Tscheurgen avatar Jul 07 '22 15:07 Tscheurgen

Oups, can you reverse the 2 dpid ?

12 is for the lightlevel 1 is for the presence

Smanar avatar Jul 07 '22 17:07 Smanar

Hmmm it seems there is no difference. I've readded the device.

Tscheurgen avatar Jul 07 '22 20:07 Tscheurgen

No difference ? Your DDF look like that now

        },
        {
          "name": "state/lightlevel",
          "parse": {
            "fn": "tuya",
            "dpid": 12,
            "eval": "Item.val = Attr.val;"
          },
          "read": {
            "fn": "tuya"
          },
          "default": 0
        },
        {
          "name": "state/presence",
          "parse": {
            "fn": "tuya",
            "dpid": 1,
            "eval": "Item.val = Attr.val == 0;"
          },
          "read": {
            "fn": "none"
          },
          "default": 0
        },

If yes, can you enable the deconz log (help / debug view) with the flag "DDF" and "info_l2", and try to trigger a detection ? (Can make a screen capture if you can make a copy/paste)

Smanar avatar Jul 08 '22 15:07 Smanar

Hello! Sorry for delaying my answer! I hadn't swapped the eval value. But now it is as well. Lightlevel changes between 0 and 1000. Lux keeps at 0 and presence is updating correct.

Here ist the log. Hopefully with enough information. I didn't find more entries with the Name or Mac Adress. Lightlevel62.txt

Tscheurgen avatar Jul 19 '22 09:07 Tscheurgen

You have enable the flag "DDF" and "info_l2" ? If yes it mean the device haven't make report at all, when a tuya device make request you will have something like that in logs

        DBG_Printf(DBG_INFO, "TY_DATA_%s: seq %u, dpid: 0x%02X, type: 0x%02X, length: %u, val: %d\n",
                   rt, seq, dpid, dataType, dataLength, num.s32);

Oups, sorry my bad, this log is visible wih "info" not "info_l2"

Smanar avatar Jul 19 '22 16:07 Smanar

Finally here is the latest log. Mac-Adress is a4:c1:38:b6:7c:58:a8:be in Line 7 first occurance. Lighlevel62_Info_DDF.txt Thank you!

Tscheurgen avatar Aug 01 '22 20:08 Tscheurgen

21:43:44:788 TY_DATA_REPORT: seq 160, dpid: 0x01, type: 0x04, length: 1, val: 0
21:43:44:829 a4:c1:38:b6:7c:58:a8:be-01-0400/state/presence expression: Item.val = Attr.val == 0; --> true
21:43:42:094 TY_DATA_REPORT: seq 158, dpid: 0x01, type: 0x04, length: 1, val: 1
21:43:42:132 a4:c1:38:b6:7c:58:a8:be-01-0400/state/presence expression: Item.val = Attr.val == 0; --> false

So the presence seem working. Perhaps reversed ?

21:43:12:971 a4:c1:38:b6:7c:58:a8:be-01-0400/state/lightlevel expression: Item.val = Attr.val; --> 72
21:43:12:971 TY_DATA_REPORT: seq 154, dpid: 0x0C, type: 0x02, length: 4, val: 72
21:43:27:767 a4:c1:38:b6:7c:58:a8:be-01-0400/state/lightlevel expression: Item.val = Attr.val; --> 66
21:43:27:768 TY_DATA_REPORT: seq 156, dpid: 0x0C, type: 0x02, length: 4, val: 66

Lightlevel seem working too, but more complex for this one.

State/lux is not used previosuly in the DDF. From the code It seem

  • lux is The current Light level in lux
  • lightlevel is The current Light level in 10000 log10 (lux) + 1.

I have found this table for this device.

                    // Real lux - Measured value
                    // 0          10
                    // 30.1       778
                    // 43.3       826
                    // 57.4       850
                    // 75.7       898
                    // 98.6       922
                    // 127.6      1000

But if value go from 0 to 1000 maximum there is a problem, we can have 500 Lux. So I presume this value is in Lux and need to be converted in lightlevel

Can try this DDF, but it NEED to be in the tuya folder (because of the path file of JS script)

{
  "schema": "devcap1.schema.json",
  "manufacturername": "_TZE200_3towulqd",
  "modelid": "TS0601",
  "vendor": "Tuya",
  "product": "ZG-204ZL",
  "status": "Gold",
  "sleeper": true,
  "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"
        },
        {
          "name": "config/tholdoffset"
        },
        {
          "name": "state/lightlevel"
        },
        {
          "name": "state/presence",
          "parse": {
            "fn": "tuya",
            "dpid": 12,
            "eval": "Item.val = Attr.val == 0;"
          },
          "read": {
            "fn": "none"
          },
          "default": 0
        },
        {
          "name": "state/dark"
        },
        {
          "name": "state/daylight"
        },
        {
          "name": "state/lux",
          "parse": {
            "fn": "tuya",
            "dpid": 1,
            "script": "../generic/illuminance_cluster/lux_to_lightlevel.js"
          },
          "read": {
            "fn": "tuya"
          },
          "default": 0
        },
        {
          "name": "state/lastupdated"
        }
      ]
    }
  ]
}

Smanar avatar Aug 02 '22 15:08 Smanar

Hello! It looks a bit better now. But I had to switch dpid again and the lux/lightlevel is still a bit wrong: Aqara/LUMI Values: "lightlevel": 13803, "lux": 24 Tuya Values: "lightlevel": 25160, "lux": 328

Sensors are placed next to each other. Do I have to add the Lightlevel conversion first? and also Lightlevel DDF Information? Where did you find this special table?

Tscheurgen avatar Aug 05 '22 13:08 Tscheurgen

Where did you find this special table?

On z2m github https://github.com/Koenkk/zigbee2mqtt/issues/12364 , but they don't use it on final code, and display value as it, are you sure tuya gateway display standard value ?

Do I have to add the Lightlevel conversion first? and also Lightlevel DDF Information?

Not sure to understand, but the file "/generic/illuminance_cluster/lux_to_lightlevel.js" is not present on your side ? (it is 3 month old)

And I have checked other project, no one use the good formula to have correct value, I have searched on my side, and don't found how to have thoses result

                    // Real lux - Measured value
                    // 0          10
                    // 30.1       778
                    // 43.3       826
                    // 57.4       850
                    // 75.7       898
                    // 98.6       922
                    // 127.6      1000

Edit:

Have probably found the convertion (without logic, random test)

Measuredvalue= (Math.round(10000 * Math.log10(Reallux) + 1))/20;

But with 24 I have 690 as result not 328, but according to the table I m not so bad.

Smanar avatar Aug 05 '22 18:08 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 Aug 27 '22 02:08 github-actions[bot]

As there has not been any response in 28 days, this issue will be closed. @ OP: If this issue is solved post what fixed it for you. If it is not solved, request to get this opened again.

github-actions[bot] avatar Sep 04 '22 02:09 github-actions[bot]

Hi, i have this device with and without light meter. Both get recognzied by deCONZ, but only one of them connects to the zigbee interface (rasbee 2). This is what i get from the API: "4": { "config": { "on": true, "reachable": true, "tholddark": 12000, "tholdoffset": 7000 }, "etag": "4d1069793df1f9b6cad8dd90a1b6d350", "lastannounced": "2022-10-15T11:18:48Z", "lastseen": "2022-10-15T11:19Z", "manufacturername": "_TZE200_3towulqd", "modelid": "TS0601", "name": "LightLevel 4", "state": { "dark": true, "daylight": false, "lastupdated": "2022-10-15T11:19:30.713", "lightlevel": 0, "lux": 0, "presence": false }, "type": "ZHALightLevel", "uniqueid": "a4:c1:38:01:13:e6:33:1f-01-0400" },

So presence is false and lux is 0. Since the sensors aren't lying in a box, those values are wrong. So i guess the ddf just doesn't work for me?

edit: oh btw i used the ddf some posts above from Smanar

llugo avatar Oct 15 '22 11:10 llugo

Both get recognzied by deCONZ, but only one of them connects to the zigbee interface (rasbee 2).

Men you can see both in deconz (the GUI application) but only one is visible in the API ?

You have put the DDF in the "tuya" folder ? Because it use a local script.

Can take a look in deconz log (help / debug view) with enabling "ddf", "info" and "info_l2" and try to trigger a presence, you will see some line like

        DBG_Printf(DBG_INFO, "TY_DATA_%s: seq %u, dpid: 0x%02X, type: 0x%02X, length: %u, val: %d\n",
                   rt, seq, dpid, dataType, dataLength, num.s32);

Smanar avatar Oct 15 '22 13:10 Smanar

Men you can see both in deconz (the GUI application) but only one is visible in the API ?

They're both shown in deCONZ and through the API, but only one of them shows a link to the raspbee II / configuration tool. The other one doesn't get updated for some reason. It surely is not the battersy since both do red flashes every few secs. This is what i get from the unconnected one:

"5": { "config": { "on": true, "reachable": true, "tholddark": 12000, "tholdoffset": 7000 }, "etag": "60daa20ba0641372e31214fe96514167", "lastannounced": "2022-10-12T12:53:00Z", "lastseen": "2022-10-12T16:09Z", "manufacturername": "_TZE200_3towulqd", "modelid": "TS0601", "name": "LightLevel 5", "state": { "dark": true, "daylight": false, "lastupdated": "2022-10-12T16:09:18.443", "lightlevel": 0, "lux": 0, "presence": false }, "type": "ZHALightLevel", "uniqueid": "a4:c1:38:b5:d8:f7:f0:13-01-0400" },

You have put the DDF in the "tuya" folder ? Because it use a local script.

Yep loaded the json file from /usr/share/.../devices/tuya/

Can take a look in deconz log (help / debug view) with enabling "ddf", "info" and "info_l2" [...]

When switching on all 3 there's a lot going on. One recurring thing is the following:

19:52:54:831 Force read attributes for ZHALightLevel SensorNode LightLevel 4 19:52:54:832 Force binding of attribute reporting for node LightLevel 4

When switching on only DDF in debug view i see the following also recurring:

19:50:46:682 a4:c1:38:01:13:e6:33:1f-01-0400/state/presence expression: Item.val = Attr.val == 0; --> false 19:58:21:881 a4:c1:38:01:13:e6:33:1f-01-0400/state/lux expression: const tholddark = R.item('config/tholddark').val; const tholdoffset = R.item('config/tholdoffset').val; const lux = Attr.val; let ll = 0; if (lux > 0 && lux < 0xffff) { ll = Math.round(10000 * Utils.log10(lux) + 1); } R.item('state/lightlevel').val = ll; R.item('state/dark').val = ll <= tholddark; R.item('state/daylight').val = ll >= tholddark + tholdoffset; Item.val = lux; --> 0

[...] and try to trigger a presence, you will see some line like

        DBG_Printf(DBG_INFO, "TY_DATA_%s: seq %u, dpid: 0x%02X, type: 0x%02X, length: %u, val: %d\n",
                   rt, seq, dpid, dataType, dataLength, num.s32);

This line sadly appears not to show up.

EDIT: ok, the battery from the non connecting one was dying. I'll edit this post once i got a new one.

llugo avatar Oct 15 '22 18:10 llugo

This line sadly appears not to show up.

This line appear with flag "info", and start by "TY_DATA". You have it probably around thoses ones

19:50:46:682 a4:c1:38:01:13:e6:33:1f-01-0400/state/presence expression: Item.val = Attr.val == 0; --> false

On this one the device have trigger the presence dp, and is probably reversed.

19:52:54:831 Force read attributes for ZHALightLevel SensorNode LightLevel 4
19:52:54:832 Force binding of attribute reporting for node LightLevel 4

This need to be disabled, totaly useless, your device havent light cluster. Tuya device don't use bind/report

Smanar avatar Oct 15 '22 19:10 Smanar

Ok, this is what i get when i have INFO switch enabled:

21:58:55:221 TY_DATA_REPORT: seq 56, dpid: 0x04, type: 0x02, length: 4, val: 100 21:58:55:223 TY_DATA_REPORT: seq 56, dpid: 0x04, type: 0x02, length: 4, val: 100 21:58:55:458 TY_DATA_REPORT: seq 57, dpid: 0x09, type: 0x04, length: 1, val: 2 21:58:55:460 TY_DATA_REPORT: seq 57, dpid: 0x09, type: 0x04, length: 1, val: 2 21:58:55:679 TY_DATA_REPORT: seq 58, dpid: 0x0A, type: 0x04, length: 1, val: 0 21:58:55:681 TY_DATA_REPORT: seq 58, dpid: 0x0A, type: 0x04, length: 1, val: 0 21:59:03:816 TY_DATA_REPORT: seq 59, dpid: 0x04, type: 0x02, length: 4, val: 100 21:59:03:817 TY_DATA_REPORT: seq 59, dpid: 0x04, type: 0x02, length: 4, val: 100 21:59:13:844 TY_DATA_REPORT: seq 60, dpid: 0x04, type: 0x02, length: 4, val: 100 21:59:13:851 TY_DATA_REPORT: seq 60, dpid: 0x04, type: 0x02, length: 4, val: 100 21:59:14:246 TY_DATA_REPORT: seq 61, dpid: 0x01, type: 0x04, length: 1, val: 1 21:59:14:249 TY_DATA_REPORT: seq 61, dpid: 0x01, type: 0x04, length: 1, val: 1 21:59:14:448 TY_DATA_REPORT: seq 62, dpid: 0x0C, type: 0x02, length: 4, val: 9 21:59:14:463 TY_DATA_REPORT: seq 62, dpid: 0x0C, type: 0x02, length: 4, val: 9 21:59:14:664 TY_DATA_REPORT: seq 63, dpid: 0x04, type: 0x02, length: 4, val: 100 21:59:14:665 TY_DATA_REPORT: seq 63, dpid: 0x04, type: 0x02, length: 4, val: 100 21:59:14:886 TY_DATA_REPORT: seq 64, dpid: 0x09, type: 0x04, length: 1, val: 2 21:59:14:888 TY_DATA_REPORT: seq 64, dpid: 0x09, type: 0x04, length: 1, val: 2 21:59:15:107 TY_DATA_REPORT: seq 65, dpid: 0x0A, type: 0x04, length: 1, val: 0 21:59:15:111 TY_DATA_REPORT: seq 65, dpid: 0x0A, type: 0x04, length: 1, val: 0 21:59:23:964 TY_DATA_REPORT: seq 66, dpid: 0x04, type: 0x02, length: 4, val: 100 21:59:23:966 TY_DATA_REPORT: seq 66, dpid: 0x04, type: 0x02, length: 4, val: 100 21:59:33:974 TY_DATA_REPORT: seq 67, dpid: 0x04, type: 0x02, length: 4, val: 100 21:59:33:976 TY_DATA_REPORT: seq 67, dpid: 0x04, type: 0x02, length: 4, val: 100

This need to be disabled, totaly useless, your device havent light cluster. Tuya device don't use bind/report

Where can i read about how to disable those? Sorry i'm quite new to deCONZ.

EDIT: And here another excerpt from the Debug window:

22:10:03:054 TY_DATA_REPORT: seq 38, dpid: 0x01, type: 0x04, length: 1, val: 1 22:10:03:055 TY_DATA_REPORT: seq 38, dpid: 0x01, type: 0x04, length: 1, val: 1 22:10:03:324 TY_DATA_REPORT: seq 39, dpid: 0x0C, type: 0x02, length: 4, val: 9 22:10:03:337 a4:c1:38:01:13:e6:33:1f-01-0400/state/presence expression: Item.val = Attr.val == 0; --> false 22:10:03:339 TY_DATA_REPORT: seq 39, dpid: 0x0C, type: 0x02, length: 4, val: 9 22:10:03:546 TY_DATA_REPORT: seq 40, dpid: 0x04, type: 0x02, length: 4, val: 100 22:10:03:547 TY_DATA_REPORT: seq 40, dpid: 0x04, type: 0x02, length: 4, val: 100 22:10:03:768 TY_DATA_REPORT: seq 41, dpid: 0x09, type: 0x04, length: 1, val: 2 22:10:03:769 TY_DATA_REPORT: seq 41, dpid: 0x09, type: 0x04, length: 1, val: 2

llugo avatar Oct 15 '22 20:10 llugo

21:58:55:221 TY_DATA_REPORT: seq 56, dpid: 0x04, type: 0x02, length: 4, val: 100

This one is the battery, have added it in the DDF

21:58:55:458 TY_DATA_REPORT: seq 57, dpid: 0x09, type: 0x04, length: 1, val: 2

This one is the sensitivity

21:58:55:679 TY_DATA_REPORT: seq 58, dpid: 0x0A, type: 0x04, length: 1, val: 0

Something to see with a timer ...

21:59:14:246 TY_DATA_REPORT: seq 61, dpid: 0x01, type: 0x04, length: 1, val: 1

This one is the presence

22:10:03:324 TY_DATA_REPORT: seq 39, dpid: 0x0C, type: 0x02, length: 4, val: 9 22:10:03:337 a4:c1:38:01:13:e6:33:1f-01-0400/state/presence expression: Item.val = Attr.val == 0; --> false

Fuck, this one is the lux, I reversed them with presence.

New DDF to test

{
  "schema": "devcap1.schema.json",
  "manufacturername": "_TZE200_3towulqd",
  "modelid": "TS0601",
  "vendor": "Tuya",
  "product": "ZG-204ZL",
  "status": "Gold",
  "sleeper": true,
  "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"
        },
        {
          "name": "config/tholdoffset"
        },
        {
          "name": "state/lightlevel"
        },
        {
          "name": "state/presence",
          "parse": {
            "fn": "tuya",
            "dpid": 1,
            "eval": "Item.val = Attr.val == 1;"
          },
          "read": {
            "fn": "none"
          },
          "default": 0
        },
        {
          "name": "config/battery",
          "parse": {"fn": "tuya", "dpid": 4, "eval": "Item.val = Attr.val;" },
          "read": {"fn": "none"},
          "default": 0
        },
        {
          "name": "state/dark"
        },
        {
          "name": "state/daylight"
        },
        {
          "name": "state/lux",
          "parse": {
            "fn": "tuya",
            "dpid": 12,
            "script": "../generic/illuminance_cluster/lux_to_lightlevel.js"
          },
          "read": {
            "fn": "tuya"
          },
          "default": 0
        },
        {
          "name": "state/lastupdated"
        }
      ]
    }
  ]
}

For exemple on logs

21:59:14:246 TY_DATA_REPORT: seq 61, dpid: 0x01, type: 0x04, length: 1, val: 1

this one need to switch from 1 to 0 according to presence.

Smanar avatar Oct 16 '22 08:10 Smanar

Ok, this is what i get from the api using the modified DDF:

"4": { "config": { "on": true, "reachable": true, "tholddark": 12000, "tholdoffset": 7000 }, "etag": "9b7fcecfcb2b079c2778c39037456129", "lastannounced": "2022-10-16T11:31:53Z", "lastseen": "2022-10-16T11:31Z", "manufacturername": "_TZE200_3towulqd", "modelid": "TS0601", "name": "LightLevel 4", "state": { "dark": true, "daylight": false, "lastupdated": "2022-10-16T11:32:10.577", "lightlevel": 1, "lux": 1, "presence": false }, "type": "ZHALightLevel", "uniqueid": "a4:c1:38:01:13:e6:33:1f-01-0400" },

accompanying debug log (INFO and DDF being switched on):

13:34:40:576 TY_DATA_REPORT: seq 65, dpid: 0x01, type: 0x04, length: 1, val: 0 13:34:40:578 TY_DATA_REPORT: seq 65, dpid: 0x01, type: 0x04, length: 1, val: 0 13:34:42:372 TY_DATA_REPORT: seq 66, dpid: 0x0C, type: 0x02, length: 4, val: 1000 13:34:42:386 a4:c1:38:01:13:e6:33:1f-01-0400/state/presence expression: Item.val = Attr.val == 0; --> false 13:34:42:388 TY_DATA_REPORT: seq 66, dpid: 0x0C, type: 0x02, length: 4, val: 1000 13:34:49:023 TY_DATA_REPORT: seq 67, dpid: 0x04, type: 0x02, length: 4, val: 100 13:34:49:025 TY_DATA_REPORT: seq 67, dpid: 0x04, type: 0x02, length: 4, val: 100 13:34:50:451 a4:c1:38:01:13:e6:33:1f-01-0400/state/lux expression: const tholddark = R.item('config/tholddark').val; const tholdoffset = R.item('config/tholdoffset').val; const lux = Attr.val; let ll = 0; if (lux > 0 && lux < 0xffff) { ll = Math.round(10000 * Utils.log10(lux) + 1); } R.item('state/lightlevel').val = ll; R.item('state/dark').val = ll <= tholddark; R.item('state/daylight').val = ll >= tholddark + tholdoffset; Item.val = lux; --> 0 13:34:50:457 TY_DATA_REPORT: seq 68, dpid: 0x01, type: 0x04, length: 1, val: 0 13:34:50:459 TY_DATA_REPORT: seq 68, dpid: 0x01, type: 0x04, length: 1, val: 0 13:34:50:726 TY_DATA_REPORT: seq 69, dpid: 0x0C, type: 0x02, length: 4, val: 1000 13:34:50:739 a4:c1:38:01:13:e6:33:1f-01-0400/state/presence expression: Item.val = Attr.val == 0; --> false 13:34:50:741 TY_DATA_REPORT: seq 69, dpid: 0x0C, type: 0x02, length: 4, val: 1000 13:34:50:948 TY_DATA_REPORT: seq 70, dpid: 0x04, type: 0x02, length: 4, val: 100 13:34:50:950 TY_DATA_REPORT: seq 70, dpid: 0x04, type: 0x02, length: 4, val: 100 13:34:51:170 TY_DATA_REPORT: seq 71, dpid: 0x09, type: 0x04, length: 1, val: 2 13:34:51:172 TY_DATA_REPORT: seq 71, dpid: 0x09, type: 0x04, length: 1, val: 2 13:34:51:407 TY_DATA_REPORT: seq 72, dpid: 0x0A, type: 0x04, length: 1, val: 0 13:34:51:409 TY_DATA_REPORT: seq 72, dpid: 0x0A, type: 0x04, length: 1, val: 0

edit:

For exemple on logs

21:59:14:246 TY_DATA_REPORT: seq 61, dpid: 0x01, type: 0x04, length: 1, val: 1

this one need to switch from 1 to 0 according to presence.

I guess this one was successful.

llugo avatar Oct 16 '22 11:10 llugo

Still missing the config/battery Can you make a "hot reload" in the DDF editor, or re-include the device (without deleting, like that all will be invisible)

13:34:42:388 TY_DATA_REPORT: seq 66, dpid: 0x0C, type: 0x02, length: 4, val: 1000

So the value is 1000 If I make a similutation need to have lux = 1000 lightlevel = 30001

Why you have 0 as value ? It was working previously https://github.com/dresden-elektronik/deconz-rest-plugin/issues/6158#issuecomment-1206440580

What is your deconz version ?

13:34:50:457 TY_DATA_REPORT: seq 68, dpid: 0x01, type: 0x04, length: 1, val: 0

And you never have 1 as val for this debug line ? (It's the presence detection)

Smanar avatar Oct 16 '22 11:10 Smanar

Still missing the config/battery Can you make a "hot reload" in the DDF editor, or re-include the device (without deleting, like that all will be invisible)

When viewing the preview in the ddf editor after opening the ddf and doing a hot-reload the lines concerning battery won't show up. I'm probalbly missing something here.

Why you have 0 as value ? It was working previously https://github.com/dresden-elektronik/deconz-rest-plugin/issues/6158#issuecomment-1206440580

That was a post by Tscheurgen

What is your deconz version ?

v.2.18.2

And you never have 1 as val for this debug line ? (It's the presence detection)

Just got this:

14:47:27:098 TY_DATA_REPORT: seq 133, dpid: 0x01, type: 0x04, length: 1, val: 1

llugo avatar Oct 16 '22 12:10 llugo

When viewing the preview in the ddf editor after opening the ddf and doing a hot-reload the lines concerning battery won't show up. I'm probalbly missing something here.

You are using HA ?

That was a post by Tscheurgen

Yep but he was using the same DDF, with reversed DP

Just got this: 4:47:27:098 TY_DATA_REPORT: seq 133, dpid: 0x01, type: 0x04, length: 1, val: 1

Ha nice ^^ So it mean the presence is working ? If I m right you have


TY_DATA_REPORT: seq 133, dpid: 0x01, type: 0x04, length: 1, val: 1
a4:c1:38:01:13:e6:33:1f-01-0400/state/presence expression: Item.val = Attr.val == 1; --> true

and

TY_DATA_REPORT: seq 133, dpid: 0x01, type: 0x04, length: 1, val: 0
a4:c1:38:01:13:e6:33:1f-01-0400/state/presence expression: Item.val = Attr.val == 1; --> false

Smanar avatar Oct 16 '22 17:10 Smanar

When viewing the preview in the ddf editor after opening the ddf and doing a hot-reload the lines concerning battery won't show up. I'm probalbly missing something here.

Something went wrong when adding your last modified DDF. I fixed it now and battery is showing up now.

You are using HA ?

No i'm only using Phoscon (and Postman for REST API calls).

So it mean the presence is working ? If I m right you have [...]

Yes ~~, but it only shows 'true' right after i trigger it by getting it out of a closet. After that it goes back to 'false' while still lying right beside me~~.

edit: i guess it would help to learn how the presence detector works physically within the device

llugo avatar Oct 17 '22 21:10 llugo

edit: i guess it would help to learn how the presence detector works physically within the device

I m not sure to understand. It's a presence sensor, so it detect a presence and stay true during a periode after a detection (if there is a new detection, the timer restart)

Smanar avatar Oct 18 '22 15:10 Smanar

... the timer restart)

I wonder what the timer is set to.

This is me getting into the room i've left 5 min ago:

19:51:29:060 TY_DATA_REPORT: seq 73, dpid: 0x0C, type: 0x02, length: 4, val: 112 19:51:43:642 a4:c1:38:01:13:e6:33:1f-01-0400/state/lux expression: const tholddark = R.item('config/tholddark').val; const tholdoffset = R.item('config/tholdoffset').val; const lux = Attr.val; let ll = 0; if (lux > 0 && lux < 0xffff) { ll = Math.round(10000 * Utils.log10(lux) + 1); } R.item('state/lightlevel').val = ll; R.item('state/dark').val = ll <= tholddark; R.item('state/daylight').val = ll >= tholddark + tholdoffset;

Opening the laptop, so lux increases:

Item.val = lux; --> 136 19:51:43:650 TY_DATA_REPORT: seq 74, dpid: 0x0C, type: 0x02, length: 4, val: 136 19:51:43:652 TY_DATA_REPORT: seq 74, dpid: 0x0C, type: 0x02, length: 4, val: 136 19:51:43:654 TY_DATA_REPORT: seq 74, dpid: 0x0C, type: 0x02, length: 4, val: 136 19:51:43:937 TY_DATA_REPORT: seq 75, dpid: 0x01, type: 0x04, length: 1, val: 1 19:51:43:958 a4:c1:38:01:13:e6:33:1f-01-0400/state/presence expression: Item.val = Attr.val == 1; --> true 19:51:43:960 TY_DATA_REPORT: seq 75, dpid: 0x01, type: 0x04, length: 1, val: 1 19:51:43:961 TY_DATA_REPORT: seq 75, dpid: 0x01, type: 0x04, length: 1, val: 1

Presence gets set to false merely 5 sec later

19:51:48:930 TY_DATA_REPORT: seq 76, dpid: 0x01, type: 0x04, length: 1, val: 0 19:51:48:959 a4:c1:38:01:13:e6:33:1f-01-0400/state/presence expression: Item.val = Attr.val == 1; --> false 19:51:48:962 TY_DATA_REPORT: seq 76, dpid: 0x01, type: 0x04, length: 1, val: 0 19:51:48:964 TY_DATA_REPORT: seq 76, dpid: 0x01, type: 0x04, length: 1, val: 0

edit: Now i got an even faster switch:

20:00:48:251 TY_DATA_REPORT: seq 44, dpid: 0x0C, type: 0x02, length: 4, val: 136 20:00:48:253 TY_DATA_REPORT: seq 44, dpid: 0x0C, type: 0x02, length: 4, val: 136 20:00:48:543 TY_DATA_REPORT: seq 45, dpid: 0x01, type: 0x04, length: 1, val: 1 20:00:48:564 a4:c1:38:01:13:e6:33:1f-01-0400/state/presence expression: Item.val = Attr.val == 1; --> true 20:00:48:566 TY_DATA_REPORT: seq 45, dpid: 0x01, type: 0x04, length: 1, val: 1 20:00:48:567 TY_DATA_REPORT: seq 45, dpid: 0x01, type: 0x04, length: 1, val: 1 20:00:48:865 TY_DATA_REPORT: seq 46, dpid: 0x01, type: 0x04, length: 1, val: 0 20:00:48:885 a4:c1:38:01:13:e6:33:1f-01-0400/state/presence expression: Item.val = Attr.val == 1; --> false 20:00:48:887 TY_DATA_REPORT: seq 46, dpid: 0x01, type: 0x04, length: 1, val: 0 20:00:48:888 TY_DATA_REPORT: seq 46, dpid: 0x01, type: 0x04, length: 1, val: 0

llugo avatar Oct 18 '22 17:10 llugo

The timer is the dp 10.

21:58:55:679 TY_DATA_REPORT: seq 58, dpid: 0x0A, type: 0x04, length: 1, val: 0

If I have understand 0 -> 10s 1 -> 30s 2 -> 60s 3 -> 120s

20:00:48:564 a4:c1:38:01:13:e6:33:1f-01-0400/state/presence expression: Item.val = Attr.val == 1; --> true 20:00:48:885 a4:c1:38:01:13:e6:33:1f-01-0400/state/presence expression: Item.val = Attr.val == 1; --> false

Hu, right, relay too fast to go from true to false (nned to be at least 10s for your setting) , I have not reversed them ?

Edit:

Presence gets set to false merely 5 sec later

So Yes I think I have reversed them again ^^ try

"eval": "Item.val = Attr.val == 0;"

For the state/presence.

Smanar avatar Oct 18 '22 19:10 Smanar

hrm, i cannot make any sense of it 🤷

now with reversed attr.val

22:04:37:279 TY_DATA_REPORT: seq 88, dpid: 0x0C, type: 0x02, length: 4, val: 90 22:04:37:280 TY_DATA_REPORT: seq 88, dpid: 0x0C, type: 0x02, length: 4, val: 90 22:04:37:281 TY_DATA_REPORT: seq 88, dpid: 0x0C, type: 0x02, length: 4, val: 90 22:04:37:569 TY_DATA_REPORT: seq 89, dpid: 0x01, type: 0x04, length: 1, val: 1 22:04:37:596 a4:c1:38:01:13:e6:33:1f-01-0400/state/presence expression: Item.val = Attr.val == 0; --> false 22:04:37:598 TY_DATA_REPORT: seq 89, dpid: 0x01, type: 0x04, length: 1, val: 1 22:04:37:599 TY_DATA_REPORT: seq 89, dpid: 0x01, type: 0x04, length: 1, val: 1 22:04:41:180 TY_DATA_REPORT: seq 90, dpid: 0x01, type: 0x04, length: 1, val: 0 22:04:41:207 a4:c1:38:01:13:e6:33:1f-01-0400/state/presence expression: Item.val = Attr.val == 0; --> true 22:04:41:209 TY_DATA_REPORT: seq 90, dpid: 0x01, type: 0x04, length: 1, val: 0 22:04:41:210 TY_DATA_REPORT: seq 90, dpid: 0x01, type: 0x04, length: 1, val: 0

llugo avatar Oct 18 '22 20:10 llugo