dresden-elektronik / deconz-rest-plugin

deCONZ REST-API plugin to control ZigBee devices
BSD 3-Clause "New" or "Revised" License
1.89k stars 498 forks source link

Tuya Temp/Humi Sensor with Screen TS0601 #6063

Closed Ltek closed 1 year ago

Ltek commented 2 years ago

This looks like a common Tuya sensor, with screen, under multiple different 'brands' and different shells/cases. Anyone had a DDF for it? thx

Screenshots of what I have is included.

screenshots...

ConbeeTS0601_node ConbeeTS0601_ClusterEF00 ConbeeTS0601_Cluster0402 ConbeeTS0601_Cluster0001 Capture_ConbeeTS0601_basic

Mimiix commented 2 years ago

Please add all sccreenshots in this post (not external link).

And make sure to stick with the template.

Smanar commented 2 years ago

BTW this device have Humidity/temperature cluster AND the tuya cluster.

From that I m reading on Z2m only the tuya cluster is working, but can't be sure. So it s probably the same working mode than this one https://github.com/dresden-elektronik/deconz-rest-plugin/issues/5927

Can try this DDF

{
  "schema": "devcap1.schema.json",
  "manufacturername": "_TZE200_qoy0ekbd",
  "modelid": "TS0601",
  "product": "TS0601",
  "sleeper": true,
  "status": "Gold",
  "subdevices": [
    {
      "type": "$TYPE_HUMIDITY_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x0405"
      ],
      "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/offset",
          "description": "Relative offset to the main measured value.",
          "default": 0
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/humidity",
          "description": "The current relative humidity in percent.",
          "parse": {"fn": "tuya", "dpid": 2, "eval": "Item.val = Attr.val;" },
          "read": {"fn": "tuya"},
          "default": 0
        },
        {
          "name": "state/lastupdated"
        }
      ]
    },
    {
      "type": "$TYPE_TEMPERATURE_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x0402"
      ],
      "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/offset",
          "description": "Relative offset to the main measured value.",
          "default": 0
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/temperature",
          "parse": {"fn": "tuya", "dpid": 1, "eval": "Item.val = Attr.val;" },
          "read": {"fn": "none"},
          "default": 0
        }
      ]
    }
  ]
}

Oups, and still need captures, sorry.

Ltek commented 2 years ago

@Smanar thx for the help. I created JSON the using Windows Notepad and put in the folder… C:\Program Files (x86)\deCONZ\devices\tuya

But while its showing in deCONZ UI, its not showing in Phoscon?

Mimiix commented 2 years ago

@Smanar we require screenshots for a reason. Please only proceed when they are correctly attached.

Ltek commented 2 years ago

@Smanar we require screenshots for a reason. Please only proceed when they are correctly attached.

attached to first post. thx for the help

Smanar commented 2 years ago

How look the node on top of your capture, the name is something like "0xXXXX" or something like "temperature 10" ? When you make "edit DDF" on the editor title you can see the file path of the DDF ? Nothing more if you select "hot reload" in the menu ?

Can you make a "Hot reload" but with enabling debug flag " info" and "info_l2" (logs are in help / debug view)

Ltek commented 2 years ago

How look the node on top of your capture, the name is something like "0xXXXX" or something like "temperature 10" ? When you make "edit DDF" on the editor title you can see the file path of the DDF ? Nothing more if you select "hot reload" in the menu ?

Can you make a "Hot reload" but with enabling debug flag " info" and "info_l2" (logs are in help / debug view)

Attached Debug with 'hot reload'

all 3 devices I paired - multiple times (one TS0201 & two TS0601) node are named "0xXXXX" ... of course, the prior 20+ devices which worked fine have real word names as you pointed out. screenshot attached (I removed/paired them again last night)

Capture Debug.txt

Smanar commented 2 years ago

(one TS0201 & two TS0601)

The code can work only on this one

  "manufacturername": "_TZE200_qoy0ekbd",
  "modelid": "TS0601",

