Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge πŸŒ‰, get rid of your proprietary Zigbee bridges πŸ”¨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
12.04k stars 1.67k forks source link

Can't add Remote Trust/KlikAanKlikUit ZYCT-202 #635

Closed hwijers closed 5 years ago

hwijers commented 5 years ago

I have bought a Trust ZYCT-202 remote control. Trust zyct-202 this is the same as: KAKU zyct-202

As coordinator I use a CC2531 with FW version 20181024 After pairing, I see the following notifications in zigbee2mqtt:

zigbee2mqtt:debug 2018-11-26 11:22:44 Received zigbee message of type 'devInterview' with data '"0x00158d0001ee2aa1"' zigbee2mqtt:debug 2018-11-26 11:22:44 Received zigbee message of type 'devInterview' with data '"0x00158d0001ee2aa1"' zigbee2mqtt:debug 2018-11-26 11:22:45 Received zigbee message of type 'devInterview' with data '"0x00158d0001ee2aa1"' zigbee2mqtt:debug 2018-11-26 11:22:51 Received zigbee message of type 'devInterview' with data '"0x00158d0001ee2aa1"' zigbee2mqtt:debug 2018-11-26 11:22:58 Received zigbee message of type 'devInterview' with data '"0x00158d0001ee2aa1"' zigbee2mqtt:debug 2018-11-26 11:23:05 Received zigbee message of type 'devInterview' with data '"0x00158d0001ee2aa1"' zigbee2mqtt:debug 2018-11-26 11:23:12 Received zigbee message of type 'devInterview' with data '"0x00158d0001ee2aa1"' zigbee2mqtt:debug 2018-11-26 11:23:12 Received zigbee message of type 'devIncoming' with data '"0x00158d0001ee2aa1"' of device '' (0x00158d0001ee2aa1) zigbee2mqtt:info 2018-11-26 11:23:12 Device incoming... zigbee2mqtt:info 2018-11-26 11:23:12 MQTT publish, topic: 'zigbee2mqtt/bridge/log', payload: '{"type":"pairing","message":"device incoming"}' zigbee2mqtt:warn 2018-11-26 11:23:12 Device with modelID '' is not supported. zigbee2mqtt:warn 2018-11-26 11:23:12 Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices zigbee2mqtt:debug 2018-11-26 11:23:12 Received zigbee message of type 'devStatus' with data '"online"' of device '' (0x00158d0001ee2aa1) zigbee2mqtt:warn 2018-11-26 11:23:12 Device with modelID '' is not supported. zigbee2mqtt:warn 2018-11-26 11:23:12 Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices

Do I ever get this device working without a modelID?

I have created an object in node_modules/zigbee-shepherd-converters/devices.js :

// Trust { zigbeeModel: ['ZYCT-202'], model: 'ZYCT-202', vendor: 'Trust', description: 'Remote Controle ', supports: 'switch', fromZigbee: [], toZigbee: [], },

after restarting zigbee2mqtt is see:

zigbee2mqtt:info 2018-11-26 12:12:51 0x00158d0001ee2aa1 (0x00158d0001ee2aa1): unkown - undefined unknown (EndDevice)

if I now press a random button from the remote control, I can not see anything coming in... Does anyone have an idea how I get this working?

khzd commented 5 years ago

Hi , according to the process adding a device you have to add a log line in node_modules/zigbee-shepherd-converters/devices.js, see the proc cheers

Koenkk commented 5 years ago

Can you post the contents of your database.db?

hwijers commented 5 years ago

Can you post the contents of your database.db?

