Mariano-Github / Edge-Drivers-Beta

Edge Driver Beta Modified for Created
Apache License 2.0
122 stars 121 forks source link

Add Tuya EF00 cluster support and handler for ZG-204ZL motion sensor. #39

Closed simontuckwell closed 1 year ago

simontuckwell commented 1 year ago

Added groundwork to support Tuya EF00 cluster. Added handler for ZG-204ZL Luminance Motion Sensor (https://www.aliexpress.com/item/1005004095233195.html).

The PowerConfiguration commands in do_configure() may need to be removed - at the moment they log "unsupported" messages but do not cause any errors.

Mariano-Github commented 1 year ago

Hello,

Thanks for your contribution, I don't know anything about how to handle the custer EF00.

Sorry, the code that was on github was not updated, although since it is an independent subdriver it does not affect you almost anything.

It only affects you, that I have added a custom capability to all profiles to show the signal metrics taken from the message received in the Hub.

To show and works this capability on your device you just have to add this code in your subdriver:

declaration of the module "signal-metrics" local signal = require "signal-metrics"

Add in this function handler the call to emit the signal metrics event:

local function tuya_handler(self, device, zb_rx)
      -- emit signal metrics
      signal.metrics(device, zb_rx)

I will upload the updated code

simontuckwell commented 1 year ago

Hi Mariano,

Until a couple of days ago I didn't know anything about the EF00 cluster either! I've had to reverse engineer it.

Thanks for the advice; I'll update the PR.

Mariano-Github commented 1 year ago

Sorry, I'm not good at github

If you want, I could add the subdriver and your changes on github manually and add the signal metrics code

As you say, I can also remove the battery percentage attribute configuration.

I update the driver and publish it.

I can publish it in the smartthings community giving you the thanks and the credits of adding support for EF00 cluster in Tuya motion sensors

simontuckwell commented 1 year ago

I've added signal-metrics to the tuya handler. I don't see any signal metrics appearing in the app though so I might need more configuration or code. I didn't see that you had already add the signal-metrics.lua so my copy will probably need to be deleted.

I commented out the PowerConfiguration code but still see the same error: 2022-11-24T10:14:48.436245084+00:00 WARN Zigbee Motion Sensor Mc Device does not support cluster 0x0400 not adding configured attribute 2022-11-24T10:14:48.541462750+00:00 INFO Zigbee Motion Sensor Mc Device does not support cluster 0x0400 not adding monitored attribute so it must be something else.

Mariano-Github commented 1 year ago

2022-11-24T10:14:48.436245084+00:00 WARN Zigbee Motion Sensor Mc Device does not support cluster 0x0400 not adding configured attribute 2022-11-24T10:14:48.541462750+00:00 INFO Zigbee Motion Sensor Mc Device does not support cluster 0x0400 not adding monitored attribute

This error is due to default libraries see the capability illuminance in profile, but device has not cluster 0400 and then not send the default configuration for this cluster. This is not important, only a log warnning

Mariano-Github commented 1 year ago

Yes, probable You need update your driver code copy

I didn't see that you had already add the signal-metrics.lua so my copy will probably need to be deleted.

simontuckwell commented 1 year ago

That's done. You should be able to merge now.

Mariano-Github commented 1 year ago

Ok,

Do you give me permission to publish the driver with the changes and publish your credits and thanks for this improvement in the smartthings community?

simontuckwell commented 1 year ago

Thanks for your help Mariano. Please go ahead and publish the driver.

Mariano-Github commented 1 year ago

Thanks for You Simon