Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New device request - TS0601 / TZE200_nkjintbl #2879

Closed
bkupidura opened this issue Jun 4, 2020 · 199 comments · Fixed by #3218
Closed

New device request - TS0601 / TZE200_nkjintbl #2879

bkupidura opened this issue Jun 4, 2020 · 199 comments · Fixed by #3218

Comments

@bkupidura
Copy link

Hey,
I got new zigbee wall switches, but they are not supported by deconz.

Is there any chance to add support for those switches?
Screenshot 2020-06-04 at 21 45 41
Screenshot 2020-06-04 at 21 45 48
Screenshot 2020-06-04 at 21 46 02
Screenshot 2020-06-04 at 21 46 13
Screenshot 2020-06-04 at 21 46 22

@DJBenson
Copy link

DJBenson commented Jun 6, 2020

I raised #2884 today but I've just re-powered my switch and read the data from it via the deCONZ GUI and it's identical to yours (the latter bit of the manufacturer name is per-device I think);

Screenshot at Jun 06 22-30-02

Mine are Lonsonho-branded but they are also branded as Lerlink and Zemismart.

There are tonnes of these things around so it'd be great to get them in deCONZ.

@Smanar
Copy link
Collaborator

Smanar commented Jun 7, 2020

But they are light, so they can work natively, the device is not visible at all in the API ?

If you are sure the device is not present in the API, can you re-lanch deconz in debug mode, perhaps we have a missing information than block inclusion.

@DJBenson
Copy link

DJBenson commented Jun 7, 2020

I appreciate we are having a cross platform discussion as I’m also discussing this on Discord but how do we check if the device is in the API and as I also mentioned, the device isn’t showing any clusters to allow the device to be controlled (e.g. on/off) - is that normal?

@DJBenson
Copy link

DJBenson commented Jun 7, 2020

OK still learning but I think calling http://x.x.x.x:xxxx/api/XXXXXXXXXX/sensors is how you call the API directly?

If so, no, the device isn’t there. I’ve also checked the light list (as I’d seen it mentioned the switch presents itself as a light) but it’s not there either.

@Smanar
Copy link
Collaborator

Smanar commented Jun 7, 2020

Yes was exactly that.

So can you run deconz in debug mode and make a new inclusion pls ?

Edit:
No need, I have just see the problem.

No information how this remote make request to other devices ?
Using cluster EF00 ?
Using not detected cluster in deconz ?

@DJBenson
Copy link

DJBenson commented Jun 7, 2020

Yes was exactly that.

So can you run deconz in debug mode and make a new inclusion pls ?

Edit:
No need, I have just see the problem.

No information how this remote make request to other devices ?
Using cluster EF00 ?
Using not detected cluster in deconz ?

I seem to have an email for a reply that’s no longer here. The last email was about a code fix and testing...

I’m fairly competent compiling the source if I can test it for you?

@Smanar
Copy link
Collaborator

Smanar commented Jun 7, 2020

Yep, I have edited my post.
I know how to make the device visible, but not sure the cluster I will create can be used by the device.

I m searching info on other zigbee projecy atm.

@DJBenson
Copy link

DJBenson commented Jun 7, 2020

Great, thank you so much for looking into this. If I can do anything I’m happy to help. As I mentioned on Discord I have the 2 and 3 switch models so can test those if/when you find a solution.

@DJBenson
Copy link

DJBenson commented Jun 7, 2020

Found this article on decoding the Tuya cluster format;

https://medium.com/@dzegarra/zigbee2mqtt-how-to-add-support-for-a-new-tuya-based-device-part-2-5492707e882d

It’s linked from the zigbee2mqtt repository so you’ve probably already stumbled upon it but adding here for anybody else who is interested.

@Smanar
Copy link
Collaborator

Smanar commented Jun 7, 2020

Yep it s that , I m on a modification on xml file to test. We will use the Ef00 cluster.

@Smanar
Copy link
Collaborator

Smanar commented Jun 7, 2020

Ok so now there is job for you ^^

https://github.com/Smanar/deconz-rest-plugin/blob/master/general.xml

It's just an xml file to edit, so you just need a text editor and reload deconz.

If I m right on your node on cluster EF00 previously "unknow" you will have now something new.
For the moment there is only one command to try

Status : always 0
TransID : buton id : 13 / 14 / 15
Dp: ??? : 257 /258 /259
fn : always 0
data : state : "1" for "on" or "0"

For the moment you can only send command, not receive them, ofc the switch need to be wired with a bulb to test.

I m not sure at all for values, for the data for exemple IDK if you need to use hexa or not.

@DJBenson
Copy link

DJBenson commented Jun 7, 2020

mmm the cluster is still showing as unknown.