{"$$indexCreated":{"fieldName":"id","unique":true,"sparse":false}} {"id":1,"type":"Coordinator","ieeeAddr":"0x00124b0018ed22ee","nwkAddr":0,"manufId":0,"epList":[1,2,3,4,5,6],"status":"online","joinTime":1543256425,"endpoints":{"1":{"profId":260,"epId":1,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"2":{"profId":257,"epId":2,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"3":{"profId":261,"epId":3,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"4":{"profId":263,"epId":4,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"5":{"profId":264,"epId":5,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"6":{"profId":265,"epId":6,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}}},"_id":"PVokl7hv6Y5PTVzl"} {"id":2,"type":"EndDevice","ieeeAddr":"0x00158d0001ee2aa1","nwkAddr":38738,"manufId":4151,"epList":[1,2],"status":"online","joinTime":1543256658,"endpoints":{"1":{"profId":49246,"epId":1,"devId":2080,"inClusterList":[0,3,4,6,8,4096],"outClusterList":[0,3,4,6,8,4096],"clusters":{}},"2":{"profId":49246,"epId":2,"devId":1010,"inClusterList":[4096],"outClusterList":[4096],"clusters":{}}},"_id":"w5iBvCxD94EDRQIP"} {"id":2,"type":"EndDevice","ieeeAddr":"0x00158d0001ee2aa1","nwkAddr":38738,"manufId":4151,"manufName":"\u0000\u0000\u0000","powerSource":"Battery","modelId":"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000","epList":[1,2],"status":"online","joinTime":1543256658,"endpoints":{"1":{"profId":49246,"epId":1,"devId":2080,"inClusterList":[0,3,4,6,8,4096],"outClusterList":[0,3,4,6,8,4096],"clusters":{}},"2":{"profId":49246,"epId":2,"devId":1010,"inClusterList":[4096],"outClusterList":[4096],"clusters":{}}},"_id":"w5iBvCxD94EDRQIP"} {"id":2,"type":"EndDevice","ieeeAddr":"0x00158d0001ee2aa1","nwkAddr":38738,"manufId":4151,"manufName":"\u0000\u0000\u0000","powerSource":"Battery","modelId":"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000","epList":[1,2],"status":"online","joinTime":1543256658,"endpoints":{"1":{"profId":49246,"epId":1,"devId":2080,"inClusterList":[0,3,4,6,8,4096],"outClusterList":[0,3,4,6,8,4096],"clusters":{"genBasic":{"dir":{"value":3},"attrs":{}},"genIdentify":{"dir":{"value":3},"attrs":{}},"genGroups":{"dir":{"value":3},"attrs":{}},"genOnOff":{"dir":{"value":3},"attrs":{}},"genLevelCtrl":{"dir":{"value":3},"attrs":{}},"lightLink":{"dir":{"value":3},"attrs":{}}}},"2":{"profId":49246,"epId":2,"devId":1010,"inClusterList":[4096],"outClusterList":[4096],"clusters":{"lightLink":{"dir":{"value":3},"attrs":{}}}}},"_id":"w5iBvCxD94EDRQIP"}

hwijers commented 5 years ago

Hi , according to the process adding a device you have to add a log line in node_modules/zigbee-shepherd-converters/devices.js, see the proc cheers

add a log line? I have followed the procedure How-to-support-new-devices but get stuck in step 2:

restart zigbee2mqtt and trigger some actions on the device

Nothing happens...

Koenkk commented 5 years ago

Let's start with the on/off buttons.

In devices.js add:

{
        zigbeeModel: ['\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000'],
        model: 'Zigbee remote control',
        vendor: 'Trust',
        description: 'TODO',
        supports: 'TODO',
        fromZigbee: [],
        toZigbee: [],
        configure: (ieeeAddr, shepherd, coordinator, callback) => {
            const device = shepherd.find(ieeeAddr, 1);
            const cfg = {direction: 0, attrId: 0, dataType: 16, minRepIntval: 0, maxRepIntval: 1000, repChange: 0};
            const actions = [
                (cb) => device.bind('genOnOff', coordinator, cb),
                (cb) => device.foundation('genOnOff', 'configReport', [cfg], foundationCfg, cb),
            ];

            execute(device, actions, callback);
        },
    },
hwijers commented 5 years ago

I started again with a clean installation (zigbee2mqtt version 0.2.0 (commit # b0d3c2f)).

First pairing without adjustment in node_modules/zigbee-shepherd-converters/devices.js

Log: zigbee2mqtt:debug 2018-11-28 09:47:39 Received zigbee message of type 'devInterview' with data '"0x00158d0001ee2aa1"' zigbee2mqtt:debug 2018-11-28 09:47:39 Received zigbee message of type 'devInterview' with data '"0x00158d0001ee2aa1"' zigbee2mqtt:debug 2018-11-28 09:47:39 Received zigbee message of type 'devInterview' with data '"0x00158d0001ee2aa1"' zigbee2mqtt:debug 2018-11-28 09:47:40 Received zigbee message of type 'devInterview' with data '"0x00158d0001ee2aa1"' zigbee2mqtt:debug 2018-11-28 09:47:40 Received zigbee message of type 'devInterview' with data '"0x00158d0001ee2aa1"' zigbee2mqtt:debug 2018-11-28 09:47:40 Received zigbee message of type 'devInterview' with data '"0x00158d0001ee2aa1"' zigbee2mqtt:debug 2018-11-28 09:48:10 Received zigbee message of type 'devInterview' with data '"0x00158d0001ee2aa1"' zigbee2mqtt:debug 2018-11-28 09:48:10 Received zigbee message of type 'devIncoming' with data '"0x00158d0001ee2aa1"' of device '' (0x00158d0001ee2aa1) zigbee2mqtt:info 2018-11-28 09:48:10 Device incoming... zigbee2mqtt:info 2018-11-28 09:48:10 MQTT publish, topic: 'zigbee2mqtt/bridge/log', payload: '{"type":"pairing","message":"device incoming"}' zigbee2mqtt:warn 2018-11-28 09:48:10 Device with modelID '' is not supported. zigbee2mqtt:warn 2018-11-28 09:48:10 Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices zigbee2mqtt:debug 2018-11-28 09:48:10 Received zigbee message of type 'devStatus' with data '"online"' of device '' (0x00158d0001ee2aa1) zigbee2mqtt:warn 2018-11-28 09:48:10 Device with modelID '' is not supported. zigbee2mqtt:warn 2018-11-28 09:48:10 Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices

Database:

{"$$indexCreated":{"fieldName":"id","unique":true,"sparse":false}} {"id":1,"type":"Coordinator","ieeeAddr":"0x00124b0018ed22ee","nwkAddr":0,"manufId":0,"epList":[1,2,3,4,5,6],"status":"online","joinTime":1543394823,"endpoints":{"1":{"profId":260,"epId":1,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"2":{"profId":257,"epId":2,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"3":{"profId":261,"epId":3,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"4":{"profId":263,"epId":4,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"5":{"profId":264,"epId":5,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"6":{"profId":265,"epId":6,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}}},"_id":"utKG2qzCoAVW01U0"} {"id":2,"type":"EndDevice","ieeeAddr":"0x00158d0001ee2aa1","nwkAddr":4132,"manufId":4151,"epList":[1,2],"status":"online","joinTime":1543394858,"endpoints":{"1":{"profId":49246,"epId":1,"devId":2080,"inClusterList":[0,3,4,6,8,4096],"outClusterList":[0,3,4,6,8,4096],"clusters":{}},"2":{"profId":49246,"epId":2,"devId":1010,"inClusterList":[4096],"outClusterList":[4096],"clusters":{}}},"_id":"yZinE0H0eJFtnYRn"} {"id":2,"type":"EndDevice","ieeeAddr":"0x00158d0001ee2aa1","nwkAddr":4132,"manufId":4151,"manufName":"\u0000\u0000\u0000","powerSource":"Battery","modelId":"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000","epList":[1,2],"status":"online","joinTime":1543394858,"endpoints":{"1":{"profId":49246,"epId":1,"devId":2080,"inClusterList":[0,3,4,6,8,4096],"outClusterList":[0,3,4,6,8,4096],"clusters":{}},"2":{"profId":49246,"epId":2,"devId":1010,"inClusterList":[4096],"outClusterList":[4096],"clusters":{}}},"_id":"yZinE0H0eJFtnYRn"} {"id":2,"type":"EndDevice","ieeeAddr":"0x00158d0001ee2aa1","nwkAddr":4132,"manufId":4151,"manufName":"\u0000\u0000\u0000","powerSource":"Battery","modelId":"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000","epList":[1,2],"status":"online","joinTime":1543394858,"endpoints":{"1":{"profId":49246,"epId":1,"devId":2080,"inClusterList":[0,3,4,6,8,4096],"outClusterList":[0,3,4,6,8,4096],"clusters":{"genBasic":{"dir":{"value":3},"attrs":{}},"genIdentify":{"dir":{"value":3},"attrs":{}},"genGroups":{"dir":{"value":3},"attrs":{}},"genOnOff":{"dir":{"value":3},"attrs":{}},"genLevelCtrl":{"dir":{"value":3},"attrs":{}},"lightLink":{"dir":{"value":3},"attrs":{}}}},"2":{"profId":49246,"epId":2,"devId":1010,"inClusterList":[4096],"outClusterList":[4096],"clusters":{"lightLink":{"dir":{"value":3},"attrs":{}}}}},"_id":"yZinE0H0eJFtnYRn"}

Now I have changed the devices.js and removed the database and re-paired the remote.

Log:

zigbee2mqtt:debug 2018-11-28 09:58:59 Received zigbee message of type 'devInterview' with data '"0x00158d0001ee2aa1"' zigbee2mqtt:debug 2018-11-28 09:59:00 Received zigbee message of type 'devInterview' with data '"0x00158d0001ee2aa1"' zigbee2mqtt:debug 2018-11-28 09:59:00 Received zigbee message of type 'devInterview' with data '"0x00158d0001ee2aa1"' zigbee2mqtt:debug 2018-11-28 09:59:00 Received zigbee message of type 'devInterview' with data '"0x00158d0001ee2aa1"' zigbee2mqtt:debug 2018-11-28 09:59:01 Received zigbee message of type 'devInterview' with data '"0x00158d0001ee2aa1"' zigbee2mqtt:debug 2018-11-28 09:59:01 Received zigbee message of type 'devInterview' with data '"0x00158d0001ee2aa1"' zigbee2mqtt:debug 2018-11-28 09:59:31 Received zigbee message of type 'devInterview' with data '"0x00158d0001ee2aa1"' zigbee2mqtt:debug 2018-11-28 09:59:31 Received zigbee message of type 'devIncoming' with data '"0x00158d0001ee2aa1"' of device '' (0x00158d0001ee2aa1) zigbee2mqtt:info 2018-11-28 09:59:31 Device incoming... zigbee2mqtt:info 2018-11-28 09:59:31 MQTT publish, topic: 'zigbee2mqtt/bridge/log', payload: '{"type":"pairing","message":"device incoming"}' zigbee2mqtt:debug 2018-11-28 09:59:31 Received zigbee message of type 'devStatus' with data '"online"' of device '' (0x00158d0001ee2aa1)

Database:

{"$$indexCreated":{"fieldName":"id","unique":true,"sparse":false}} {"id":1,"type":"Coordinator","ieeeAddr":"0x00124b0018ed22ee","nwkAddr":0,"manufId":0,"epList":[1,2,3,4,5,6],"status":"online","joinTime":1543395509,"endpoints":{"1":{"profId":260,"epId":1,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"2":{"profId":257,"epId":2,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"3":{"profId":261,"epId":3,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"4":{"profId":263,"epId":4,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"5":{"profId":264,"epId":5,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"6":{"profId":265,"epId":6,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}}},"_id":"Filk6aHf1mZshed2"} {"id":2,"type":"EndDevice","ieeeAddr":"0x00158d0001ee2aa1","nwkAddr":38945,"manufId":4151,"epList":[1,2],"status":"online","joinTime":1543395539,"endpoints":{"1":{"profId":49246,"epId":1,"devId":2080,"inClusterList":[0,3,4,6,8,4096],"outClusterList":[0,3,4,6,8,4096],"clusters":{}},"2":{"profId":49246,"epId":2,"devId":1010,"inClusterList":[4096],"outClusterList":[4096],"clusters":{}}},"_id":"c0VeWWRfYzZWxGgj"} {"id":2,"type":"EndDevice","ieeeAddr":"0x00158d0001ee2aa1","nwkAddr":38945,"manufId":4151,"manufName":"\u0000\u0000\u0000","powerSource":"Battery","modelId":"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000","epList":[1,2],"status":"online","joinTime":1543395539,"endpoints":{"1":{"profId":49246,"epId":1,"devId":2080,"inClusterList":[0,3,4,6,8,4096],"outClusterList":[0,3,4,6,8,4096],"clusters":{}},"2":{"profId":49246,"epId":2,"devId":1010,"inClusterList":[4096],"outClusterList":[4096],"clusters":{}}},"_id":"c0VeWWRfYzZWxGgj"} {"id":2,"type":"EndDevice","ieeeAddr":"0x00158d0001ee2aa1","nwkAddr":38945,"manufId":4151,"manufName":"\u0000\u0000\u0000","powerSource":"Battery","modelId":"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000","epList":[1,2],"status":"online","joinTime":1543395539,"endpoints":{"1":{"profId":49246,"epId":1,"devId":2080,"inClusterList":[0,3,4,6,8,4096],"outClusterList":[0,3,4,6,8,4096],"clusters":{"genBasic":{"dir":{"value":3},"attrs":{}},"genIdentify":{"dir":{"value":3},"attrs":{}},"genGroups":{"dir":{"value":3},"attrs":{}},"genOnOff":{"dir":{"value":3},"attrs":{}},"genLevelCtrl":{"dir":{"value":3},"attrs":{}},"lightLink":{"dir":{"value":3},"attrs":{}}}},"2":{"profId":49246,"epId":2,"devId":1010,"inClusterList":[4096],"outClusterList":[4096],"clusters":{"lightLink":{"dir":{"value":3},"attrs":{}}}}},"_id":"c0VeWWRfYzZWxGgj"}

data/configuration.yaml:

devices: '0x00158d0001ee2aa1': friendly_name: TrustRC01 retain: false

You can see that the message "is not supported" is no longer displayed. So, the remote control is now recognized in the config ...? But unfortunately, zigbee2mqtt does not respond to buttons... After a short time:

zigbee2mqtt:error 2018-11-28 10:00:21 Failed to configure TrustRC01 0x00158d0001ee2aa1

I now purchased also a Philips Hue wireless dimmerset Philips Products and this works well. So the software and coordinator work properly.

The Trust remote control is still preferable to the Philips Hue dimmer because the Trust has more features such as 5 lamp channels and a group button.

After second restart of zigbee2mqtt:

zigbee2mqtt:info 2018-11-28 10:32:37 TrustRC01 (0x00158d0001ee2aa1): Zigbee remote control - Trust TODO (EndDevice)

But unfortunately, zigbee2mqtt does not respond to buttons...

Koenkk commented 5 years ago

Can you provide the log with DEBUG=* npm start (we need to find out why configuration failed (zigbee2mqtt:error 2018-11-28 10:00:21 Failed to configure TrustRC01 0x00158d0001ee2aa1)?

hwijers commented 5 years ago

Here is the debug log: logfile

hwijers commented 5 years ago

As far as I understand the log, the bind process goes wrong I then looked at issue 36 https://github.com/Koenkk/zigbee2mqtt/issues/36.

add this to lib/zigbee.js handleReady function:

    // TEMP: Trust remote to coordinator.
    let trustremote = '0x00158d0001ee2aa1';
    trustremote = this.shepherd.find(trustremote, 1);
    let coordinator = this.shepherd.list().find((d) => d.type === 'Coordinator');
    coordinator = this.shepherd.find(coordinator.ieeeAddr, 1);

    trustremote.bind('genOnOff', coordinator, (err) => {
        if (err) {
            console.log('FAILED TO BIND :(');
        } else {
            console.log('GOOD!');
        }
    });

In the log is see: FAILED TO BIND :(

Koenkk commented 5 years ago

can you try with:

{
        zigbeeModel: ['\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000'],
        model: 'Zigbee remote control',
        vendor: 'Trust',
        description: 'TODO',
        supports: 'TODO',
        fromZigbee: [],
        toZigbee: [],
        configure: (ieeeAddr, shepherd, coordinator, callback) => {
            const device = shepherd.find(ieeeAddr, 1);
            const cfg = {direction: 0, attrId: 0, dataType: 16, minRepIntval: 0, maxRepIntval: 1000, repChange: 0};
            const actions = [
                (cb) => device.foundation('genOnOff', 'configReport', [cfg], foundationCfg, cb),
            ];

            execute(device, actions, callback);
        },
    },
hwijers commented 5 years ago

unfortunately, no effect...

logfile

Koenkk commented 5 years ago

AF data request fails, status code: 240. MAC transaction expired.' +0ms -> the device is probably sleeping when the configure commands are executed.

Try repairing, this makes sure that the device is online.

hwijers commented 5 years ago

I started again with an empty database. Here the whole unpair and repair process.

logfile

Koenkk commented 5 years ago

It looks like the behaviour of this device is similar to the Ikea Tradfri button. It controls lights directly instead of sending commands to the coordinator. I will give the tradfri remote another try..

hwijers commented 5 years ago

Remote Manual: https://www.klikaanklikuit.nl/media/wysiwyg/manuals/71171_1.pdf

Trust/klikaanklikuit Z1 Zigbee Control Station manual: https://www.klikaanklikuit.nl/media/wysiwyg/manuals/71168-2.pdf

Check page 11. Pairing the remote with the station The remote control seems to be made to communicate with a central controller.

Thank you for the time you have already invested. I hope you find the solution to get it working.

hwijers commented 5 years ago

I repeated the pairing process again and saved the output as HTML. Maybe easier debugging with color codes. I still learn every day to make my posts better ...

logfile in HTML format

maybe you / someone can do something with it...

Koenkk commented 5 years ago

The picture and 3. CONNECT REMOTE WITH BULB explains that the remote is connected directly to the bulb, which is the same as the TRADFRI remote.

hwijers commented 5 years ago

Yes, but you can choose. A. pairing with the bulb: select the channel and hold the ON button. (1st manual) B. pairing with the controller: hold down the BULBGROUP button. (2nd manual)

Koenkk commented 5 years ago

Did you pair using the B method?

hwijers commented 5 years ago

Yes, method B. To be sure, I also tried option A but that does not work.

hwijers commented 5 years ago

Any ideas for testing?

Koenkk commented 5 years ago

Not yet, I still assume it is the same as the tradfri remote.

ysoyipek commented 5 years ago

I look forward to an improvement.

Koenkk commented 5 years ago

The tradfri remote is now supported, with that knowledge in mind, can you try sniffing the traffic of the remote: https://github.com/Koenkk/zigbee2mqtt/blob/dev/docs/how_tos/how_to_sniff_zigbee_traffic.md ?

hwijers commented 5 years ago

Nice, I finally got my order from China. I can finally continue. I see traffic in Wireshark and see the group and have added this as coordinator_group to the config but it has no influence. Do i need to capture the whole pair process, or what do you need?

Koenkk commented 5 years ago

@hwijers only the button presses are interesting.

hwijers commented 5 years ago

Ok here the capture output file: On Dimm Up Dimm Down Off

trust zyct-202 pcapng (Rename back to trust_zyct-202.pcapng)

Koenkk commented 5 years ago

It's the same as the TRADFRI 5 button remote control. In your case the group is 0xb2bb.

You should add the device here: https://github.com/Koenkk/zigbee2mqtt/blob/dev/lib/extension/coordinatorGroup.js#L8 and then add coordinator_group: 0xb2bb for this device.

hwijers commented 5 years ago

I already added that "coordinator_group: 0xb2bb". During the pairing I already get the message "Device with modelID ' ' is not supported". So, the remote control does not send / has no modelID.

Unfortunately, it does not work. Any ideas?

Koenkk commented 5 years ago

@hwijers did you have: https://github.com/Koenkk/zigbee2mqtt/issues/635#issuecomment-442834106 in devices.js?

hwijers commented 5 years ago

Thanks Koen, I'm a lot closer.

replaced the Ikea remote in /opt/zigbee2mqtt/lib/extension/coordinatorGroup.js :

// Trust remote control const ZYCT202 = zigbeeShepherdConvertersDevices.find((d) => d.model === 'ZYCT202'); const devices = [ZYCT202];

added a new device to /opt/zigbee2mqtt/nodemodules/zigbee-shepherd-converters/devices.js under section const devices_ :

// Trust Remote
{
    zigbeeModel: ['\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000'],
    model: 'ZYCT202',
    vendor: 'Trust',
    description: 'Remote control',
    supports: 'on, off, stop, up-press, down-press',
    fromZigbee: [
        fz.ZYCT202_on, fz.ZYCT202_off, fz.ZYCT202_stop, fz.ZYCT202_up_down,
    ],
    toZigbee: [],
    configure: (ieeeAddr, shepherd, coordinator, callback) => {
        const device = shepherd.find(ieeeAddr, 1);
        const cfg = {direction: 0, attrId: 0, dataType: 16, minRepIntval: 0, maxRepIntval: 1000, repChange: 0};
        const actions = [
            (cb) => device.foundation('genOnOff', 'configReport', [cfg], foundationCfg, cb),
        ];

        execute(device, actions, callback);
    },
},

added new converters to /opt/zigbee2mqtt/node_modules/zigbee-shepherd-converters/converters/fromZigbee.js under section const converters :

ZYCT202_on: {
    cid: 'genOnOff',
    type: 'cmdOn',
    convert: (model, msg, publish, options) => {
        return {action: 'on'};
    },
},
ZYCT202_off: {
    cid: 'genOnOff',
    type: 'cmdOffWithEffect',
    convert: (model, msg, publish, options) => {
        return {action: 'off'};
    },
},
ZYCT202_stop: {
    cid: 'genLevelCtrl',
    type: 'cmdStop',
    convert: (model, msg, publish, options) => {
        return {action: 'stop'};
    },
},
ZYCT202_up_down: {
    cid: 'genLevelCtrl',
    type: 'cmdMove',
    convert: (model, msg, publish, options) => {
        const value = msg.data.data['movemode'];
        let action = null;

        if (value === 0) action = {'action': 'up-press'};
        else if (value === 1) action = {'action': 'down-press'};

        return action ? action : null;

   },
},

With the remote control you can operate 5 lamps and 1 group of lamps. 1 remote control has 5 coordinator groups: 1 = 0xb2bb 2 = 0xb2bc 3 = 0xb2bd 4 = 0xb2be 5 = 0xb2bf Group = 0xbc0

The problem now is that I can only add the remote control 1x to /opt/zigbee2mqtt/data/configuration.yaml and not 2x with a different friendly_name and coordinator_group

Do you have a solution for this?

Koenkk commented 5 years ago

@hwijers I've took another look at the firmware to check if we cannot just forward all messages (even when the coordinator is not in the group). I managed to workaround this, meaning coordinator_group is not needed anymore.

This should also solve your problems with the multiple groups.

Please check with this firmware: https://github.com/Koenkk/Z-Stack-firmware/tree/dev/coordinator/CC2531/bin (another cool thing about this firmware is that it doesn't require re-pairing of all your devices)

hwijers commented 5 years ago

I have tested the new firmware and it does work. Regardless of which mode the remote control is set (1,2,3,4,5, or Group) the button on, off, up-press, down-press now work but, I can't use the remote now to control 5 different lamps. That was actually the idea behind this remote control.

So, it would be nice if you can make converters linked to GroupIDs or that a zigbee device is created for each GroupID.

Koenkk commented 5 years ago

I don't know if this groupID is included, perhaps some changes in zigbee-shepherd are required. You could start with logging the msg here: https://github.com/Koenkk/zigbee-shepherd/blob/master/lib/components/af.js#L581 to check if this is included.

hwijers commented 5 years ago

Yes, its included. Here the output when I press "on". Here I can see the group ID: Debug output The GroupID changes when I change the lamp selector as it should.

Koenkk commented 5 years ago

@hwijers what is logged with

ZYCT202_on: {
    cid: 'genOnOff',
    type: 'cmdOn',
    convert: (model, msg, publish, options) => {
        console.log(msg);
        return {action: 'on'};
    },
},
hwijers commented 5 years ago

debug output after adding the console.log(msg); to the ZYCT202_on converter.

Koenkk commented 5 years ago

Can you change https://github.com/Koenkk/zigbee-shepherd/blob/master/lib/shepherd.js#L134 to

        self.emit('ind', { type: type, endpoints: [ ep ], data: notifData, linkquality: msg.linkquality, groupid: msg.groupid });

and check if the groupid is available in the converter now?

hwijers commented 5 years ago

Yes:

{ type: 'cmdOn', endpoints: [ Endpoint { isLocal: [Function], device: [Device], profId: 49246, epId: 1, devId: 2080, inClusterList: [Array], outClusterList: [Array], clusters: [Ziee], onAfDataConfirm: null, onAfReflectError: null, onAfIncomingMsg: null, onAfIncomingMsgExt: null, onZclFoundation: null, onZclFunctional: null, foundation: [Function], functional: [Function], bind: [Function], unbind: [Function], read: [Function], write: [Function], report: [Function] } ], data: { cid: 'genOnOff', data: {} }, linkquality: 131, groupid: 45755 }

Koenkk commented 5 years ago

Good, so now the groupID can be added to the payload, please put it under the key named: action_group and make a PR to update zigbee-shepherd.

hwijers commented 5 years ago

Sorry Koen, I've lost you ... Can you give me an example?

Also a PR (Pull Request I assume) is new to me. I like to learn every day .. ;-)

Koenkk commented 5 years ago

no problem, example:

ZYCT202_on: {
    cid: 'genOnOff',
    type: 'cmdOn',
    convert: (model, msg, publish, options) => {
        return {action: 'on', action_group: msg.groupid};
    },
},
hwijers commented 5 years ago

Are there more people with such a Trust ZYCT-202 remote? Does anyone want to sniff his remote traffic: "how to sniff zigbee traffic" I would like to know if each remote uses the same GroupID's like: selector position 1 = 0xb2bb selector position 2 = 0xb2bc selector position 3 = 0xb2bd selector position 4 = 0xb2be selector position 5 = 0xb2bf Group Button = 0xbc0

hwijers commented 5 years ago

@Koenkk: Nice, now we have the remote control working with lamp selector (GroupID) and action. This can then be used again in HomeAssistant.

I hope that we will receive a response to the above message. If the selector always has the same GroupID then a fixed converter can be made for this. For example, If you then press the ON button with the selector in position 1 can give output "action: 1_on"

Koenkk commented 5 years ago

@hwijers nice, could you make a pull request for this? In this way we can officially support it (https://help.github.com/en/articles/creating-a-pull-request).

Koenkk commented 5 years ago

Merged, thanks!

hwijers commented 5 years ago

@Koenkk , thank you (and other zigbee2mqtt addicts) very much for this beautiful project and all the time and energy you put into it. I have learned a lot from this again!

RyuzakiKK commented 5 years ago

@hwijers Just to be sure, you paired the remote by holding the group button? Probably this info should be added in the pairing_devices page.

hwijers commented 5 years ago

@RyuzakiKK , You must have the latest version of zigbee2mqtt and the latest firmware version. Otherwise it doesn't work .. To be sure, first reset your remote by holding the 0 (off) key for a while (20sec?)

Take the following steps on the ZYCT-202 Remote a. Hold the remote within 2 meters of the Hue bridge b. Press & hold the Smart Group button (button with 2 bulbs). First the LEDs of channels 1, 3 and 5 will blink

RyuzakiKK commented 5 years ago

Thanks, I created a PR to add the instruction in the pairing section https://github.com/Koenkk/zigbee2mqtt.io/pull/49