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

Lightsensor Luxmeter Zigbee Tuya

Open ProductEigel opened this issue 2 years ago • 50 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

Lightsensor Luxmeter Zigbee Tuya

Manufacturer

_TZE200_khx7nnka

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

ProductEigel avatar Dec 22 '23 13:12 ProductEigel

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 Jan 13 '24 01:01 github-actions[bot]

Noch nicht gelöst

ProductEigel avatar Jan 15 '24 08:01 ProductEigel

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]

Noch nicht gelöst

ProductEigel avatar Feb 07 '24 06:02 ProductEigel

@Smanar can you help out :)?

Mimiix avatar Feb 07 '24 17:02 Mimiix

Hello

{
  "schema": "devcap1.schema.json",
  "manufacturername": ["_TZE200_khx7nnka", "_TZE200_yi4jtqq1"],
  "modelid": ["TS0601", "TS0601"],
  "product": "Tuya Lightsensor Luxmeter",
  "sleeper": false,
  "status": "Gold",
  "subdevices": [
    {
      "type": "$TYPE_LIGHT_LEVEL_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0xEF00"
      ],
      "items": [
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion",
          "read": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 1,
            "fn": "zcl:attr"
          },
          "parse": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 1,
            "fn": "zcl:attr",
            "script": "tuya_swversion.js"
          }
        },
        {
          "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": 2,
            "script": "../generic/illuminance_cluster/lux_to_lightlevel.js",
            "fn": "tuya"
          },
          "default": 0
        }
      ]
    }
  ]
}

Just some remark: This device is powered ? because it seem it can work as router ? Have set the "sleeper" mode to false. To work this DDF NEED to be in the devices/tuya folder, because of relative path "script": "../generic/illuminance_cluster/lux_to_lightlevel.js", if you are on docker, you can edit the path and copy too the file lux_to_lightlevel.js in the same folder

Smanar avatar Feb 07 '24 18:02 Smanar

@Smanar

image

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

doens't work...

image

ProductEigel avatar Feb 15 '24 16:02 ProductEigel

i've tested also with a complett path, also with "/opt/deCONZ/devices/tuya/lux_to_lightlevel.js" or "/opt/deCONZ/devices/lux_to_lightlevel.js" or "/opt/deCONZ/lux_to_lightlevel.js"

I've tested with removing and also with connected, docker also restartet after change the script

ProductEigel avatar Feb 15 '24 16:02 ProductEigel

okay, I have found the error. The file must be called json not js

ProductEigel avatar Feb 15 '24 17:02 ProductEigel

You are using the official docker image ?

So when you make "ls -la" we need to see the *.js file (the script) and the *.json (the DDF) ? And if both files are here you can just use

"script": "lux_to_lightlevel.js",

Smanar avatar Feb 15 '24 17:02 Smanar

image but now the "lux" wont changed ....

it calls also Temperaturregler?

ProductEigel avatar Feb 15 '24 17:02 ProductEigel

@Smanar my mistake, I had named the DDF file "lux_to_lightlevel.js" :D and not after the device. I have now adjusted this so that there is no confusion. And yes I use the official Docker image, I just haven't found the "lux_to_lightlevel.js" yet and don't know the path either. I am an absolute newcomer to Deconz.

ProductEigel avatar Feb 15 '24 20:02 ProductEigel

@Smanar so I stole the "lux_to_lightlevel.js" and "tuya_swversion.js" from a Windows installation, but the device is still listed as a temperature controller and the display does not work. It always remains at 0 lux.

ProductEigel avatar Feb 15 '24 20:02 ProductEigel

the device is still listed as a temperature controller

This is strange, can you take a look direclty in the API ? usig phoscon/help/API Information/sensors.

It always remains at 0 lux

