[APP][Pro] Tuya Zigbee App

Since the latest uodate with the fix for the dimmers all 2 gang dimmers fail to turn off (I have various brands and all have the same issue now, resarted Homey ofc to rule that out ) . Once turned on they stay on for ever. Flipping one of the 2 switches flips both on the homey status . so if impress channel 1 channel 2 also turns on in the status. In real life the lights just stay on for ever.

Rolled back to 2.26 and all is ok again

Ooops, my bad. Restored in new version out now. Was working with the tuya cluster version of the 2 gang dimmer and accidentally made these changes to the other driver… :frowning:

Hello @johan_bendz !
First of all, thanks for your work! :+1:t2:
Do you plan to maintain/update the live version of your application?
It hasn’t been updated for 4 years, and I think many users are unaware that there is a much more mature test version.

Hi @Mikl, I’m currently pushing a bunch of updates to the test version and will then push that to the Live version (unless we run into huge issues…).

2 Likes

Excellent news, thanks for the feedback!

Hi
Thanks for the job.
Do you think about adding the parameter of the module Wall mounted curtain switch ?
Thanks for feedback

Hi @johan_bendz ,
just to mention: I love this App :green_heart: and I will use it as long as possible.
I might also install the new official tuya App but I will only use it for devices I cannot connect directly like in this App, and only as long as they are not supported here or in other community Apps. Many thank to all your work. :pray: :people_hugging:

1 Like

@johan_bendz thanks a lot for the updates! Nice to see so much progress!

I don’t now exactly what the order of updates is, and if I am allowed to ask this question here in this topic, but can you please add the following branch to the next update? It is allready finished 7 months ago.

Asking because of a radar sensor I’m using (_TZE204_sxm7l9xa) wich now only reports lux, and no other values. But that has been fixed in this branch.

Hi @Marcel_Visser, that PR is what I would consider “dirty” :sweat_smile:. Shaarkys made some nice additions, but also added breaking changes that will require me to update or validate quite a bit of code to implement without issues.

It’s on my list, though. I’ll extract the device/driver updates and implement those in the meantime (in Shaarkys’ words: “cherry pick”) :blush:.

2 Likes

I know Johan but I guess month later you just refactored significantly your own app :wink:, so that’s why it’s even more “dirty” (+ still being just “home” developer, so expect only dirty code :laughing:).

I just hope you can cherry pick relevant parts (eg. like data points) and make it working in your fork or keeping and reuse the new drivers.

Btw, all the devices I added are now proved to be working since then including the new battery measurements etc.

2 Likes

Haha, no problems :smiley: Happy for any and all help! And yes, I’v been doing some structural changes myself… more to come! :smiley:

3 Likes

any chance for supporting this mmwave device?

https://de.aliexpress.com/item/1005006803782882.html

Read the first post on how to request device support (tip: just pointing to an Aliexpress page isn’t nearly enough for the developer to implement support).

1 Like

Concerning Ripoffs of the Tuya Zigbee App

Hi everyone,

It has recently come to my attention that several ripoff versions of my Tuya Zigbee app are starting to appear. Individuals or companies have copied the app, removed all devices except for their own, and then added their specific products to the app.

I’ve reviewed the outstanding requests in the GitHub repository for the app and found no mention of these brands or any attempts to contribute code or collaborate on their inclusion. While my code is open-source and available to all, I can’t help but feel it’s a bit poor form that no one reached out to ask or inform me first.

If you’re working on or benefiting from the Tuya Zigbee app, I encourage you to contribute back to the project, or at the very least, make your own app’s code publicly available. This way, others can also benefit from any new device integrations or improvements you’ve made.

Thanks for understanding, and let’s continue to grow this great community together!

// Johan

9 Likes

Hi Johan
it’s a shame that they show off with your hard work and we may hope that they also going to develop useful App’s for the Homey system.
And getting back to your updates lately they all work except from there is no Battery level shown in the Siren _TZE204_t1blo2bj and no reading from Formaldehyde on the Smart airbox _TZE200_yvx5lh6k.
And coming back on the memory leak that you mentioned before is that fixed already that you know, because I still have to restart the app every 2 hour’s with a flow.

Thank for all your good work,
Best regards Peter.

Hello fellow developers and contributors,

I’m excited to announce that a new test version of the Tuya Zigbee app has been published on the Homey App Store. This update focuses primarily on refactoring the codebase to make the app more maintainable and scalable, especially when it comes to handling Tuya-specific Zigbee devices.

In this post, I’ll explain the recent changes, how they streamline development, and how you can leverage these updates to improve or contribute to the app. While this release doesn’t promise huge improvements for end users immediately, it’s laying the foundation for better stability, faster integration of new devices, and a more efficient development process.