The general.xml file I edited was at /usr/share/deCONZ/zcl - which is what is referenced in the deCONZ UI.

I switched from service (systemd) mode to GUI mode to check on the network overview so deCONZ has been restarted since editing the file.

image

@DJBenson
Copy link

DJBenson commented Jun 7, 2020

There's a typo (I think?) in your cluster ID (0xfc00) which I presume should be 0xef00 - amended and reloaded and the cluster shows up.

@Smanar
Copy link
Collaborator

Smanar commented Jun 7, 2020

Oups my bad, Wrong number Smanar@d2498dc

@DJBenson
Copy link

DJBenson commented Jun 7, 2020

n/p I manually amended it when I saw it looked odd. Cluster is there now. Will see what it does.

@Smanar
Copy link
Collaborator

Smanar commented Jun 7, 2020

Will be hard with random mode, sorry.

But later I will make something to retreive value from the device, will be easier to find missing information.
It will be visible using deconz log (I think, but not sure because this cluster is not implemented at all) or cli plugin too.

@DJBenson
Copy link

DJBenson commented Jun 7, 2020

Tried sending some data in both decimal and hex and the device didn’t respond I’m afraid. I will have a play later when my kids have gone to bed.

@SwoopX
Copy link
Collaborator

SwoopX commented Jun 7, 2020

You most likely need to have a binding for that cluster as well, otherwise you don't necessarily see everything.

@Smanar
Copy link
Collaborator

Smanar commented Jun 7, 2020

Yep, but this command will at least turn the light off or on, even without return.

I don't have enought time today, but tomorrow I will make the code write some log according to cluster return, will be usefull, because using "magic number" .....

@Smanar
Copy link
Collaborator

Smanar commented Jun 8, 2020

Ok so first try https://github.com/Smanar/deconz-rest-plugin/tree/tuya

If someone can try this code ? Realy experimental, but nothing hard to understand.

With this code, you will have debug line in log with informations when you press a button on the device, try to mimic the value in the deconz GUI.

@DJBenson
Copy link

DJBenson commented Jun 8, 2020

So I'm running deCONZ with the debug options? What level is required? From the wiki;

deCONZ --dbg-info=1 --dbg-aps=1 --dbg-zcl=1 --dbg-zdp=1

...but that seems very busy - is that level necessary?

@Smanar
Copy link
Collaborator

Smanar commented Jun 8, 2020

I m using -dbg-info=1 for my debug message.
But -dbg-info=2 is enought.

All my log will start by "Tuya debug" and a number, you can use that as filter.

You haven't problem for compilation ? Because I haven't tested the code on my side, so I can have make mistake.

@DJBenson
Copy link

DJBenson commented Jun 8, 2020

No it compiled fine.

Going to go and connect the light and see what I get back.

@DJBenson
Copy link

DJBenson commented Jun 8, 2020

If I grep the output by "Tuya debug" will that capture what we're looking for? Even with -dbg-info=2 the output is very chatty.

EDIT: -dbg-info=1 is much less busy.

@Smanar
Copy link
Collaborator

Smanar commented Jun 8, 2020

NP, I think "-dbg-info=1" is enought for my log, you can try "=0" on other, IDK the defaut value.

But yes I know, if you have lot of devices, it s a real problem.

@DJBenson
Copy link

DJBenson commented Jun 8, 2020

Mmm I'm not seeing any debug output from the switch.

  1. Do I need to leave the general.xml change in place?
  2. Do I need to delete and re-bind the switch?

@Smanar
Copy link
Collaborator

Smanar commented Jun 8, 2020

No, you can use the general.xml you want, better to use the modified one.

And no you don't need to delete and re-include the device, and from the link it works without bind.
Every time you send a command 0x00, it will answer by 0x02.

You have take the code in the tuya branch ? not the master ?

When you use the GUI to try to send a command, you have error message ?

@DJBenson
Copy link

DJBenson commented Jun 8, 2020

So;

  • Using same XML as yesterday
  • Code cloned from "tuya" branch (confirmed my local version has your two changesets in)
  • I've sent 0x00 from the GUI (no other values changed - the UI responds with "Success")
  • Toggled the state of the physical switches

I don't get any Tuya related debug at level 1 or 2.

image

@vegetate7
Copy link
Contributor

vegetate7 commented Sep 1, 2020

@vegetate7
Ok I stop this kind of modification for the moment ^^, I will make a PR for the tuya stuff tonight (there is a soon a new version). Just tell me if you still have problem, but promise I touch nothing for long time on this part.

Wait a momnt. Not compiling.

tuya.cpp:249:48: error: ‘class LightNode’ has no member named ‘setManufacturer’; did you mean ‘manufacturer’?
                                     lightNode->setManufacturer(lightNode2->manufacturer());

