Tuya Zigbee Wall Switch (aka. Lonsonho or Bandi)

Yes, this is working now :slight_smile:

I have two questions to you if I may:

  1. Is there any compiler you are using to build your goovy files from parts?
  2. How did you learn how to write drivers? Good 'ol studying source code and how other drivers are built or you have any good resource on this subject?

Thanks again!

Yes, I wrote my own build-environment in Python, it has no documentation, but is available here:
https://github.com/markus-li/Hubitat/tree/development/tools

I've developed software my whole life, both professionally and as a hobby. So that of course helps. I don't have any direct sources, I did just start out by reading through other drivers and reading up on the specifics and peculiarities of Groovy as a language. Before November last year I had never even looked a Groovy. I would suggest looking at the examples in the official repo as well as the code from some of the long-time developers here in the community. After that, search here in the forum regarding optimizing Groovy, there's some threads in here about that.

Good luck and create a new thread and tag me if you want to ask more :slight_smile:

2 Likes

@markus how would you approach the 3 gang switch?

Here's the formatted log:

BUTTON 1 ON: debugsendOnOffEvent(endpoint=1, state=true)
BUTTON 1 ON: info ON/OFF CATCHALL EF00 CLUSTER EVENT - description:catchall: 0104 EF00 01 01 0040 00 CC41 01 00 0000 02 01 00390101000101 | parseMap:[raw:catchall: 0104 EF00 01 01 0040 00 CC41 01 00 0000 02 01 00390101000101, profileId:0104, clusterId:EF00, clusterInt:61184, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:CC41, isClusterSpecific:true, isManufacturerSpecific:false, manufacturerId:0000, command:02, direction:01, data:[00, 39, 01, 01, 00, 01, 01]]

BUTTON 1 OFF: debugsendOnOffEvent(endpoint=1, state=false)
BUTTON 1 OFF: info ON/OFF CATCHALL EF00 CLUSTER EVENT - description:catchall: 0104 EF00 01 01 0040 00 CC41 01 00 0000 02 01 003A0101000100 | parseMap:[raw:catchall: 0104 EF00 01 01 0040 00 CC41 01 00 0000 02 01 003A0101000100, profileId:0104, clusterId:EF00, clusterInt:61184, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:CC41, isClusterSpecific:true, isManufacturerSpecific:false, manufacturerId:0000, command:02, direction:01, data:[00, 3A, 01, 01, 00, 01, 00]]

BUTTON 2 ON: debugsendOnOffEvent(endpoint=1, state=true)
BUTTON 2 ON: info ON/OFF CATCHALL EF00 CLUSTER EVENT - description:catchall: 0104 EF00 01 01 0040 00 CC41 01 00 0000 02 01 003B0201000101 | parseMap:[raw:catchall: 0104 EF00 01 01 0040 00 CC41 01 00 0000 02 01 003B0201000101, profileId:0104, clusterId:EF00, clusterInt:61184, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:CC41, isClusterSpecific:true, isManufacturerSpecific:false, manufacturerId:0000, command:02, direction:01, data:[00, 3B, 02, 01, 00, 01, 01]]

BUTTON 2 OFF: debugsendOnOffEvent(endpoint=1, state=false)
BUTTON 2 OFF: info ON/OFF CATCHALL EF00 CLUSTER EVENT - description:catchall: 0104 EF00 01 01 0040 00 CC41 01 00 0000 02 01 003C0201000100 | parseMap:[raw:catchall: 0104 EF00 01 01 0040 00 CC41 01 00 0000 02 01 003C0201000100, profileId:0104, clusterId:EF00, clusterInt:61184, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:CC41, isClusterSpecific:true, isManufacturerSpecific:false, manufacturerId:0000, command:02, direction:01, data:[00, 3C, 02, 01, 00, 01, 00]]

BUTTON 3 ON: debugsendOnOffEvent(endpoint=1, state=true)
BUTTON 3 ON: info ON/OFF CATCHALL EF00 CLUSTER EVENT - description:catchall: 0104 EF00 01 01 0040 00 CC41 01 00 0000 02 01 003D0301000101 | parseMap:[raw:catchall: 0104 EF00 01 01 0040 00 CC41 01 00 0000 02 01 003D0301000101, profileId:0104, clusterId:EF00, clusterInt:61184, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:CC41, isClusterSpecific:true, isManufacturerSpecific:false, manufacturerId:0000, command:02, direction:01, data:[00, 3D, 03, 01, 00, 01, 01]]

