Tuya Moes smart button driver?

No, the model I bought is this one:
https://www.aliexpress.us/item/3256805088385475.html?pdp_npi=2%40dis!USD!US%20%2434.23!%2418.14!!!!!%402101d1c316796303129067105e22c9!12000032446613159!btf&_t=pvid%3Af1938940-8041-4a84-83ed-0e7d95e25abf&afTraceInfo=1005005274700227__pc__pcBridgePPC__xxxxxx__1679630313&spm=a2g0o.ppclist.product.mainProduct&gatewayAdapt=glo2usa&_randl_shipto=US

Try the same driver,

1 Like

Sorry, I had already tried the driver listed as "Tuya Zigbee Scene Switch" that is listed under the drivers dropdown menu, but it does not work..

Not that one.
Install the custom driver from the link above.

1 Like

Thank you. I followed the instructions on how to copy and paste the code to create a user driver, saved it, and then changed the settings for this device so it would use the new user generated driver. However, when I try to use it to turn on lights connected with Iris V1 switches, it does not respond. I also tried to use it to control an Osram Lightly smart bulb but it also does not work. I tried looking into the events and the logs for this device to see if I can confirm it is working properly when I press it, but neither shows any activity. the events log only says "my device name" healthStatus set to online, and the log's last entry says the device is online and that's it. Is there any where I can look to see if the presses are being recorded to confirm the user driver I installed is actually doing the trick? Thank you so much for your help.

It will be better if you install and start using the Hubitat Package Manager (HPM) for installing and updating HE community/custom drivers first.

These Tuya buttons are one of the most difficult devices to use with HE. There is one very important detail:

Before you attempt using the button in your automations, you must make sure that the button works OK first. So, now with the Tuya TS004F driver installed and manually assigned to your button, pair the device again to HE. You should see 'found an existing device' when paired again successfully. Then press the button, in the Current States you should see something like this:

image

Can you also post a screenshot of the Device Details 'Data' section? Should look like this :

1 Like

Thank you for these tips! I re-paired the device as you instructed (got the "found an existing device" prompt). It still does not work. Here are the screenshots for the current states and the device data:


Note: I did NOT use the HPM; I simply copied and pasted the entire code. Will using the HPM do something differently than pasting the driver's code? Thanks.

No, HPM just makes the installation and the update of HE custom drivers easier.

OK, I searched quickly the GitHub for this device, and I've found 140 comments here on the attempt to make it work in Home Assistant ... So making it work in Hubitat may take some more time.

This button has two operational modes - 'Dimmer and 'Scene Switch'. Only the Scene mode will work in Hubitat.

Seems like switching between these two operational modes is made by pressing and holding the button for 5 seconds. Can you try this and see if there is any difference?

1 Like

OK, I tried holding the button down for 5 seconds but it did nothing. I then completely removed the device, re-paired it, the user driver got automatically assigned to the button, and now the device works to a certain extent:



I then set it to trigger the automation of the lights, and it does turn them on and off per the rule, EXCEPT that it randomly registers 2 clicks when I press the button, so sometimes when I try to turn the lights on it turns them on then immediately off because of the 2 clicks. It makes no difference where on the button I click, or how strongly I press it...

1 Like

That's very good progress!
Please enable the Debug logs, then press the button one or two times, to register the double-click problem,
Then try to select, copy and paste here the live logs as a text. You can use the forum editor cog wheel tool to hide the long debug logs in your post into a summary section.

1 Like

Here is a representative section of debug logs that contain the issue:

dev:2022023-03-24 02:02:05.115 PMdebugbookcase lights debouncing timer for button 1 expired.

dev:2022023-03-24 02:02:04.095 PMinfobookcase lights button 1 was pushed

dev:2022023-03-24 02:02:04.092 PMdebugbookcase lights catchall descMap: [raw:catchall: 0104 0006 01 01 0040 00 2FD4 01 00 0000 FD 00 00, profileId:0104, clusterId:0006, clusterInt:6, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:2FD4, isClusterSpecific:true, isManufacturerSpecific:false, manufacturerId:0000, command:FD, direction:00, data:[00]]

