Help needed for writing a device handler for Tuya Zigbee Siren

Dear all,
I have a Tuya Zigbee siren ( manufacturer: _TYST11_d0yu2xgi, model: 0yu2xgi) for which there apparently is no device handler. Unfortunately, I am quite new to Groovy programming, and in particular Zigbee device handlers. I have reverse-engineered quite some information that, if I only knew how, should make it possible to write a device handler. Maybe some of the experts here can help me out with these questions (forgive me if these appear very basic):

  1. Most communication with the device is going over the Tuya specific cluster 0xEF00. For example, the device regularly sends temperature and humidity values on this cluster, which I can easily decode by parsing the catchall. But HOW can I send the decoded values to the respective tile in the smartthings app?

  2. Switching the siren on or off, and setting its parameters, appears to be relatively easy: send the command ID and payload data to that 0xEF00 cluster. I think this should be possible by issuing a “zigbee.command(0xEF00, command, data)” command in the device handler. The command for the siren is 0x0168 (or only 0x68), and the payload should simply be “0” or “1”. Maybe I am doing it wrong [along the line of zigbee.command(0xEF00, 0x68, “1”)], but it doesn’t work - the siren isn’t switched on or off. The documentation of the zigbee.command command unfortunately isn’t very detailed, and doesn’t explain how these things are done with a custom cluster

  3. I haven’t figured out how to write the configure() function. Basically all examples I have seen use something like zigbee.temperatureConfig(30, 300) and zigbee.configureReporting(zigbee.RELATIVE_HUMIDITY_CLUSTER, 0x0000, DataType.UINT16, 30, 3600, 100), which uses the standard clusters. Can this be done also with non-standard clusters such as 0xEF00. If so, what to send?

Someone must have some idea about this?