BUTTON 3 OFF: debugsendOnOffEvent(endpoint=1, state=false)
BUTTON 3 OFF: info ON/OFF CATCHALL EF00 CLUSTER EVENT - description:catchall: 0104 EF00 01 01 0040 00 CC41 01 00 0000 02 01 003E0301000100 | parseMap:[raw:catchall: 0104 EF00 01 01 0040 00 CC41 01 00 0000 02 01 003E0301000100, profileId:0104, clusterId:EF00, clusterInt:61184, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:CC41, isClusterSpecific:true, isManufacturerSpecific:false, manufacturerId:0000, command:02, direction:01, data:[00, 3E, 03, 01, 00, 01, 00]]```

Sorry, been very busy lately, tthe data would need decoding, from the looks of it the first byte you can ignore, the second byte is a counter and the third is the button number. The last byte is the state, 0 = off, 1 = on

Hey @markus, no worries. I decided to code my own driver but I stuck on the architecture :see_no_evil: been playing with child devices for each switch but this quickly got too complicated

By setting the id according to endpoint number it should make it rather straight forward.

It may not be very straight forward, and looking at my drivers might just confuse things due to how I auto-build them. If you need pointers, feel free to ask though :slight_smile:

1 Like

Hi guys, I bought a Tuya 4 gang ZigBee scene switch and no generic driver seems to work with it. Was wondering if you made advancements on that? Cheers !

Hello guys!

I am new here, just came from smartthings.
So i have this switches, the one and the two gang versions.
@jacubmikita can you share please the final code to use?

Thank you
Andrew

Ok, so i got it to work.
The first gang works, but how to use the second gang?

Thank you
Andrew

Ha, there are three of us then! I never got enough time to figure it out and I have the switches disconnected from my network still :frowning:

Marry Xmas guys!

Markus! Can you help to us?
I have a flat built with these switches, and there are a few 2 gang version of it.
Can you help to us use the other gang of this device?

The first gang is working now...

Thanks
Andrew

I picked up a 4 gang version of this device, a working driver for it will be available in platform 2.2.5
Can any of you that have one of these please send me the fingerprint, or a screen shot of the data section of the device?, thanks!

@mike.maxwell they are in my first message but for the 3-gang version. Will it work as well?

I don't think so, that unit isn't a Tuya, note the lack of the switch cluster 0006 in the fingerprint, presumably the custom cluster EF00 is where the switch commands would reside.

The fingerprint for the model I have is:
fingerprint profileId:"0104", endpointId:"01", inClusters:"0000,000A,0004,0005,0006", outClusters:"0019", model:"TS0004", manufacturer:"_TZ3000_ns1ndbww"
When we ask the device about its endpoints, it returns 4 of them, each representing one of the switch nodes.
This is the standard way that multi endpoint zigbee devices work.

If the device you posted is a popular item and available I can have a look at it, but I have no idea where to fetch one...

Hmm it was sold to me as a TuYa switch and it's from the same series as the 1-gang switch which is working fine with generic drivers. Maybe it's Lonsonho after all, but I don't recall any branding on the device nor on the box.

Here's more detailed logging of each command: Tuya Zigbee Wall Switch (aka. Lonsonho or Bandi)

Hi Mike!

I was sooooo excited to be able to use my Tuya switches with the new firmware, but they are not working.

Can we modify something to be able to use it?
This is a Tuya switch, i used it with Tuya hub. And looks the same.

My fingerprint is:

  • endpointId: 01
  • application: 40
  • manufacturer: _TZE200_nkjintbl
  • model: TS0601
  • driver: v1.0.1.1123b
  • endpointId: 01
  • profileId: 0104
  • inClusters: 0000,0004,0005,EF00
  • outClusters: 0019,000A
  • isMultiEP: false

Same as mine. Would be so cool to get it working!

The new driver will only work with the Tuya devices that have 0006 in the inClusters list.
The devices with EF00 will not work, if someone wants to loan me one, we can see about getting them to work.

I'd be happy to, but I live in Poland so shipping would cost 4 times the switch cost :wink:

1 Like

Ohh, yeah... i live in Europe / Hungary, so i think that's not an option.
But this switch is very good and not expensive.
So a good option for everyone.
Also i have them everywhere :frowning:

We cannot do it here?

Thanks
Brian