dev:2022023-03-24 02:02:04.090 PMdebugbookcase lights description is catchall: 0104 0006 01 01 0040 00 2FD4 01 00 0000 FD 00 00

dev:2022023-03-24 02:01:48.754 PMdebugbookcase lights debouncing timer for button 1 expired.

dev:2022023-03-24 02:01:47.734 PMinfobookcase lights button 1 was pushed

dev:2022023-03-24 02:01:47.731 PMdebugbookcase lights catchall descMap: [raw:catchall: 0104 0006 01 01 0040 00 2FD4 01 00 0000 FD 00 00, profileId:0104, clusterId:0006, clusterInt:6, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:2FD4, isClusterSpecific:true, isManufacturerSpecific:false, manufacturerId:0000, command:FD, direction:00, data:[00]]

Thanks!

Edit: found a thread where the same issue was identified as having to do with the debouncing timeout. I tried removing the device again to see if a re-pair would make the double press error go away but unfortunately it persists after the re-pair...

Hi @giles ,

Your example shows a time difference between the two button push events of 17 seconds ... Probably this excerpt from the logs does not include the problematic case?

Can you try to edit the driver code and increase the default debouncing timeout of 1000 milliseconds to 2000 as an example?

image

Thank you for the tip. I went to the "driver code" section, clicked on the Tuya Scene Switch TS004F and edited the Debounnce Time from 1000 to 2000, then clicked on save and exited the section. I tried the button and once again it continues to randomly register double clicks. I tried clicking several times afterwards, and the copied the debug logs for the previous clicks and pasted them below. Hopefully these show the error:

dev:2032023-03-25 03:10:32.943 PMdebugbookcase button debouncing timer for button 1 expired.

dev:2032023-03-25 03:10:30.915 PMinfobookcase button button 1 was pushed

dev:2032023-03-25 03:10:30.912 PMdebugbookcase button catchall descMap: [raw:catchall: 0104 0006 01 01 0040 00 FE10 01 00 0000 FD 00 00, profileId:0104, clusterId:0006, clusterInt:6, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:FE10, isClusterSpecific:true, isManufacturerSpecific:false, manufacturerId:0000, command:FD, direction:00, data:[00]]

dev:2032023-03-25 03:10:30.910 PMdebugbookcase button description is catchall: 0104 0006 01 01 0040 00 FE10 01 00 0000 FD 00 00

dev:2032023-03-25 03:10:17.081 PMdebugbookcase button debouncing timer for button 1 expired.

dev:2032023-03-25 03:10:15.058 PMinfobookcase button button 1 was pushed

dev:2032023-03-25 03:10:15.056 PMdebugbookcase button catchall descMap: [raw:catchall: 0104 0006 01 01 0040 00 FE10 01 00 0000 FD 00 00, profileId:0104, clusterId:0006, clusterInt:6, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:FE10, isClusterSpecific:true, isManufacturerSpecific:false, manufacturerId:0000, command:FD, direction:00, data:[00]]

dev:2032023-03-25 03:10:15.054 PMdebugbookcase button description is catchall: 0104 0006 01 01 0040 00 FE10 01 00 0000 FD 00 00

dev:2032023-03-25 03:10:07.348 PMdebugbookcase button debouncing timer for button 1 expired.

dev:2032023-03-25 03:10:05.328 PMinfobookcase button button 1 was pushed

dev:2032023-03-25 03:10:05.326 PMdebugbookcase button catchall descMap: [raw:catchall: 0104 0006 01 01 0040 00 FE10 01 00 0000 FD 00 00, profileId:0104, clusterId:0006, clusterInt:6, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:FE10, isClusterSpecific:true, isManufacturerSpecific:false, manufacturerId:0000, command:FD, direction:00, data:[00]]