one would think so… But my post was moved to “developer programs” which - I think - most ambitious amateur DH developers don’t ever read, and the official developers of the gadgets (like Tuya) don’t bother to reply to. Too bad, because most of my questions should be quite easy to answer for more experienced amateurs.

  1. You need to define capability 'Temperature Measurement' and capability 'Relative Humidity Measurement' in the device metadata and when updating attributes use the appropriate variation on sendEvent( name: 'temperature', value: '20.1', unit: 'C' ) and sendEvent( name: 'humidity, value: '67', unit: '%' ). It is a good idea to seed the attributes in your device install() method as it just keeps the app happy, and send the unit at least once as that also keeps the app happy.

  2. Unfortunately Zigbee isn’t something I’ve looked at closely. I can only cover the DTH basics. A siren requires capability 'Alarm' and uses the commands off(), siren(), strobe() and both() and you need to set the attribute alarm to off, siren, strobe or both in either in the commands or in response to a report via parse(), in order to update the status.

  3. Again the Zigbee detail is beyond me. I can point out that if you are using the configure() command method you should define capability 'Configure'. As well as making it known that you have the configure() command, the command will be called automatically when you first install a device, and also whenever you update it significantly in the IDE (e.g. change its device name). Apart from that it is down to you to make sure it gets run if you need it to, either calling it from install() or update() or just calling it from the mobile app or an automation.

To a certain extent, I would agree but it is hard working on a DTH when you don’t have the hardware. I’ve tried helping people in that scenario, and it’s difficult and time consuming, but doable.

Have you tried ST’s DTH for this siren to get you started? (I use this dth for my HEIMAN Siren)

https://raw.githubusercontent.com/SmartThingsCommunity/SmartThingsPublic/master/devicetypes/smartthings/ozom-smart-siren.src/ozom-smart-siren.groovy

In case you haven’t come across these yet:

While a little on the old and crappy documentation side of things (some examples too), here’s ST info to help you as well:

And then the spec to help you with cluster and attributes:

@orangebucket
Thanks a lot for your answers. Unfortunately they don’t help a lot in this specific case:

As to 1: I had tried this, but it didn’t work the couple of tries I made. But good to know that it should work like this, so most probably there just was a problem with the code. I am not sure whether it didn’t set the values correctly, or the problem is the communication with the detail tiles to show the values there.
As to 2: No, if it was that easy I wouldn’t have asked. The gadget does not use the standard Zigbee clusters for most of its work, but sends and receives data on the Tuya specific cluster 0XEF00. Thus, technically speaking the gadget isn’t a “siren” in the sense the Zigbee standard defines one, and setting attributes in the siren cluster just doesn’t do anything. That’s why I asked how to send commands/events to a non-standard cluster, and how to link this al to the tiles in the (new) app.
As to 3: I don’t understand this answer. I mean, ok, I understand what the configure() is supposed to do and that I have to set the configure capability. But my question was more what to put into the configure() function for such a non-standard device.

@johnconstantelo:

Thanks a lot for your reply. The problem is that this gadget is not properly using the standard Zigbee clusters. All documentation of these standard clusters (that I know) just doesn’t lead anywhere with that device. Nor does a device handler that uses these standard clusters, such as the Ozom one that actually was the first I had tried, work in any way. The gadget sends and receives data from and to the hub on the Tuya specific cluster 0xEF00, not, for example, on the siren cluster. Unfortunately I don’t have enough experience (and or examples to learn from) to know how to send commands to that cluster, and how to link the device to the new app tiles (which should be “standard” ones, but filled with data coming from the 0XEF00 cluster, or trigger sending appropriate payload to that cluster). It’s not a problem of WHAT to send (I have pretty much found and in parts myself reverse-engineered the commands and attributes), but HOW to send them from tiles via the device handler to the device itself.
Regarding the ST developer documentation, I have perused it, but much of the information is for the old app that I won’t be using (I don’t see much sense in putting work into an obsolete frontend). Documentation of how to make the device communicate with the new app is super hard to find and - it seems - scattered all over the Internet. Most probably I just missed the proper documentation somewhere - in that case I will be enormously grateful for links!

Just adding more info to the discussion…
I just bought this sensor and tried to pair for a while until realize was not compatible.
Found some stuff on youtube from this guy Sensors Zigbee Tuya in Samsung Smartthings in Portuguese.
Changing the device type from in some Tuya devices (recognized as Things) to SmartSense, some capabilities start working like Temperature, Humidity or Battery levels.

I changed the Siren to “SmartSense Temp/Humidity Sensor” and I started to get Battery levels but no Temperature / Humidity. I guess this is a place to start but not sure if there is a way to copy their handlers to implement our own Siren one. I tested several Siren devices and none seems to work.

I’m software engineer but never touch this Smartthings device handlers. I’m starting to take a look into it.

I’m gonna start by looking at this one.
https://github.com/SmartThingsCommunity/SmartThingsPublic/blob/master/devicetypes/smartthings/smartsense-temp-humidity-sensor.src/smartsense-temp-humidity-sensor.groovy

I have made DTH for tuya curtains.

You can refer to my source code about using tuya manufacturer specific cluster (EF00)

1 Like

This is a great start point @iquix :grinning:

1 Like

I’m receiving this catchall from the device.

catchall: 0104 EF00 01 01 0000 00 229E 01 00 0000 01 01 00C76A0200040000003E’
catchall: 0104 EF00 01 01 0000 00 229E 01 00 0000 01 01 00C86A0200040000003D’
catchall: 0104 EF00 01 01 0000 00 229E 01 00 0000 01 01 00C96A0200040000003E’

Also, found some references to Tuya Siren from this cpp code https://github.com/dresden-elektronik/deconz-rest-plugin/blob/3c9d2d0021571dee349408e6247fa1fe05cb5645/tuya.cpp

Like this:
The battery is the same as in SmartSense- 0x021

case 0x0269: // siren temperature
case 0x0215: // battery

This document below will give you basic anatomy of tuya command system.

In tuya zigbee, refer to parse() function of my sourcecodr to find out how to get dpID and function_command from tuya zigbee packet.

Also refer to sendTuyaCommand() function of my source code about composing zigbee packet from dpID, data type and function_command data.

@iquix that’s excellent information! With your example of a Tuya device handler, the Tasmota resource, and the information I have already reverse-engineered, I will get to work and try my best to get a basic device handler together. I am pretty sure I will hit some additional roadblock before I can come up with something useful - prepare for more questions! :slight_smile:

@frayer Just found some extensive information about the Siren payload. Please, take a look.

https://gist.github.com/patrickdk77/b687448fecff68d8572ac79a27d07862