To make test without script can you use instead

        {
          "name": "state/lux",
          "read": {
            "fn": "none"
          },
          "parse": {
            "dpid": 2,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 0
        }

You will need to restart deconz after the change (no need to re-include the device)

Smanar avatar Feb 16 '24 14:02 Smanar

{ "config": { "on": true, "reachable": true, "tholddark": 12000, "tholdoffset": 7000 }, "etag": "06e57be68d9573ef96c4ed74dc4527e4", "lastannounced": null, "lastseen": "2024-02-16T19:11Z", "manufacturername": "_TZE200_khx7nnka", "modelid": "TS0601", "name": "Lichtsensor", "state": { "dark": false, "daylight": false, "lastupdated": "2024-02-16T19:11:45.128", "lightlevel": 0, "lux": 3 }, "swversion": "1.0.6", "type": "ZHALightLevel", "uniqueid": "a4:c1:38:66:cf:78:e4:b0-01-ef00" }

ProductEigel avatar Feb 16 '24 19:02 ProductEigel

and Events:

{ "20:11:45:161": { "e": "changed", "id": "35", "r": "sensors", "state": { "dark": false, "daylight": false, "lastupdated": "2024-02-16T19:11:45.128", "lightlevel": 0, "lux": 3 }, "t": "event", "uniqueid": "a4:c1:38:66:cf:78:e4:b0-01-ef00" }, "20:11:59:706": { "e": "changed", "id": "35", "r": "sensors", "state": { "dark": false, "daylight": false, "lastupdated": "2024-02-16T19:11:59.656", "lightlevel": 0, "lux": 3 }, "t": "event", "uniqueid": "a4:c1:38:66:cf:78:e4:b0-01-ef00" }, "20:12:14:253": { "attr": { "id": "35", "lastannounced": null, "lastseen": "2024-02-16T19:12Z", "manufacturername": "_TZE200_khx7nnka", "mode": 1, "modelid": "TS0601", "name": "Lichtsensor", "swversion": "1.0.6", "type": "ZHALightLevel", "uniqueid": "a4:c1:38:66:cf:78:e4:b0-01-ef00" }, "e": "changed", "id": "35", "r": "sensors", "t": "event", "uniqueid": "a4:c1:38:66:cf:78:e4:b0-01-ef00" }, "20:12:14:256": { "e": "changed", "id": "35", "r": "sensors", "state": { "dark": false, "daylight": false, "lastupdated": "2024-02-16T19:12:14.185", "lightlevel": 0, "lux": 3 }, "t": "event", "uniqueid": "a4:c1:38:66:cf:78:e4:b0-01-ef00" }, "20:12:28:787": { "e": "changed", "id": "35", "r": "sensors", "state": { "dark": false, "daylight": false, "lastupdated": "2024-02-16T19:12:28.713", "lightlevel": 0, "lux": 3 }, "t": "event", "uniqueid": "a4:c1:38:66:cf:78:e4:b0-01-ef00" }, "20:12:43:231": { "e": "changed", "id": "35", "r": "sensors", "state": { "dark": false, "daylight": false, "lastupdated": "2024-02-16T19:12:43.241", "lightlevel": 0, "lux": 3 }, "t": "event", "uniqueid": "a4:c1:38:66:cf:78:e4:b0-01-ef00" } }

ProductEigel avatar Feb 16 '24 19:02 ProductEigel

image

ProductEigel avatar Feb 16 '24 19:02 ProductEigel

@Smanar I had adjusted the DDF, but without result, the light is on, so it cannot be 0 lux

ProductEigel avatar Feb 16 '24 19:02 ProductEigel

@Smanar okay all commands back, it reacts now, although in my opinion with too little, it is displayed at full light 37Lux

ProductEigel avatar Feb 16 '24 19:02 ProductEigel

@Smanar thank you very much for your support :) the ticket can be closed :) have a nice weekend everyone ;)

ProductEigel avatar Feb 16 '24 19:02 ProductEigel

Lol, you was too fast for me. On my last try the DDF just take a raw value and display it at lux and no more, so nothing in state/lightlevel for exemple.

Smanar avatar Feb 17 '24 08:02 Smanar

Hello @Smanar , can we reopen the ticket ? I've two off this sensor and still see as a plug...

Idaho947 avatar Apr 24 '24 12:04 Idaho947

It's same manufacture name ? _TZE200_khx7nnka Else better to open a new issue, or just add the new manufactureName at previous DDF to test if there are clone.

Smanar avatar Apr 24 '24 15:04 Smanar

yes, it's exactly the same. As the ddf isn't in a stable version and in view of your last message, I thought the integration wasn't complete.

Idaho947 avatar Apr 24 '24 16:04 Idaho947

Oups sorry, my bad, have forget this device. Give me 5mn to restart from clean DDF

Smanar avatar Apr 24 '24 16:04 Smanar

So have checked again, the first one need to work, it's a raw value for lux that can be converted for other field


{
  "schema": "devcap1.schema.json",
  "manufacturername": ["_TZE200_khx7nnka", "_TZE200_yi4jtqq1"],
  "modelid": ["TS0601", "TS0601"],
  "product": "Tuya Lightsensor Luxmeter",
  "sleeper": false,
  "status": "Gold",
  "subdevices": [
    {
      "type": "$TYPE_LIGHT_LEVEL_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0xEF00"
      ],
      "items": [
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion",
          "read": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 1,
            "fn": "zcl:attr"
          },
          "parse": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 1,
            "fn": "zcl:attr",
            "script": "tuya_swversion.js"
          }
        },
        {
          "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": 2,
            "script": "../generic/illuminance_cluster/lux_to_lightlevel.js",
            "fn": "tuya"
          },
          "default": 0
        }
      ]
    }
  ]
}

With same requirement

To work this DDF NEED to be in the devices/tuya folder, because of relative path "script": "../generic/illuminance_cluster/lux_to_lightlevel.js", if you are on docker, you can edit the path and copy too the file lux_to_lightlevel.js in the same folder

On his last try was just a "hack" to test code", so not good values.

Smanar avatar Apr 24 '24 16:04 Smanar

Yes everything is fine ! It works perfectly. Now I have to find how to turn of the bluelight...

Idaho947 avatar Apr 24 '24 16:04 Idaho947

Wana make the DDF or want I make it ?

turn of the bluelight

On the device ? I don't see something about that on this device ...

Smanar avatar Apr 24 '24 18:04 Smanar

Yes... I put a scotch tape on it 😋

Idaho947 avatar Apr 25 '24 05:04 Idaho947

Lool, I was searching zigbee features, there is guys doing same at my work for alarm "indicator light".

BTW do you want to submit the DDF, to have it officialy ?

Smanar avatar Apr 25 '24 16:04 Smanar