dev:2032023-03-25 03:10:05.324 PMdebugbookcase button description is catchall: 0104 0006 01 01 0040 00 FE10 01 00 0000 FD 00 00

dev:2032023-03-25 03:10:03.877 PMdebugbookcase button debouncing timer for button 1 expired.

dev:2032023-03-25 03:10:01.851 PMinfobookcase button button 1 was pushed

dev:2032023-03-25 03:10:01.849 PMdebugbookcase button catchall descMap: [raw:catchall: 0104 0006 01 01 0040 00 FE10 01 00 0000 FD 00 00, profileId:0104, clusterId:0006, clusterInt:6, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:FE10, isClusterSpecific:true, isManufacturerSpecific:false, manufacturerId:0000, command:FD, direction:00, data:[00]]

dev:2032023-03-25 03:10:01.847 PMdebugbookcase button description is catchall: 0104 0006 01 01 0040 00 FE10 01 00 0000 FD 00 00

dev:2032023-03-25 03:09:59.004 PMdebugbookcase button debouncing timer for button 1 expired.

dev:2032023-03-25 03:09:56.977 PMinfobookcase button button 1 was pushed

dev:2032023-03-25 03:09:56.975 PMdebugbookcase button catchall descMap: [raw:catchall: 0104 0006 01 01 0040 00 FE10 01 00 0000 FD 00 00, profileId:0104, clusterId:0006, clusterInt:6, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:FE10, isClusterSpecific:true, isManufacturerSpecific:false, manufacturerId:0000, command:FD, direction:00, data:[00]]

dev:2032023-03-25 03:09:56.973 PMdebugbookcase button description is catchall: 0104 0006 01 01 0040 00 FE10 01 00 0000 FD 00 00

dev:2032023-03-25 03:09:54.932 PMdebugbookcase button debouncing timer for button 1 expired.

dev:2032023-03-25 03:09:53.395 PMinfobookcase button battery is 100 %

dev:2032023-03-25 03:09:53.386 PMdebugbookcase button Event enter: [name:battery, value:100.0]

dev:2032023-03-25 03:09:53.381 PMdebugbookcase button description is read attr - raw: FE1001000110210020C82000201E, dni: FE10, endpoint: 01, cluster: 0001, size: 10, attrId: 0021, encoding: 20, command: 0A, value: C82000201E

dev:2032023-03-25 03:09:52.906 PMinfobookcase button button 1 was pushed

dev:2032023-03-25 03:09:52.903 PMdebugbookcase button catchall descMap: [raw:catchall: 0104 0006 01 01 0040 00 FE10 01 00 0000 FD 00 00, profileId:0104, clusterId:0006, clusterInt:6, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:FE10, isClusterSpecific:true, isManufacturerSpecific:false, manufacturerId:0000, command:FD, direction:00, data:[00]]

dev:2032023-03-25 03:09:52.902 PMdebugbookcase button description is catchall: 0104 0006 01 01 0040 00 FE10 01 00 0000 FD 00 00

dev:2032023-03-25 03:09:50.456 PMdebugbookcase button debouncing timer for button 1 expired.

dev:2032023-03-25 03:09:48.467 PMdebugbookcase button restarted debouncing timer 2000ms for button 1 (lastButtonNumber=1)

dev:2032023-03-25 03:09:48.401 PMwarnbookcase button ignored event for button 1 - still in the debouncing time period!

dev:2032023-03-25 03:09:48.397 PMdebugbookcase button catchall descMap: [raw:catchall: 0104 0006 01 01 0040 00 FE10 01 00 0000 FD 00 00, profileId:0104, clusterId:0006, clusterInt:6, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:FE10, isClusterSpecific:true, isManufacturerSpecific:false, manufacturerId:0000, command:FD, direction:00, data:[00]]

Thanks.

Edit: I just tried setting the debouncing time to an even longer period (9000 ms) and naturally the button pressings are not registered until after the debounce period ends but once it does it goes right back to registering double clicks...