11:32:18:038 DEV found DDF for 0xA4C13889735D4D20, path: C:/Program Files (x86)/deCONZ/devices/tuya/_TZ3000_yd2e749y.json

This device is not the same one (if the device is realy a _TZ3000_yd2e749y), but I don't see why the DDF is not used for this one, perhaps with flags "error" and "error _l2"

  "manufacturername": "_TZ3000_yd2e749y",
  "modelid": "TS0201",

There is already a DDF for this one that need to work, and no the same file name too https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/devices/tuya/_TZ3000_yd2e749y_temp_hum_sensor.json

Ltek commented 2 years ago

Please see the screenshot, you can see all the DDFs (attached) in the Tuya folder. Are both devices (TS0201 and TS0601) using the wrong DDF the one that comes in the install, not the ones associated with proper manufacturer name?

Conbee_TuyaFolder

_TZE200_qoy0ekbd.json.txt _TZ3000_yd2e749y.json.txt ?

Ltek commented 2 years ago

Debug file attached for hot reload of the TS0201 using Error logging Debug.txt

Smanar commented 2 years ago

You have phoscon in permit join when you make your tests ? "add new sensor" ? As the device is not included at all, have you try to make a new inclusion now the DDF is loaded ?

Ltek commented 2 years ago

You have phoscon in permit join when you make your tests? "add new sensor" ? As the device is not included at all, have you try to make a new inclusion now the DDF is loaded ?

I use Phoscon to add the sensor -- and it adds to deCONZ, thats the only way I know how to add it. I dont understand you comment..."device is not included at all". How is it not 'included' if it shows up in deCONZ?

I think we are seeing a bug...

I have 3 devices (2 different models) currently paired: one TZE200_qoy0ekbd and two TZ3000_yd2e749y

both correct DDFs are in the Tuya folder

BUT... ALL 3 devices ONLY use the _TZ3000_yd2e749y.json --- two of the devices should be using _TZE200_qoy0ekbd.json, but they do not

If I remove the _TZ3000_yd2e749y.json from the folder (_TZE200_qoy0ekbd.json still in the folder)... NONE of the devices pull in _TZE200_qoy0ekbd.json even though 2 of the currently paired devices match that manufacture.

Smanar commented 2 years ago

Perhaps a typo in the DDF, I will check on others zigbee project, easier with copy paste than looking in a picture ^^ But I don't understand why all 3 are using the same DDF

You can see DEV found DDF for device_mac_adress, path: C:/Program Files (x86)/deCONZ/devices/tuya/_TZ3000_yd2e749y.json

For all 3 devices ?

I dont understand you comment..."device is not included at all". How is it not 'included' if it shows up in deCONZ?

Deconz include all zigbee devices, it s a zigbee application. But inluded in deconz, don't mean included in the API. When the device have the name 0xXXXX, it s the zigbee network adress, mean the device is included in the zigbee network. When the API reconise it it use a "API friendly name" like temperature 7. And when making a "hot reload" it just update the API, so I think it do nothing if the device is not already in the API, it s for that I ask you if you have tried to re-include it with all DDF in place.

Edit: So for the _TZ3000_yd2e749y I can't find it on other zigbee project but have checked again the picture and seem ok https://github.com/dresden-elektronik/deconz-rest-plugin/issues/6034 The second one have same model id and manufacture name on other zigbee project.

Can you share a log when rying to include one of the not working device ? with "info", "info_l2" and "ddf" ?

Ltek commented 2 years ago

I removed the devices and re-paired one of each device model... They each seem to be grabbing the correct DDF now. BUT they are still showing the 0xXXXX name style.

Any way to turn on debug during deCONZ load? Would be nice since there is not clear button on Debug window (really need one). Its a lot more text to copy since it even persists across close/open of the window.

Smanar commented 2 years ago

They each seem to be grabbing the correct DDF now. BUT they are still showing the 0xXXXX name style

Mean they are not reconised by deconz, even with DDF ...

You can send logs to a file too, but need to run deconz with command line. I just need logs during the pairing so

You can too just take a look yourself and copy paster only the part you found usefull.