Imho 'setManufacturerName' must be instead.
but get property is 'manufacturer()' yes. ^)

@Smanar
Copy link
Collaborator

Smanar commented Sep 1, 2020

Ha right setManufacturerName is for light and setManufacturer for sensor, but why a difference ?
Corrected, thx a lot

#3218

@vegetate7
Copy link
Contributor

So need to switch branch to 'tuya' back, right?
Ok, it builds, runs. Can switch lights.
Looks like nothing broken. yet.

@Smanar
Copy link
Collaborator

Smanar commented Sep 1, 2020

It s the official PR, the other, "tuya2" have too much change, but ATM they are the same.

@vegetate7
Copy link
Contributor

vegetate7 commented Sep 25, 2020

Kind of a necroposting :)
Actually I do not know where is better to put it.
I've upgraded HA deconz plugin with deConz 2.05.81. Seems main deconz have some of Tuya code ('Tuya debug 4' and 'Tuya debug 5' in logs) but lack of many fixes: switches not works correctly and not reflecting manual switch changes. May be other issues, but I did not tests.
Worst happened is when I tried to install the 'tuya' branch .so - after that none of LightNodes loaded. Not only Tuyas, but all of them. Sensors loaded ok. deConz GUI show light nodes without names (like as they are not included). RestAPI answers with empty Json. No 'LightNode' strings in log.
So I reverted back to original 2.05.81 plugin. Having now not working Tuya wallswitches :(

I've also tried .so which I successfully run three weeks before upgrade. but with same result.

@Smanar
Copy link
Collaborator

Smanar commented Sep 25, 2020

Tuya code is still in waiting list (with switch modification for exemple)
But BTW

Worst happened is when I tried to install the 'tuya' branch .so - after that none of LightNodes loaded. Not only Tuyas, but all of them.

This is worrying.
You are using this branch ?
git clone --branch tuya https://github.com/Smanar/deconz-rest-plugin

If yes, do you have log when you have restarting deconz ?

@Smanar
Copy link
Collaborator

Smanar commented Sep 25, 2020

Ha yes there is one more thing to do with last version deconz > version 82

Now user can edit themself button value, in a json file.

So on new deconz version you need to copy the file button_maps.json

Be aware, when compiling the plugin before the next release the button_maps.json needs to be copied (or symlinked) into ~/.local/share/dresden-elektronik/deCONZ in order to be found.

But it don't prevent node be loaded, so this can't cause your issue.

@vegetate7
Copy link
Contributor

I'm run 2.05.81, so must be ok without button_maps.json.
But I've installed it, just in case.
Downloaded from scratch git clone --branch tuya https://github.com/Smanar/deconz-rest-plugin
Compiled, started. Result the same, no any LightNodes.
Log attached.
(around 22:25 i manually toggled switches on 0xEC1BBDFFFE751C91 node, but no traces in the log)
tuya_branch.log

@Smanar
Copy link
Collaborator

Smanar commented Sep 25, 2020

All the lightnode part was skipped.

You light device are all from the same manufacture ?

Manufacture code = 0x0000 or 0x1002

@vegetate7
Copy link
Contributor

No, manufacturers different, but most devices have Manufacturer code 0x0000 or 0x1002. But there is one smart plug with
manuf code 0x117e, but it is skipped also.

@Smanar
Copy link
Collaborator

Smanar commented Sep 25, 2020

I have made another branch "tuya3" with more debug line.
If you can try it, logs will appear on deconz loading.

@vegetate7
Copy link
Contributor

vegetate7 commented Sep 25, 2020

Nothing. No "debugtuya" at all
tuya3_branch.log

May be something in DB layer changed in 81 -> 82.
But I've tried old plugin, with same result.

@Smanar
Copy link
Collaborator

Smanar commented Sep 25, 2020

Yeah you realy have something bad. The log "DBG_Printf(DBG_INFO, "Debugtuya 1");" is at the start of the fonction, before the tuya code, you need to have this one.
The only way I m seing to not have this line is not having router at all in the database.

You haven't an old backup ? (database backup) ?

@vegetate7
Copy link
Contributor

vegetate7 commented Sep 25, 2020

I did DB backup just before upgrade.
But also I've upgraded firmware (but that was after missing LightNodes)
Should i try to restore it?

@vegetate7
Copy link
Contributor

vegetate7 commented Sep 25, 2020

Tried with DB from backup. Same result, no "Debugtuya" in log.
Hmm. What I have not tried yet - it is to compile main branch. I'll try ^)

Yep. Master branch have the same issue. No LightNodes at all.
So reason is not Tuya part of code. May be something changed in 81->82 and different versions of plugin and deConz is not compatible.
I'd even say 2.05.81 deConz is not compatible with other versions of plugin. Because of same behavior of pre-81 and 82+ plugins.

@Smanar
Copy link
Collaborator

Smanar commented Sep 25, 2020

You are the only one with this issue for the moment, so I don't think at a compatibility problem.

ATM you have lightnode with version 81 but not with version 82 ?

But if you have lighnode in your database (I can check inside if you are not sure) and nothing appear in log it's strange.
How look the node in deconz, with number instead of name, but how are clusters ?

@vegetate7
Copy link
Contributor

I think I am only one who did this mix :)
Look, I have deConz 81 (it is "official" update in HomeAssistant). And try to run it with plugin from 82. (and from 80).
Sure I have lightnode in database. If I put original plugin (81) - all LightNodes in their places.

