TL;DR: both z2m and ZHA support a lot of Mercator devices.
Yes, they seem to have a database saying they support it, but what I’m lacking (or what I’m finding) is that the standard ZB commands don’t work and require specific device attributes written that are Tuya specific. That’s the detail that I’m lacking and also not really certain on how you’re supposed to write those attributes in Homey. There is a truck-load of details missing in the Homey developer docs that don’t cover all the ways you can update/write to a ZB device. Even looking at other example apps don’t help as they approach taken differs from the Homey stated ways of doing things… The HA crew seem to make it look so easy, and I’m at a loss as to where they are making it easy in the ZB space whereas Homey seems to be making it hard (or harder).
As an example to illustrate the point, how would you suggest you turn on and off and set the level for the Mercator Ikuu Light Dimmer 1 Gang ? Provide some simple JS that you think would work based on what you can easily find on HA’s databases of supported devices??
So far, I seem to be having a little success borrowing a bit of the Tuya code from GitHub - JohanBendz/com.tuya.zigbee
I’ll be working on this device next… within the next week.
Which specific switches are you going to be using?
And yet, there are plenty of Zigbee devices supported by apps that are made by community members
How?
I guess by being pragmatic. If something works for a particular developer, and they are sharing their code, it’s a good source to learn from. The documentation may not always be fully correct or complete, or scattered, but others have figured out how to handle things like custom clusters/attributes, like the ones TuYa uses, so Homey is capable of it.
SSW04 and SSW01 will be the main ones.
Here is a good and super frustrating example of the lack of docs and overall confusion a new developer like me runs into when working with Homey.
The current Tuya App that is published has the following packages for homey and zigbee clusters
"homey-zigbeedriver": "^1.6.12",
"zigbee-clusters": "^1.5.2"
But the latest of these are
"homey-zigbeedriver": "^2.1.4",
"zigbee-clusters": "^2.4.1"
Using the latest packages this code (from the Tuya App) doesn’t work … its deprecated and syntax for attributes needs to be put in an array.
await zclNode.endpoints[1].clusters.basic.readAttributes('manufacturerName', 'zclVersion', 'appVersion', 'modelId', 'powerSource', 'attributeReportingStatus')
.catch(err => {
this.error('Error when reading device attributes ', err);
});
If you use the latest packages (as I did) you get the following error…
rror when reading device attributes Error: Expected attribute names array, as of zigbee-clusters@2.0.0 call readAttributes(['myAttr'])
at BasicCluster.readAttributes (/app/node_modules/zigbee-clusters/lib/Cluster.js:408:13)
at LightDimmerDevice.onNodeInit (/app/drivers/light_dimmer_sswd01/device.js:24:47)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async /app/node_modules/homey-zigbeedriver/lib/ZigBeeDevice.js:949:11
I appreciate your suggestion to follow the work of other developers, but I feel that it oversimplifies the challenges I’ve been facing. It’s been quite difficult, and I wish there was a bit more support and guidance available. Navigating this process hasn’t been easy for me.
I doubt I can be much help with the development here. But I was looking at just running it through ZIGBEE2MQTT which seems to be compatible with hokey. I’ve been reading up on that. TuYa TS0011 control via MQTT | Zigbee2MQTT
Do you mind refrencing the very specific device from this page - as I just wish to be sure.
These are the 2 that I require. Everything else I’m going to buy I plan to be homey compatible.
But as you would know in Australia there isn’t a whole range of zigbee light switches that are compliant.
Like I said: be pragmatic, put your attributes in an array like the error message says
Okay, so yep thats obvious when it has been pointed out to you, but the example of using some community members code to learn doesn’t always just simply work.
So I’ll move onto the next issue I’m facing… subdevices.
Cannot seem to figure out how you’re supposed to make Homey support a device that has two outlets/plugs/sockets (whatever).
I’ve looked at a lot of the code which seems to mirror the information found here
But for the life of me, I cannot seem to see how my device has two on/off buttons and how you would enable the second (or 3rd, 4th etc) switch in a Zigbee device that has them.
In addition, when logging the output of
const { subDeviceId } = this.getData();
this.log('Device data: ', subDeviceId);
I get this…
2024-05-29T05:46:40.205Z [log] [ManagerDrivers] [Driver:double_power_point_spp02g] [Device:7554c90a-605f-46ed-9983-b0dfc9fa340f] Device data: undefined
So its not working nor is it clear where I might be going wrong? Everything looks correct. Is this another case of new package does it differently and maybe the docs on Athom are incorrect vs the latest package release for Zigbee etc?
So the result of this.getData()
has no key named subDeviceId
, which suggests there’s something wrong with the way you’re creating them.
Here are some repositories that use more recent versions of the Zigbee packages and use sub devices (only a simple Github search for “homey subDeviceId” away…):
Yep, finally stumbled onto the issue - it was a incorrectly placed "devices": {
within the driver.compose.json
My bad
If possible, can you grab the Interview log from your Homey for your devices? (just add the device and run the Interview on this page Homey Developer Tools )
Sorry, I haven’t got one yet as I was still deciding whether i was going Homey or HA. But seeing this slowly come together I think I’ll go the Homey route.
Out of curiosity can the dimmer switch be used with standard downlighting and just used as an on/off?