There is a big time diference between these button push events ... Which of these were physical pushes and which not?

Line 3: dev:2032023-03-25 03:10:30.915 PMinfobookcase button button 1 was pushed
Line 9: dev:2032023-03-25 03:10:17.081 PMdebugbookcase button debouncing timer for button 1 expired.
Line 11: dev:2032023-03-25 03:10:15.058 PMinfobookcase button button 1 was pushed
Line 17: dev:2032023-03-25 03:10:07.348 PMdebugbookcase button debouncing timer for button 1 expired.
Line 19: dev:2032023-03-25 03:10:05.328 PMinfobookcase button button 1 was pushed
Line 25: dev:2032023-03-25 03:10:03.877 PMdebugbookcase button debouncing timer for button 1 expired.
Line 27: dev:2032023-03-25 03:10:01.851 PMinfobookcase button button 1 was pushed
Line 33: dev:2032023-03-25 03:09:59.004 PMdebugbookcase button debouncing timer for button 1 expired.
Line 35: dev:2032023-03-25 03:09:56.977 PMinfobookcase button button 1 was pushed
Line 41: dev:2032023-03-25 03:09:54.932 PMdebugbookcase button debouncing timer for button 1 expired.
Line 49: dev:2032023-03-25 03:09:52.906 PMinfobookcase button button 1 was pushed
Line 55: dev:2032023-03-25 03:09:50.456 PMdebugbookcase button debouncing timer for button 1 expired.
Line 59: dev:2032023-03-25 03:09:48.401 PMwarnbookcase button ignored event for button 1 - still in the debouncing time period!

EDIT: I see the problem now.

This is what this button looks like - is there anyone else using it?

The period when this button sends a repetitive event is about 5 seconds ..
The same period fo some other Tuya buttons is about 800 milliseconds, so the debouncing algorithm works with the other buttons, but obviously, it will not work for this model.

I'l need to search for another solution.

I really want to thank you for all the time and effort you're putting into this. Like others have already mentioned, this forum is the exception to the rule. Re which of the pushes were physical and which weren't, I believed I only pushed the button 4 times after changing the debouncing time. BTW, this is the other thread from this forum that appears to deal with this same device (they call it just "button" at the end of the thread) which you also participated on. At the end of the thread it sounds like they simply removed and re-paired and this solved their issue, but I tried this already several times. Anyway, let me know if you need any other info from my end. Thanks again!

other thread:

1 Like

What usually works in such cases is to delete the device ('REMOVE DEVICE' button from the web page bottom right corner), remove the battery for several minutes and pair it again to HE.

It is important that you see this ''switchMode:scene' in the current states. It means, that the device was initialized OK and it has reported back the operational mode to the hub.

image

It may be better to try again after a week or two after updating the HE to the latest version then,.
Currently, there are some issues with the latest HE platform updates affecting the Zigbee pairing process for some devices. And Tuya devices are known to be one of the most problematic ones.

1 Like

OK. I removed the device following your instructions (same way I have been removing it before, by clicking on the bottom right hand corner on "remove device"), then removed the battery, waited 15 minutes and re-paired it. Checking the "current states" it did show the switchmode as "scene", but upon trying to use it once again it continues to randomly register double presses where none exist. I will try again after the new hub firmware is released. Thanks again for all your help.

ISSUE SOLVED!

OK, here is the solution I found, which hopefully can help others experiencing the same issue. It looks like that by setting the button to turn lights on with one press while also setting it to turn them off with one press, the button goes HAL 2001 and tries to do both at the same time (not really but you know what I mean). So, I went back to my rule and changed the trigger to turn the lights off from a single press to a "double tap", which is supported by the TS004F driver, saved it, and tested the button again. I have not been able to reproduce the issue; no more incorrect double clicks at all. One click turns the lights on, and only a double click turns them off. In retrospect it seems obvious what the issue was, so I am sorry to have wasted people's time on this (especially kkossev, who went above and beyond trying to help me). Thanks everyone!

1 Like