You can try just with only "error" and "error_l2", just to take a look, no need to copy/paste.

Ltek commented 2 years ago

I removed both sensors and re-paired them. The DDFs were in the Tuya folder at the same time. Debug log attached DEBUG.txt

Smanar commented 2 years ago

Both are reconised this time


15:47:35:395 DEV found DDF for 0xA4C1380395605A60, path: C:/Program Files (x86)/deCONZ/devices/tuya/_TZE200_qoy0ekbd.json
10:15:33:056 DEV found DDF for 0xA4C13889735D4D20, path: C:/Program Files (x86)/deCONZ/devices/tuya/_TZ3000_yd2e749y.json

both have made announce

15:49:17:297 device announce 0xA4C13889735D4D20 (0x83F5) mac capabilities 0x80
15:46:43:422 device announce 0xA4C1380395605A60 (0x4E2E) mac capabilities 0x80

And the 0xa4c1380395605a60 have start a complete inclusion procedure, but was not included ...

I will ask others devs for tips because all seem fine. The device have make a rejoin just after the last step on the inclusion procedure, you have make 2 times the reset ?

And if you try only with "error" and "error_l2" nothing special ?

Smanar commented 2 years ago

@Ltek sorry what is your deconz version ?

Ltek commented 2 years ago

@Ltek sorry what is your deconz version ?

I was on 2.15.3 and then tried 2.16.0 beta...went back to 15.3

The device have make a rejoin just after the last step on the inclusion procedure, you have make 2 times the reset ?

Not sure what you are asking. I have deleted and re-paired these devices many times (at least 5 or 6 times each device)

I removed and re-paired the TS0201, there's the DDF & Error debug...

16:28:26:954 void zmController::onApsdeDataIndication(const deCONZ::ApsDataIndication&),3950: assertion 'node' failed 16:28:27:788 a4:c1:38:89:73:5d:4d:20/attr/manufacturername expression: Item.val = Attr.val --> _TZ3000_yd2e749y 16:28:28:685 a4:c1:38:89:73:5d:4d:20/attr/modelid expression: Item.val = Attr.val --> TS0201

then I did a Hot Reload on it... 16:30:36:921 update ddf TS0201 index 66

Smanar commented 2 years ago

Not sure what you are asking. I have deleted and re-paired these devices many times (at least 5 or 6 times each device)

The inclusion procedure take lot of step

15:46:44:407 [1] get node descriptor for 0xa4c1380395605a60
15:48:54:238 [2] get active endpoints for 0xa4c1380395605a60
15:47:08:900 [3] get simple descriptor 0x01 for 0xa4c1380395605a60
15:47:10:736 [4.1] Get manufacturer code
15:47:10:736 [4.2] get basic cluster attr 0x0004 for 0xa4c1380395605a60

And it the last step, the next one is the addition in the database, but instead we can see the device join again, but with a new network id,

I was on 2.15.3 and then tried 2.16.0 beta...went back to 15.3

You have issue with it ? Because you miss some improvement

Can't make a fast try with this version ?

Ltek commented 2 years ago

I was on 2.15.3 and then tried 2.16.0 beta...went back to 15.3

You have issue with it ? Because you miss some improvement

  • Fix processing rules referencing DDF devices
  • Improve loading DDF sensor data from legacy DB tables
  • Improve detection NWK address changes and ZDP discovery

Can't make a fast try with this version ?

Yes... 16.0 -- usually requires two tries (device resets) to pair -- does not pull in all the data -- does not associate the DDF ever -- after reboot (restart deCONZ) ALL cluster information is gone, the device still shows on the UI ---- does not read the device at all even when using Read button: no Error or DDF in debug log at all.

15.3 -- pairs on first try, appears in UI in 2 or 3 seconds -- pulls in more data from device on pairing -- associates the DDF immediately ---- installed 15.3 directly over 16.0, deleted the device and re-paired... worked paired immediately, pulling in all info, and associated with DDF (Debug_15.3_pair log attached)

DEBUG_16.0beta.txt DEBUG_15.3pair.txt