I'll make screenshot for clusters.

@Smanar
Copy link
Collaborator

Smanar commented Sep 25, 2020

There is too some problem on an old 82 version but corrected ATM > #3273

@vegetate7
Copy link
Contributor

My sensors updating :( And I already fixed 'general.xml' :)
deConz gui with 'tuya3'
Ok, my mesh is all on it's place. But most of nodes (not only Lights) without names.
Clusters is ok. RestAPI still return empty '/lights/'

Screenshot_20200926_015036

@vegetate7
Copy link
Contributor

Update! I've got "Debugtuya"!
But that time created only "Unknown32" lightnode (that unknown purpose endpoint tyed to Router).

@Smanar
Copy link
Collaborator

Smanar commented Sep 25, 2020

You have too the problem on sensor ? Lot of them miss the name.
The debug level is set at 1 ?

Because you miss so much thing in your log like

10:59:18:011 Load config ................................
10:59:18:015 Sqlite sensors: .............................

In fact I realy don't see any log about the database (except the first one), it s like you are not using database at all.

23:56:20:875 DB sqlite version 3.27.2
23:56:20:875 DB PRAGMA page_count: 50
23:56:20:875 DB PRAGMA page_size: 4096
23:56:20:875 DB PRAGMA freelist_count: 2
23:56:20:875 DB file size 204800 bytes, free pages 2
23:56:20:876 DB PRAGMA user_version: 7
23:56:20:876 DB cleanup
23:56:20:878 DB create temporary views

@vegetate7
Copy link
Contributor

I do not think I have sensors problem too. Some of them are reporting, I think same which names appeared - MotionSensor1 and MotionSensor2. RestAPI show full sensors set.
"Sqlite sensors" is at debug level 2. I'll try again with it set.

btw, for comparsion. log from starting .81 deconz. Looks the same, except LightNodes:
deconz_81_start.log

@vegetate7
Copy link
Contributor

vegetate7 commented Sep 25, 2020

Set DBG_INFO level2.
Log of starting with "tuya3" plugin: no lightnodes again, but look, all nodes read from DB, just not added to RestAPI.
tuya3_level2.log

Some of blackmagic. Restarted deConz. Near of 4:07 I started "Add new lights" from Phoscon webapp, and start join on SmartSocket3, and almost all of LighNodes added back!
But not all. Not added battery powered DIY keypad (appeared as 20 On/Off lights). And not added 2 "no neutral line" Tuya wall switches. Looks like battery powered type of LightNode is common here.
tuya3_level2_reincl.log

But the magic ends here. After deConz restart - all LighNodes disappeared again.

Ahh. Sorry, previously wrong named "Unknown32" - it is OnOff created for Coordinator, not Router.

@vegetate7
Copy link
Contributor

vegetate7 commented Sep 26, 2020

And a last for today: Can it be related to deconz libs version in my build environment? Will test tomorrow.
Can not wait to tomorrow. Rebuilt the building environment docker container. Recompiled 'tuya3' plugin.
All works now. Lights, sensors. Tuya switches.

Sorry for inconvenience :(
Will be a useful experience...

@Smanar
Copy link
Collaborator

Smanar commented Sep 26, 2020

Lol, np, bad result are always usefull to prevent them.
But I m still not understanding what happened. Lots of logs are missing somes lines, I can't sayf if it s from api library or database ....

But yes compilation is system dependant, so if you compile the code on a system (software and hardware, virtual or real) it will be incompatible on another.

@vegetate7
Copy link
Contributor

But I m still not understanding what happened. Lots of logs are missing somes lines, I can't sayf if it s from api library or database

IDK too :)
Just can say i saw compile conditionals like #if DECONZ_LIB_VERSION >= 0x010E00 that's make me think to try update libs,,

@orionevo14
Copy link

Hello,
I have one but it doesn't work on deCONZ 2.12.6, should I raise a new device request ? If not, here are the screenshot :
Capture1
node_info
basic
tuya

thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants