[ST Edge] Zigbee Driver for MOES 4-Button Scene Switch (TS004F)

Hi, everyone = )

I hope everyone enjoyed the holidays and is having fun here!

Back to the purpose of this thread, in the last weeks I’ve been having a great time developing a few drivers for a set of bulbs and outlets for my house and decided to take a shot to integrate something “underground” i.e. something that is not officially supported, and in this context I bought a MOES 4-Button Scene Switch, and at the first moment I had a hard time to understand the flow of the integration because taking in consideration the zigbee-button official driver, it seems that every manufacturer integrates the button events in different ways.

So, scrapping here and there, I found this thread and I want to thank @Trakker2 for sharing the following piece of code that made the magic to integrate the button events properly:

I just translated the references into Lua, which looks like this (a bit hardcoded):

  local cluster_base = require "st.zigbee.cluster_base"
  local data_types = require "st.zigbee.data_types"
  local device_mgmt = require "st.zigbee.device_management"

  -- Build custom Cluster and
  -- custom OnOff Attribute
  local custom_cluster =
    cluster_base.read_manufacturer_specific_attribute(device, 0xE001, 0xD011, 1) -- UNSUPPORTED_ATTRIBUTE
  local onoff_custom_attr =
    cluster_base.build_cluster_attribute(clusters.OnOff, 0x8004, "OnOffSomething", data_types.Enum8, true)

  -- Send ZigbeeMesssageTx
  device:send(custom_cluster)                                                                 -- UNSUPPORTED_ATTRIBUTE
  device:send(onoff_custom_attr:read(device))                                                 -- SUCCESS
  device:send(clusters.PowerConfiguration.attributes.BatteryPercentageRemaining:read(device)) -- BatteryPercentageRemaining
  device:send(clusters.PowerConfiguration.attributes.BatteryVoltage:read(device))             -- BatteryVoltage
  device:send(onoff_custom_attr:write(device, 0x30))                                          -- Switch into Scene Mode??!!
  device:send(onoff_custom_attr:read(device))

Note: this process must happen at doConfigure and it may take a few discovery tries (it took me two tries).

So, I’m really excited that I finally got the events and I hope to finish the driver in the upcoming days.

Cheers!


UPDATE

If anyone is interested in give it a try to this driver, please review the supported models at the erickvneri/erickv-edge-drivers GitHub page and enroll your hub into the following channels:

5 Likes

Yes thats a good news !!

Great work! I’m sure many people will be interested in this driver. :sunglasses:

One small clarification:

Most manufacturers use the standard Zigbee 3.0 clusters, but Tuya specifically does not for many of its models. And since those devices are then sold to literally more than a dozen other manufacturers (like Moes) who add their own firmware, tweak the features a little bit, and rebrand the device with their label, it can seem like there’s no standardization. But there is, it’s just that the Zigbee standard does allow for manufacturer-proprietary versions, and Tuya has gone in for that in a big way.

So basically if you buy a Zigbee device which says it will work with the Smart Life app or which has a Tuya logo, be prepared to have to look for, or create, custom code.

image

But Zigbee 3.0 devices from other device manufacturers will probably be much more standardized, with the exception that some hardcode a Zigbee group number into their devices while others don’t.

2 Likes

Awesome! thanks for the details, Rob :raised_hands:t3: I’ll take that into consideration for the next project and to scrap further in terms of research regarding Tuya devices.

Fortunately, I’ve been able to set up the driver and it is working with my current environment. I believe that as soon as I’m able, I’ll be sharing it at #devices-integrations.

BTW, @JDRoberts do you consider that it would be accurate to label the 0xE001 cluster as TuyaCluster? I choose that name momentarily, but I’m not 100% sure that it’s a specific reference.

Most platforms label it “TuyaSpecific.”

They’re all clusters, so you don’t need that in the name. :wink:

1 Like

@erickv 0xE001 cluster meaning and usage are unknown for me.
What deserves to be called TuyaCluster is 0xEF00, which is used by a lot of Tuya devices to tunnel their very specific Tuya ‘serial protocol’ commands to Zigbee. But this cluster is not used by TS004F.

2 Likes

Nice! Thanks a lot for addressing the insights guys!!

Tuya has multiple manufacturer-proprietary clusters, used on different models.

See for example:

It’s possible that 0xE001 is from their older ZHA profile devices, I’m not sure.

1 Like

Hello! where could i find the dh del moes 3 gang? could you help me? thank you!

Hi, @Fabcoach

You could check if one of the DTHs shared along with this thread works on your device

My edge driver for the 4-gang MOES is already functional, but I’m not sure if the pairing process is the same for the 3-gang MOES, but we can check if you want, you’d just need to share with me the manufacturer and model info from the Groovy IDE once you get your device “paired” as a Thing.

Notice that it should be discoverable even if it isn’t supported by any DTH / Driver on your account.

1 Like

Thanks, it’s very kind of you. I can’t find any data inside the thing though. can you tell me where to look best?

If I recall correctly, the process I followed to collect these two values was this (without any DTH installed):

  • Set device in pairing/discovery mode.
  • From the SmartThings App, run the scan feature ( “+” > Add device > scan) and it should be added as "Thing"
  • Go to Groovy IDE > My Devices > Thing and under data you should find some device info including manufacturer and model.

p.d. Please, someone, correct me if I’m wrong. Right now I’m not able to remove and replicate the flow.


By the way @Fabcoach, you could check one of these DTHs, since specifically mention that supports the 3-gang MOES Scene Switch (manufacturer _TZE200_tz32mtza, model TS0601). And if it works, I can add the fingerprint to the driver right away =]

Here you are! thanks again for the help!

  • zigbeeNodeType: SLEEPY_END_DEVICE
  • application: 42
  • endpointId: 01
  • manufacturer: _TZ3000_gbm10jnj
  • model: TS0043
1 Like

Nice! Thanks for the info, @Fabcoach.

I’ve added the fingerprints under a dev branch and created a dev edge channel so you can enroll your Hub and then install the driver:

If you test it out, make sure to remove it from your SmartThings ecosystem first and pair it again as soon as the driver is installed. This is quite necessary to override the device type, i.e. from DTH to ZIGBEE, which refers to edge.

(Note: I’ve already ordered my 3-Button MOES Scene Switch from aliexpress in case you don’t want to unset the routines that you may have lol)

1 Like

Works perfectly, Thank You!

2 Likes

Great!

Thanksfor the feedback, @SeanYem!!

Just for curiosity, did you try the TS004F or TS0043?

It was the TS004F, Not Branded, so Not Moes, Just sold as Tuya Zigbee 4 Gang Wireless Switch on Amazon UK.

_TZ3000_xabckq1v
TS004F

Cheers mate

2 Likes

Any chance your driver will also work for the 2 button version?

Following your earlier conversation here is the device info:

  • application: 42
  • endpointId: 01
  • manufacturer: _TZ3000_dfgbtub0
  • model: TS0042
  • zigbeeNodeType: SLEEPY_END_DEVICE

Not configured it for anything yet, so more than willing to experiment if needed.

Thanks for all your work on this!

Awesome, @James_Kriebel. Thanks for the contribution.

I’ve added the fingerprint at the button-battery-v1.0.1 version of the driver which you can install following the link from below:

Please, let me know if your device works as expected, as I’ll be happy to know that probably the 3-Button MOES I’m expecting from Aliexpress may work as well = )

1 Like