Mimiix commented 2 years ago

Asked @manup to check in.

Ltek commented 2 years ago

@manup any ideas on this? I cant imagine these are different internally than any of the other Tuya devices?

Ltek commented 2 years ago

@manup -- I tried 2.16.1 and its the same as 15.3 ... adds the devices but not adding them properly so Phoscon shows them

Mimiix commented 2 years ago

Phoscon won't show them in the first place as it needs seperate support. The rest api should.

I've asked manup again to check

manup commented 2 years ago

Hmm the temperature and humidity sensors should be shown generically in the Phoscon App when it's in the REST-API. Do you see the respective sensors in the API information tool?

"Phoscon App > Menu > Help > API Information > Sensors"

Is there a product page or Amazon link for this sensor?

Ltek commented 2 years ago

I've added and removed them at least 20 times each (and tried different physical devices, I have 6 of them). Neither sensor model shows in Phoscon -- I attached the Phoscon info you asked for.

links to both models... https://www.aliexpress.com/item/3256802176456322.html https://www.aliexpress.com/item/3256803451172448.html

Phoscon_API_Sensors.txt

Ltek commented 2 years ago

@manup ?

Mimiix commented 2 years ago

@Ltek you can't expect an reply within an day, especially in the weekend 😅

Ltek commented 2 years ago

I'm sure he's busy. I'm just bumping it, it has been 2 days, not 1 ;-) I'm eager to get it done, its been 2 weeks since I posted and I feel like I'm banging my head against a wall without progress. Thanks for the help!

manup commented 2 years ago

The logs show that the sensor resources aren't created, which is the reason the Phoscon App won't show anything and the deCONZ gui shows only the device address as name.

To check if a device picks the right DDF you can select the device in the GUI and press Ctrl+E (or context menu > Edit DDF), but I'd expect it will only show a Draft DDF?

Ltek commented 2 years ago

The logs show that the sensor resources aren't created, which is the reason the Phoscon App won't show anything and the deCONZ gui shows only the device address as name.

To check if a device picks the right DDF you can select the device in the GUI and press Ctrl+E (or context menu > Edit DDF), but I'd expect it will only show a Draft DDF?

Each model correctly matches to the proper DDF. I can see the DDFs in the UI and a Hot Reload doesn't change that, still correct DDF.

I removed all those devices and just tested again on 1.16.1... screenshot attached

I use Phoscon to initiate the 'add new sensor' but while deCONZ adds it, oddly, Phoscon times out and says it failed to add a sensor. LMK if you need log or to remote in. thx!

Capture

Ltek commented 2 years ago

@manup ... more testing, still failures...

I had to reboot the PC and found the DDF did not load on restart. (ver 16.1 installed) I installed15.3 over the top of 16.1 = DDF did not load. Did a hot reload and it loaded the DDF properly. I installed16.1 over the top of 15.3 = DDF did not load. Did a hot reload and it loaded the DDF properly.

So looks like on 15.3, 16.0, and 16.1 it loads the DDF on the initial pairing, loses the DDF on a restart, loads the DDF on Hot Reload. In no case does it ever show in Phoscon.

manup commented 2 years ago

Interesting, looking at the screenshot there are these duplicates which shouldn't be there, might be related to the problem seen in https://github.com/dresden-elektronik/deconz-rest-plugin/issues/5974#issuecomment-1145983104 On Linux this would be indicated if the /usr/share/deCONZ/devices directory contains more files/directories than it should. This is fixed and cleaned up in the upcoming version.

Ltek commented 2 years ago

Interesting, looking at the screenshot there are these duplicates which shouldn't be there, might be related to the problem seen in #5974 (comment) On Linux this would be indicated if the /usr/share/deCONZ/devices directory contains more files/directories than it should. This is fixed and cleaned up in the upcoming version.

I'll test and report back when the beta is posted. thx

Ltek commented 2 years ago

@manup I tested .17 beta and it does not load the DDF ... when device is added new, or with Hot Reload.

this is what the Devices folders looks like... image image