Overview of Changes

  1. Helper Files: Introduced TuyaHelpers.js and TuyaDataPoints.js to centralize utility functions and datapoint (DP) definitions, making it easier to manage device interactions and add new devices.
  2. Tuya-Specific Clusters and Devices: Detailed the usage of TuyaSpecificCluster.js and TuyaSpecificClusterDevice.js, which simplify the integration and communication with Tuya Zigbee devices.

New Helper Files

  1. TuyaHelpers.js:
  • A set of utility functions like getDataValue, marshalSchedule, and parseSchedule, designed to simplify working with Tuya Datapoints (DPs).
  • Example: To handle a DP value, instead of manually parsing its structure, you can simply call getDataValue(dpValue). This streamlines how we interpret DPs in different devices.
  1. TuyaDataPoints.js:
  • Centralizes all the known datapoints for Tuya devices (e.g., thermostats, lights, switches), making it easier to add new devices or modify existing ones without duplicating code.
  • This allows for a more consistent and scalable approach to DP management.

Tuya-Specific Cluster and Device Classes

In addition to these helper files, the Tuya-specific Zigbee protocol requires some specialized handling. To that end, the app uses custom clusters and device classes.

  1. TuyaSpecificCluster.js
  • This defines the Tuya-specific Zigbee cluster (ID: 61184), which handles commands like datapoint, reporting, and response for Tuya devices. These commands facilitate communication between Zigbee devices using the Tuya protocol.
  • Usage: In your device drivers, you register this cluster by adding Cluster.addCluster(TuyaSpecificCluster). Once registered, it listens for events like reporting, response, or datapoint changes and triggers the appropriate actions.
  • Example: If you need to handle a device reporting a change in one of its datapoints, you can listen to the reporting event and update the device’s state in Homey accordingly.
  1. TuyaSpecificClusterDevice.js
  • This extends the Homey ZigBeeDevice class to add methods for writing data to Tuya datapoints. It abstracts writing booleans, integers, strings, enums, and raw data to the device.
  • Key functions include:
    • writeBool(dp, value): Sends a boolean value to a specific datapoint.
    • writeData32(dp, value): Sends a 32-bit integer to a datapoint.
    • writeString(dp, value): Sends a string to a datapoint.
    • writeEnum(dp, value): Sends an enum value to a datapoint.
    • writeRaw(dp, data): Sends raw data to a datapoint.
  • This class manages the transaction IDs required by Tuya’s protocol, automatically incrementing with each new command, so you don’t need to worry about manually managing transaction states.
  1. TuyaZigBeeLightDevice.js
  • This is a base class for handling Tuya Zigbee light devices with capabilities like onoff, dim, light_hue, light_saturation, light_temperature, and light_mode.
  • It handles different lighting modes (e.g., color, temperature) and includes methods to manage dimming, changing colors, or adjusting color temperature.
  • The class utilizes a debounced approach to handle multiple capability changes at once (e.g., changing brightness and color simultaneously).
  • A noteworthy feature is its ability to fall back to default values when specific attributes like hue or saturation aren’t provided, ensuring the device always operates smoothly even if some settings are missing.

Usage for Developers

If you’re contributing to this project or adding new devices to your own forks, here’s how you can use these files:

  1. Adding Support for New Devices:
  • When adding a new device that follows the Tuya protocol, instead of writing all the DP parsing logic yourself, you can simply extend the TuyaSpecificClusterDevice class and utilize methods like writeBool() or writeData32() to communicate with the device.
  • For lights, extend TuyaZigBeeLightDevice to inherit all the base functionality and then register any additional capabilities specific to your device.
  1. Using TuyaSpecificCluster in Your Driver:
  • In your driver file, you can easily register the Tuya-specific cluster by adding the following lines:
const TuyaSpecificCluster = require('../../lib/TuyaSpecificCluster');
Cluster.addCluster(TuyaSpecificCluster);
  • This allows your driver to receive and handle Tuya-specific commands, such as datapoint reporting.
  1. Centralized DP Management:
  • Rather than hardcoding each DP value across multiple files, you can import the TuyaDataPoints.js file to access standardized datapoints for various devices, ensuring your code remains clean and DRY (Don’t Repeat Yourself).

What’s Next:

The introduction of these changes is primarily aimed at developers and those contributing to the Tuya Zigbee app. While users may notice small improvements in certain areas, the bigger impact will come as more devices are integrated and the codebase becomes easier to maintain and extend.

I’m also planning to refactor more drivers to make use of this centralized logic, and if you’re working on new device integrations, feel free to join in, use the helper files, and share your feedback. This is a collaborative effort, and any improvements you make to the helper files or clusters will benefit the entire Homey community.

Let’s continue making this app stronger and more scalable!

A big thank you to all the contributors so far. Your input has been invaluable, and I look forward to seeing more of your contributions and ideas!

// Johan

10 Likes

Very impressive Johan (and others?)
I’d almost think this needs a new topic or the current one needs archiving all previous posts.

Thanks for this new beginning regarding a shitload of hardware.

1 Like