Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
11.77k stars 1.64k forks source link

[New device support]: Tuya ZigBee & RF 2CH LED Controller (model WZ1) #13490

Closed jacekmarek closed 2 years ago

jacekmarek commented 2 years ago

Link

12-36VDC 2CH*5A ZigBee & RF LED Controller WZ1 (Tuya App) http://www.iskydance.com/index.php?c=product_show&a=index&id=1583 http://www.iskydance.com/uploads/goods_file/WZ1.pdf

Database entry

{"id":33,"type":"Router","ieeeAddr":"0xa4c138f8ec0e9858","nwkAddr":2569,"manufId":4417,"manufName":"_TZB210_rkgngb5o","powerSource":"Mains (single phase)","modelId":"TS0501B","epList":[1,242],"endpoints":{"1":{"profId":260,"epId":1,"devId":257,"inClusterList":[3,4,5,6,4096,8,768,61184,0],"outClusterList":[25,10],"clusters":{"genBasic":{"attributes":{"modelId":"TS0501B","manufacturerName":"_TZB210_rkgngb5o","powerSource":1,"zclVersion":3,"appVersion":64,"stackVersion":0,"hwVersion":1,"dateCode":""}},"lightingColorCtrl":{"attributes":{}},"genLevelCtrl":{"attributes":{"currentLevel":12}}},"binds":[{"cluster":0,"type":"endpoint","deviceIeeeAddress":"0x00212effff077814","endpointID":1}],"configuredReportings":[],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":64,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{"configured":821693351},"lastSeen":1660159971579,"defaultSendRequestWhen":"immediate"}

Comments

I got stuck on control from push button - no states updates when the button is used. What works from Z2M : state, brightness, link quality What does not work from Z2M: effect (no effects)

External converter

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;
const globalStore = require('zigbee-herdsman-converters/lib/store');
const ota = require('zigbee-herdsman-converters/lib/ota');
const tuya = require('zigbee-herdsman-converters/lib/tuya');

const definition =[
        {
        fingerprint: [{modelID: 'TS0501B', manufacturerName: '_TZ3000_4whigl8i'},
            {modelID: 'TS0501B', manufacturerName: '_TZ3210_4whigl8i'},
            {modelID: 'TS0501B', manufacturerName: '_TZ3210_9q49basr'},
            {modelID: 'TS0501B', manufacturerName: '_TZB210_rkgngb5o'},
            {modelID: 'TS0501B', manufacturerName: '_TZ3210_grnwgegn'},
            {modelID: 'TS0501B', manufacturerName: '_TZ3210_wuheofsg'}],
        model: 'WZ1',
        description: 'ZigBee & RF 2CH LED Controller',
        vendor: 'Skydance (TuYa)',
        extend: extend.light_onoff_brightness(),
        },
]

module.exports = definition;

Supported color modes

mono/CCT

Color temperature range

No response

jacekmarek commented 2 years ago

Another test:

External converter

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;
const tuya = require("zigbee-herdsman-converters/lib/tuya");

const definition = {
    // Since a lot of Tuya devices use the same modelID, but use different data points
    // it's usually necessary to provide a fingerprint instead of a zigbeeModel
    fingerprint: [
        {
            // The model ID from: Device with modelID 'TS0601' is not supported
            // You may need to add \u0000 at the end of the name in some cases
            modelID: 'TS0501B',
            // The manufacturer name from: Device with modelID 'TS0601' is not supported.
            manufacturerName: '_TZB210_rkgngb5o'
        },
    ],
    model: 'WZ1',
    vendor: 'Skydance (TuYa)',
    description: 'ZigBee & RF 2CH LED Controller',
    fromZigbee: [
        fz.ignore_basic_report, // Add this if you are getting no converter for 'genBasic'
        fz.tuya_data_point_dump, // This is a debug converter, it will be described in the next part
    ],
    toZigbee: [
        tz.tuya_data_point_test, // Another debug converter
    tz.light_onoff_brightness,
    ],
    onEvent: tuya.onEventSetTime, // Add this if you are getting no converter for 'commandMcuSyncTime'
    configure: async (device, coordinatorEndpoint, logger) => {
        const endpoint = device.getEndpoint(1);
        await reporting.bind(endpoint, coordinatorEndpoint, ['genBasic']);
    },
    exposes: [
        // Here you should put all functionality that your device exposes
    ],
};

module.exports = definition;

What works from Z2M : state, brightness, link quality

Zigbee2MQTT:debug 2022-08-12 10:05:57: Received MQTT message on 'zigbee2mqtt/0xa4c138f8ec0e9858/set' with data '{"state": "on", "brightness":10}'
Zigbee2MQTT:debug 2022-08-12 10:05:57: Publishing 'set' 'brightness' to '0xa4c138f8ec0e9858'
Zigbee2MQTT:info  2022-08-12 10:05:57: MQTT publish: topic 'zigbee2mqtt/0xa4c138f8ec0e9858', payload '{"brightness":10,"last_seen":"2022-08-12T10:05:57+02:00","linkquality":255,"state":"ON"}'
Zigbee2MQTT:info  2022-08-12 10:05:57: MQTT publish: topic 'zigbee2mqtt/0xa4c138f8ec0e9858', payload '{"brightness":10,"last_seen":"2022-08-12T10:05:57+02:00","linkquality":255,"state":"ON"}'
Zigbee2MQTT:debug 2022-08-12 10:07:14: Received Zigbee message from '0xa4c138f8ec0e9858', type 'attributeReport', cluster 'genBasic', data '{"appVersion":64}' from endpoint 1 with groupID null
Zigbee2MQTT:info  2022-08-12 10:07:14: MQTT publish: topic 'zigbee2mqtt/0xa4c138f8ec0e9858', payload '{"brightness":10,"last_seen":"2022-08-12T10:07:14+02:00","linkquality":255,"state":"ON"}'

Pressing the button is not visible in the Z2M logs. What am I doing wrong with debugging?

Koenkk commented 2 years ago

Do you get updates for on/off brightness when changing the configure code to:

    configure: async (device, coordinatorEndpoint, logger) => {
        const endpoint = device.getEndpoint(1);
        await reporting.bind(endpoint, coordinatorEndpoint, [ 'genOnOff', 'genLevelCtrl']);
            await reporting.onOff(endpoint);
            await reporting.brightness(endpoint);
    },
jacekmarek commented 2 years ago

I get updates now: off -> on (short press the button):

2022-08-13 12:49:15 Received Zigbee message from '0xa4c138f8ec0e9858', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID null
info 2022-08-13 12:49:15MQTT publish: topic 'zigbee2mqtt/0xa4c138f8ec0e9858', payload '{"brightness":254,"last_seen":"2022-08-13T12:49:14+02:00","linkquality":255,"state":"OFF"}'

on -> off (short press the button):

debug 2022-08-13 12:51:09 Received Zigbee message from '0xa4c138f8ec0e9858', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID null
info 2022-08-13 12:51:09MQTT publish: topic 'zigbee2mqtt/0xa4c138f8ec0e9858', payload '{"brightness":254,"last_seen":"2022-08-13T12:51:08+02:00","linkquality":255,"state":"OFF"}'

off -> on (press and hold the button), brightness from 0 to ~60%:

 2022-08-13 12:56:48 Received Zigbee message from '0xa4c138f8ec0e9858', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID null
info 2022-08-13 12:56:48MQTT publish: topic 'zigbee2mqtt/0xa4c138f8ec0e9858', payload '{"brightness":254,"last_seen":"2022-08-13T12:56:47+02:00","linkquality":255,"state":"OFF"}'
debug 2022-08-13 12:56:53Received Zigbee message from '0xa4c138f8ec0e9858', type 'attributeReport', cluster 'genLevelCtrl', data '{"currentLevel":220}' from endpoint 1 with groupID null
info 2022-08-13 12:56:53MQTT publish: topic 'zigbee2mqtt/0xa4c138f8ec0e9858', payload '{"brightness":254,"last_seen":"2022-08-13T12:56:52+02:00","linkquality":255,"state":"OFF"}'

on, press and hold the button - brightness from max to min:

2022-08-13 12:59:23 Received Zigbee message from '0xa4c138f8ec0e9858', type 'attributeReport', cluster 'genLevelCtrl', data '{"currentLevel":1}' from endpoint 1 with groupID null
info 2022-08-13 12:59:23MQTT publish: topic 'zigbee2mqtt/0xa4c138f8ec0e9858', payload '{"brightness":254,"last_seen":"2022-08-13T12:59:22+02:00","linkquality":255,"state":"OFF"}'

on, press and hold the button - brightness from min to max:

2022-08-13 13:00:59Received Zigbee message from '0xa4c138f8ec0e9858', type 'attributeReport', cluster 'genLevelCtrl', data '{"currentLevel":254}' from endpoint 1 with groupID null
info 2022-08-13 13:00:59MQTT publish: topic 'zigbee2mqtt/0xa4c138f8ec0e9858', payload '{"brightness":254,"last_seen":"2022-08-13T13:00:58+02:00","linkquality":255,"state":"OFF"}'
Koenkk commented 2 years ago

Great, what is left?

jacekmarek commented 2 years ago

When I publish { "state": "on", "brightness": 1 } - 1 is the minimum brightness:

debug 2022-08-13 17:46:09 Received MQTT message on 'zigbee2mqtt/0xa4c138f8ec0e9858/set' with data '{ "state": "on", "brightness": 1 }'
debug 2022-08-13 17:46:09 Publishing 'set' 'brightness' to '0xa4c138f8ec0e9858'
info 2022-08-13 17:46:09 MQTT publish: topic 'zigbee2mqtt/0xa4c138f8ec0e9858', payload '{"brightness":63,"last_seen":"2022-08-13T17:46:09+02:00","linkquality":255,"state":"ON"}'
info 2022-08-13 17:46:09 MQTT publish: topic 'zigbee2mqtt/0xa4c138f8ec0e9858', payload '{"brightness":1,"last_seen":"2022-08-13T17:46:09+02:00","linkquality":255,"state":"ON"}'
debug 2022-08-13 17:46:09 Received Zigbee message from '0xa4c138f8ec0e9858', type 'attributeReport', cluster 'genLevelCtrl', data '{"currentLevel":1}' from endpoint 1 with groupID null
info 2022-08-13 17:46:10 MQTT publish: topic 'zigbee2mqtt/0xa4c138f8ec0e9858', payload '{"brightness":1,"last_seen":"2022-08-13T17:46:09+02:00","linkquality":255,"state":"ON"}'

I can still lower the brightness with the button, the LED strip reduces the brightness to new minimum.

The controller has feature: Double Click - Turn on at 100% or 10%(night light) and vice-versa. Double Click - on at 100% in log: '{"currentLevel":254}' - not max brightness = 255

debug 2022-08-13 21:54:55 Received Zigbee message from '0xa4c138f8ec0e9858', type 'attributeReport', cluster 'genLevelCtrl', data '{"currentLevel":254}' from endpoint 1 with groupID null

Double Click - Turn on at 10% in log: '{"currentLevel":24}' - not 10% of 255 = ~25

debug 2022-08-13 21:54:58Received Zigbee message from '0xa4c138f8ec0e9858', type 'attributeReport', cluster 'genLevelCtrl', data '{"currentLevel":24}' from endpoint 1 with groupID null

Great, what is left?

Please complete the external converter file with the required parameters.

Koenkk commented 2 years ago

Double Click - Turn on at 100% or 10%(night light) and vice-versa.

To add this option the correct data point for this setting has to be found: https://www.zigbee2mqtt.io/advanced/support-new-devices/03_find_tuya_data_points.html

I can still lower the brightness with the button, the LED strip reduces the brightness to new minimum.

Is it also possible to reduce the brightness lower than the { "state": "on", "brightness": 1 } with the TuYa gateway? Then it might be that TuYa uses a different command for this and reverse engineering via the TuYa gateway is necessary (like the point above).

jacekmarek commented 2 years ago

I don't have a TuYa gateway, please skip these cases.

Koenkk commented 2 years ago

Can you provide your external converter? Then I can add it.

jacekmarek commented 2 years ago
const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;
const tuya = require("zigbee-herdsman-converters/lib/tuya");

const definition = {
    // Since a lot of Tuya devices use the same modelID, but use different data points
    // it's usually necessary to provide a fingerprint instead of a zigbeeModel
    fingerprint: [
        {
            // The model ID from: Device with modelID 'TS0601' is not supported
            // You may need to add \u0000 at the end of the name in some cases
            modelID: 'TS0501B',
            // The manufacturer name from: Device with modelID 'TS0601' is not supported.
            manufacturerName: '_TZB210_rkgngb5o'
        },
    ],
    model: 'WZ1',
    vendor: 'TuYa',
    description: 'ZigBee & RF 2CH LED Controller',
    fromZigbee: [
        fz.ignore_basic_report, // Add this if you are getting no converter for 'genBasic'
        fz.tuya_data_point_dump, // This is a debug converter, it will be described in the next part
    ],
    toZigbee: [
        tz.tuya_data_point_test, // Another debug converter
        tz.light_onoff_brightness,
    ],
    onEvent: tuya.onEventSetTime, // Add this if you are getting no converter for 'commandMcuSyncTime'
    configure: async (device, coordinatorEndpoint, logger) => {
        const endpoint = device.getEndpoint(1);
        await reporting.bind(endpoint, coordinatorEndpoint, [ 'genOnOff', 'genLevelCtrl']);
            await reporting.onOff(endpoint);
            await reporting.brightness(endpoint);
    },  

    exposes: [
        // Here you should put all functionality that your device exposes
    ],
};

module.exports = definition;
Koenkk commented 2 years ago

Thanks, added the device.

Changes will be available in the dev branch in a few hours from now. (https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html)

jacekmarek commented 2 years ago

I confirm, it works. Great job, for you. Please delete effects from configuration, it is don't work.

Check https://github.com/Koenkk/zigbee2mqtt/issues/13446#issuecomment-1207451840, user z0mb1ek has controller WZ5 Zigbee Tuya with this same fingerprint as mine - modelID: 'TS0501B', manufacturerName: '_TZB210_rkgngb5o', how is it possible?

Koenkk commented 2 years ago

I'm not sure if he got it working completely, he didn't follow up on my latest comment.

mpetro89 commented 1 year ago

I got the same Tuya WZ1 device with a different modelID: "TS0503B" and manufacturerName: "_TZB210_nfzrlz29".

https://www.aliexpress.com/item/1005001884086871.html

Database entry:

{"id":9,"type":"Router","ieeeAddr":"0xa4c13820760a5d22","nwkAddr":51798,"manufId":4417,"manufName":"_TZB210_nfzrlz29","powerSource":"Mains (single phase)","modelId":"TS0503B","epList":[1,242],"endpoints":{"1":{"profId":260,"epId":1,"devId":268,"inClusterList":[3,4,5,6,4096,8,768,61184,0],"outClusterList":[25,10],"clusters":{"genBasic":{"attributes":{"stackVersion":0,"dateCode":""}},"genOnOff":{"attributes":{"onOff":1}}},"binds":[{"cluster":6,"type":"endpoint","deviceIeeeAddress":"0x00124b0024c85e59","endpointID":1},{"cluster":8,"type":"endpoint","deviceIeeeAddress":"0x00124b0024c85e59","endpointID":1}],"configuredReportings":[{"cluster":6,"attrId":0,"minRepIntval":0,"maxRepIntval":3600,"repChange":0},{"cluster":8,"attrId":0,"minRepIntval":0,"maxRepIntval":3600,"repChange":1}],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":64,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{"configured":-1455162343},"lastSeen":1664088690292,"defaultSendRequestWhen":"immediate"}

Please add support for that one.

Koenkk commented 1 year ago

@mpetro89 _TZB210_nfzrlz29 will be supported in the next release (1 Oct)

mpetro89 commented 1 year ago

@Koenkk you added {modelID: 'TS0502B', manufacturerName: '_TZB210_nfzrlz29'}. But if you look my comment, I have different modelID: "TS0503B", with the same manufacturerName: '_TZB210_nfzrlz29'

Koenkk commented 1 year ago

@mpetro89 sorry, added it now!

Changes will be available in the dev branch in a few hours from now. (https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html)

mpetro89 commented 1 year ago

Now it's ok, but I don't receiving status updates, when pressing push button (ON/OFF, brightness)...

mpetro89 commented 1 year ago

Now it's ok, but I don't receiving status updates, when pressing push button (ON/OFF, brightness)...

@Koenkk Can you please help me with that? I'm still not receiving status updates, when I'm pressing physical button...

Koenkk commented 1 year ago

Try to setup reporting for the genOnOff cluster, onOff attribute in the z2m frontend -> device -> reporting tab.

mpetro89 commented 1 year ago

@Koenkk I tried to set reporting like this:

image

but it's the same result... I'm not recieving status updates.

mpetro89 commented 1 year ago

Sorry my bad! On/Off is working now. I also set "Min rep interval" to 1, and now it's working, every time I press the physical button.

Now I would like to get info for brightness too. If I hold the physical button I can change the brightness, but I can't get new brightness value back to Z2M.

Koenkk commented 1 year ago

To do this setup reporting for the genLevelCtrl cluster, currentLevel attribute.

mpetro89 commented 1 year ago

@Koenkk many thanks! It's worked.

javigmsuperka commented 1 year ago

Hi, @Koenkk

I have had the same issue of not receiving the status update, and I've gone crazy until I found the fix here. Wouldn't it be convenient to include it in the documentation? This is my model:

TS0502B Zigbee Manufacturer _TZB210_nfzrlz29

fatshotty commented 7 months ago

Hi, i'm trying to pair the WZ1 with my z2m (ver: 1.35.1 commit: 9eaaa0f) but it is being recognized as "ts0503b" https://www.zigbee2mqtt.io/devices/TS0503B.html#tuya-ts0503b . Am i doing something wrong?

thanks in advance

fatshotty commented 4 months ago

hello there, I noticed that when device is OFF and I just click twice the "push", led goes to 10% or 100% brightness, but z2m not recognizes that. Z2m thinks device is still in off.

Any suggetion about that? thanks in advance

finder6600 commented 3 months ago

Hi, i'm trying to pair the WZ1 with my z2m (ver: 1.35.1 commit: 9eaaa0f) but it is being recognized as "ts0503b" RGB Light controller https://www.zigbee2mqtt.io/devices/TS0503B.html#tuya-ts0503b . Am i doing something wrong?

thanks in advance

did you solve this problem? When connecting for the first time, the controller was assigned correctly, but when connecting again it was recognized as "ts0503b"

fatshotty commented 3 months ago

Hi, i'm trying to pair the WZ1 with my z2m (ver: 1.35.1 commit: 9eaaa0f) but it is being recognized as "ts0503b" RGB Light controller https://www.zigbee2mqtt.io/devices/TS0503B.html#tuya-ts0503b . Am i doing something wrong? thanks in advance

did you solve this problem? When connecting for the first time, the controller was assigned correctly, but when connecting again it was recognized as "ts0503b"

no, problem still persists, however device is working well. just one thing: if u double push on button, z2m not recognizes the state of the device :/

akadaedalus commented 3 months ago

I did some experiments with this device. The documentation is extremely unclear but I think switching it between white and yellow modes changes the device model.

Also double clicking on the button (which flashes the light ten times) supposedly clears the network, rather than pairing it. I struggled to understand that for a while.

The picture for the wz1 white mode seems wrong. It's rectangular not circular.