Smanar commented 2 years ago

or with Hot Reload

Mean you have done a "edit DDF" and it have open the editor with a DDF ? Or you have tried to make a new one ? (Or was an empty DDF ?)

Your device is the "_TZE200_qoy0ekbd" ? There is a DDF in your capture for it ?

Ltek commented 2 years ago

or with Hot Reload

Mean you have done a "edit DDF" and it have open the editor with a DDF ? Or you have tried to make a new one ? (Or was an empty DDF ?)

Your device is the "_TZE200_qoy0ekbd" ? There is a DDF in your capture for it ?

Please see the screenshots I posted 12 days ago. The device is the _TZ3000_yd2e749y (not TZE200_qoy0ekbd) and you can see in 16.1 & 15.3 it pulls in the DDF just fine on initial pair or hot load, but not ever on reboot..

Yes I have opened the Edit DDF function, that is how I see the DDF is not loaded at all on 17. Why would i make a new one if it loads fine in 15.3 & 16.1?

@manup there seems to be several bugs in 15.3 & 16.1 ... and a new one in 17.x stopping it from loading at all.

Ltek commented 2 years ago

@manup any ideas?

manup commented 2 years ago

Sorry missed that one. Does your DDF editor still show these duplicated entries with v2.17.0-beta?

If yes we need to check the folders containing everything as expected, the installer in v2.17.0 should already force a clean installation of the /devices folder but maybe there's another issue :thinking:

Ltek commented 2 years ago

Sorry missed that one. Does your DDF editor still show these duplicated entries with v2.17.0-beta?

If yes we need to check the folders containing everything as expected, the installer in v2.17.0 should already force a clean installation of the /devices folder but maybe there's another issue 🤔

What duplicate entries - .17's DDF editor for that device is 100% blank. My prior post provided screenshots of the folders and also explains...

Please see the screenshots I posted 12 days ago. The device is the _TZ3000_yd2e749y (not TZE200_qoy0ekbd) and you can see in 16.1 & 15.3 it pulls in the DDF just fine on initial pair or hot load, but not ever on reboot..

Yes I have opened the Edit DDF function, that is how I see the DDF is not loaded at all on 17. Why would i make a new one if it loads fine in 15.3 & 16.1?

@manup there seems to be several bugs in 15.3 & 16.1 ... and a new one in 17.x stopping it from loading at all.
manup commented 2 years ago

image

The duplicates in your screenshot are in the available items list on the right, it shouldn't look like this as it indicates something wrong with the /devices folder.

Here is an example how it should look like:

image

Ltek commented 2 years ago

@manup As I mentioned .. .17's DDF editor for that device is 100% Empty -- Is it Not Loading the DDF At All -- ever Capture

manup commented 2 years ago

It looks like it doesn't load any DDF relates files, I have no clue why currently. Would you be open for a Teamviewer session so I can check live whats going on, and have a look that the files/directories are correct?

Perhaps on Monday?

Ltek commented 2 years ago

It looks like it doesn't load any DDF relates files, I have no clue why currently. Would you be open for a Teamviewer session so I can check live whats going on, and have a look that the files/directories are correct?

Perhaps on Monday?

Yes for sure... I'd love to get these sensors working! I tried to PM you but there is no option to do that on your profile. LMK

Ltek commented 2 years ago

@manup How do you want to arrange this?

Mimiix commented 2 years ago

Ping him on discord :)

manup commented 2 years ago

Damn almost 8 o'clock, time flies during coding :D

You can ping me either on Discord or via mail to mpi@dresden-elektronik.de

Ltek commented 2 years ago

@manup lmk when you want to look at the Tuya device again. I'm posting the new DDF for the other, non screen device

this is the one still not workin...

Product name: Tuya Temperature and Humidity Sensor with Screen Manufacturer: _TZE200_qoy0ekbd Model identifier: TS0601

manup commented 2 years ago

Hi, yes the current DDFs would be helpful If I remember correctly the one with screen joined the network but did stop communication after a short while, so perhaps some Tuya specific setup steps need to be added.