Koenkk / zigbee2mqtt

Zigbee ๐Ÿ to MQTT bridge ๐ŸŒ‰, get rid of your proprietary Zigbee bridges ๐Ÿ”จ
https://www.zigbee2mqtt.io
GNU General Public License v3.0
11.92k stars 1.66k forks source link

Hue dimmer switch #36

Closed Trakkasure closed 6 years ago

Trakkasure commented 6 years ago

I hit the setup button on the back of the switch, and successfully paired the switch. Pressing any button on the switch does nothing. Interestingly, no light shows in the upper left corner on the device (like it usually does) when a button is pressed.

Is there additional support required in the sniffer firmware required to support this device? It would be great to be able to drop the hue hub all together and use my own home grown solution.

Below is the addition to the devices.js file:

{
'RWL020': {
        model: '324131092621',
    vendor: 'Philips',
    description: 'Hue Dimmer Switch',
        supports: 'single, double, triple, quadruple, many and long click',
        homeassistant: [homeassistant.sensor_click]
    }
}
kirovilya commented 6 years ago

@tb-killa

maybe because we Bind Hue dimmer to coordinator via Code?

Ah! maybe!

we could look if we got the same result.

Not get :(

tb-killa commented 6 years ago

Ok i remove my old database.db and reactivate the permitjoin. Comment out the needing code to bind the hue switch to coordinator. After starting via DEBUG=* npm start i let the device join. Now if i press one of the four buttons ...... I am presenting ...... nothing. No reaction like before :(

So yes ..

Strange, I do not undestand why coordinator received this commands...

results from our manual mapping!

tb-killa commented 6 years ago

@kirovilya @Koenkk What are the next steps? How do we proceed now? If we bind the device static via function we receive the "ind:cmd" with payload. But there is also @kirovilya hacky code segment to allow this.

We should think about an official way to integrate this.

Koenkk commented 6 years ago

We first should find a clean solution on how to add this to af.js.

The binding part can be easily integrated, I'm thinking about model specific handlers, e.g. onStart onJoin, etc.. There we can add the binding code.

Koenkk commented 6 years ago

In https://github.com/Koenkk/zigbee-shepherd-converters/commit/6ee76c0709513f9f205adb6f63f9372b59a40fe3 I've added support for the configure method. In this method we can do any device specific configuration (if required). configure will be called once for every start of zigbee2mqtt, so either when zigbee2mqtt starts or when the device joins the network.

Example: https://github.com/Koenkk/zigbee-shepherd-converters/blob/master/devices.js#L357

jasonmhite commented 6 years ago

So to clarify, what needs to be done to get this working out of the box?

Koenkk commented 6 years ago

@jasonmhite someone with the device who wants to help.

I don't have the device myself but I prepared the zigbee2mqtt/zigbee-shepherd code (from input above) to allow supporting this device, from now it should just be a matter of writing converters.

To help, go to zigbee2mqtt folder:

cd node_modules
rm -rf zigbee-shepherd-converters zigbee-shepherd
git clone https://github.com/Koenkk/zigbee-shepherd-converters.git -b hue_remote
git clone https://github.com/Koenkk/zigbee-shepherd.git -b hue_remote
cd zigbee-shepherd
npm install
cd ../zigbee-shepherd-converters
npm install

Now start zigbee2mqtt, pair the device, it should now output WARN No converter available for ...blablabla..... Please post the output here (with debug log level in zigbee2mqtt)

tb-killa commented 6 years ago

@Koenkk i will try tomorrow if got some free time. Will report

Koenkk commented 6 years ago

@tb-killa great, thanks!

tb-killa commented 6 years ago

@Koenkk what about the af.js patching? Is there some solid Modification prepared against the debugging Code from @kirovilya?

Koenkk commented 6 years ago

I think this is OK: diff: https://github.com/Koenkk/zigbee-shepherd/commit/bc13accb066c99e5b6658db4ab8f5c0c28b2fa4e.

@kirovilya can you review this?

clockbrain commented 6 years ago

Not trying to hijack the issue but I've also got a Phillips Hue dimmer switch (RWL021 model) and I couldn't get it to pair until I tried the hue_remote branch mentioned above.

Here's my device.js entry

    {
        zigbeeModel: ['RWL021'],
        model: '324131137411',
        vendor: 'Phillips',
        description: 'Hue Dimmer switch',
        supports: 'on/off',
        fromZigbee: [],
        toZigbee: [],
    },

And here is the log info when pressing the on button

2018-6-28 18:18:20 DEBUG Recieved zigbee message with data {"cid":"genOnOff","data":{}}
2018-6-28 18:18:20 WARN No converter available for '324131137411' with cid 'genOnOff' and type 'cmdOn'

And the log info when pressing the off button

2018-6-28 18:18:21 DEBUG Recieved zigbee message with data {"cid":"genOnOff","data":{"effectid":0,"effectvariant":0}}
2018-6-28 18:18:21 WARN No converter available for '324131137411' with cid 'genOnOff' and type 'cmdOffWithEffect'

I don't get any response from the two central buttons.

ryanbeaton commented 6 years ago

@clockbrain looking like progress. Thatโ€™s what @Koenkk was looking for

Sent with GitHawk

kirovilya commented 6 years ago

@Koenkk

I think this is OK: diff: Koenkk/zigbee-shepherd@bc13acc. @kirovilya can you review this?

Need more logs... not see 'dispatchIncomingMsg()' in debug log... It is possible to extend the set of clusters in zcl-id

Koenkk commented 6 years ago

@kirovilya why do we need to extend the set of clusters in zcl-id?

Koenkk commented 6 years ago

@clockbrain i've updated the code, on and off button should work now. Can you try if the two central buttons also report anything now?

kirovilya commented 6 years ago

@Koenkk if we found new command or attribute. may be it part of zcl-packet

clockbrain commented 6 years ago

@Koenkk tested with the updated code although I did have to adjust 2 lines to reflect that I have the RWL021 model

       zigbeeModel: ['RWL021'],
        model: '324131137411',

With that change it did work ok but only the top and bottom buttons again. Still no response from the 2 middle buttons.

2018-6-29 17:50:09 DEBUG Using zigbee-shepherd with settings: '{"net":{"panId":6754,"channelList":[11]},"dbPath":"/opt/zigbee2mqtt/data/database.db","sp":{"baudrate":115200,"rtscts":true}}'
2018-6-29 17:50:09 INFO Starting zigbee2mqtt version 0.0.0 (commit #2ba2864)
2018-6-29 17:50:09 INFO Starting zigbee-shepherd
2018-6-29 17:50:09 INFO zigbee-shepherd started
2018-6-29 17:50:09 INFO Currently 0 devices are joined:
2018-6-29 17:50:09 WARN `permit_join` set to  `true` in configuration.yaml.
2018-6-29 17:50:09 WARN Allowing new devices to join.
2018-6-29 17:50:09 WARN Set `permit_join` to `false` once you joined all devices.
2018-6-29 17:50:09 INFO Zigbee: allowing new devices to join.
2018-6-29 17:50:09 INFO Connecting to MQTT server at mqtt://192.168.x.x:1883
2018-6-29 17:50:10 INFO zigbee-shepherd ready
2018-6-29 17:50:10 INFO Connected to MQTT server
2018-6-29 17:50:10 INFO MQTT publish, topic: 'zigbee2mqtt/bridge/state', payload: 'online'
spinlock: false []
2018-6-29 17:50:31 DEBUG Recieved zigbee message with data "0x0017880103cb42ce"
2018-6-29 17:50:31 DEBUG Recieved zigbee message with data "0x0017880103cb42ce"
2018-6-29 17:50:32 DEBUG Recieved zigbee message with data "0x0017880103cb42ce"
2018-6-29 17:50:32 DEBUG Recieved zigbee message with data "0x0017880103cb42ce"
2018-6-29 17:50:33 DEBUG Recieved zigbee message with data "0x0017880103cb42ce"
2018-6-29 17:50:34 DEBUG Recieved zigbee message with data "0x0017880103cb42ce"
2018-6-29 17:50:35 DEBUG Recieved zigbee message with data "0x0017880103cb42ce"
2018-6-29 17:50:36 DEBUG Recieved zigbee message with data "0x0017880103cb42ce"
2018-6-29 17:50:37 DEBUG Recieved zigbee message with data "0x0017880103cb42ce"
2018-6-29 17:50:37 DEBUG Recieved zigbee message with data "0x0017880103cb42ce"
2018-6-29 17:50:38 DEBUG Recieved zigbee message with data "0x0017880103cb42ce"
2018-6-29 17:50:38 DEBUG Recieved zigbee message with data "0x0017880103cb42ce"
2018-6-29 17:50:38 DEBUG Recieved zigbee message with data "0x0017880103cb42ce"
2018-6-29 17:50:38 INFO Device incoming...
2018-6-29 17:50:38 INFO MQTT publish, topic: 'zigbee2mqtt/bridge/log', payload: '{"type":"pairing","message":"device incoming"}'
2018-6-29 17:50:38 DEBUG Recieved zigbee message with data "online"
2018-6-29 17:50:39 INFO Succesfully configured 0x0017880103cb42ce
2018-6-29 17:50:48 DEBUG Recieved zigbee message with data {"cid":"genOnOff","data":{}}
2018-6-29 17:50:48 INFO MQTT publish, topic: 'zigbee2mqtt/Dimmer', payload: '{"action":"on"}'
2018-6-29 17:50:50 DEBUG Recieved zigbee message with data {"cid":"genOnOff","data":{"effectid":0,"effectvariant":0}}
2018-6-29 17:50:50 INFO MQTT publish, topic: 'zigbee2mqtt/Dimmer', payload: '{"action":"off"}'
^C2018-6-29 17:51:08 INFO MQTT publish, topic: 'zigbee2mqtt/bridge/state', payload: 'offline'
2018-6-29 17:51:08 INFO Disconnecting from MQTT server
2018-6-29 17:51:08 INFO zigbee-shepherd stopped
clockbrain commented 6 years ago

In case it helps, here is the corresponding database.db entry

{
  "id": 2,
  "type": "EndDevice",
  "ieeeAddr": "0x0017880103cb42ce",
  "nwkAddr": 53469,
  "manufId": 4107,
  "manufName": "Philips",
  "powerSource": "Battery",
  "modelId": "RWL021",
  "epList": [
    1,
    2
  ],
  "status": "offline",
  "joinTime": null,
  "endpoints": {
    "1": {
      "profId": 49246,
      "epId": 1,
      "devId": 2096,
      "inClusterList": [
        0
      ],
      "outClusterList": [
        0,
        3,
        4,
        5,
        6,
        8
      ],
      "clusters": {
        "genBasic": {
          "dir": {
            "value": 3
          },
          "attrs": {
            "zclVersion": 1,
            "appVersion": 2,
            "stackVersion": 1,
            "hwVersion": 1,
            "manufacturerName": "Philips",
            "modelId": "RWL021",
            "dateCode": "20160302",
            "powerSource": 3,
            "swBuildId": "5.45.1.17846"
          }
        },
        "genIdentify": {
          "dir": {
            "value": 2
          },
          "attrs": {}
        },
        "genGroups": {
          "dir": {
            "value": 2
          },
          "attrs": {}
        },
        "genScenes": {
          "dir": {
            "value": 2
          },
          "attrs": {}
        },
        "genOnOff": {
          "dir": {
            "value": 2
          },
          "attrs": {}
        },
        "genLevelCtrl": {
          "dir": {
            "value": 2
          },
          "attrs": {}
        }
      }
    },
    "2": {
      "profId": 260,
      "epId": 2,
      "devId": 12,
      "inClusterList": [
        0,
        1,
        3,
        15,
        64512
      ],
      "outClusterList": [
        25
      ],
      "clusters": {
        "64512": {
          "dir": {
            "value": 1
          },
          "attrs": {}
        },
        "genBasic": {
          "dir": {
            "value": 1
          },
          "attrs": {
            "zclVersion": 1,
            "appVersion": 2,
            "stackVersion": 1,
            "hwVersion": 1,
            "manufacturerName": "Philips",
            "modelId": "RWL021",
            "dateCode": "20160302",
            "powerSource": 3,
            "swBuildId": "5.45.1.17846"
          }
        },
        "genPowerCfg": {
          "dir": {
            "value": 1
          },
          "attrs": {
            "batteryVoltage": 28,
            "batteryPercentageRemaining": 200
          }
        },
        "genIdentify": {
          "dir": {
            "value": 1
          },
          "attrs": {}
        },
        "genBinaryInput": {
          "dir": {
            "value": 1
          },
          "attrs": {}
        },
        "genOta": {
          "dir": {
            "value": 2
          },
          "attrs": {}
        }
      }
    }
  },
  "_id": "4bIwno26mLBdgLFn"
}
arteck commented 6 years ago

here my

{
   "id":14,
   "type":"EndDevice",
   "ieeeAddr":"0x0017880102e251de",
   "nwkAddr":1275,
   "manufId":4107,
   "manufName":"Philips",
   "powerSource":"Battery",
   "modelId":"RWL021",
   "epList":[
      1,
      2
   ],
   "status":"offline",
   "joinTime":null,
   "endpoints":{
      "1":{
         "profId":49246,
         "epId":1,
         "devId":2096,
         "inClusterList":[
            0
         ],
         "outClusterList":[
            0,
            3,
            4,
            5,
            6,
            8
         ],
         "clusters":{
            "genBasic":{
               "dir":{
                  "value":3
               },
               "attrs":{
                  "zclVersion":1,
                  "appVersion":2,
                  "stackVersion":1,
                  "hwVersion":1,
                  "manufacturerName":"Philips",
                  "modelId":"RWL021",
                  "dateCode":"20160302",
                  "powerSource":3,
                  "swBuildId":"5.45.1.17846"
               }
            },
            "genIdentify":{
               "dir":{
                  "value":2
               },
               "attrs":{

               }
            },
            "genGroups":{
               "dir":{
                  "value":2
               },
               "attrs":{

               }
            },
            "genScenes":{
               "dir":{
                  "value":2
               },
               "attrs":{

               }
            },
            "genOnOff":{
               "dir":{
                  "value":2
               },
               "attrs":{

               }
            },
            "genLevelCtrl":{
               "dir":{
                  "value":2
               },
               "attrs":{

               }
            }
         }
      },
      "2":{
         "profId":260,
         "epId":2,
         "devId":12,
         "inClusterList":[
            0,
            1,
            3,
            15,
            64512
         ],
         "outClusterList":[
            25
         ],
         "clusters":{
            "64512":{
               "dir":{
                  "value":1
               },
               "attrs":{

               }
            },
            "genBasic":{
               "dir":{
                  "value":1
               },
               "attrs":{
                  "zclVersion":1,
                  "appVersion":2,
                  "stackVersion":1,
                  "hwVersion":1,
                  "manufacturerName":"Philips",
                  "modelId":"RWL021",
                  "dateCode":"20160302",
                  "powerSource":3,
                  "swBuildId":"5.45.1.17846"
               }
            },
            "genPowerCfg":{
               "dir":{
                  "value":1
               },
               "attrs":{
                  "batteryVoltage":28,
                  "batteryPercentageRemaining":200
               }
            },
            "genIdentify":{
               "dir":{
                  "value":1
               },
               "attrs":{

               }
            },
            "genBinaryInput":{
               "dir":{
                  "value":1
               },
               "attrs":{

               }
            },
            "genOta":{
               "dir":{
                  "value":2
               },
               "attrs":{

               }
            }
         }
      }
   },
   "_id":"VUSgwF8ffeFm2VX3"
}
Koenkk commented 6 years ago

Can you update again, and add to node_modules/zcl-id/definitions/common.json. https://github.com/zigbeer/zcl-id/blob/master/definitions/common.json#L183, the line: "manuSpecificCluster1": 64512

clockbrain commented 6 years ago

No luck. I did an overall update and then applied the hue_dimmer branch and added the "manuSpecificCluster1" definition as above. Had a bit of trouble at first till I found there are 5 installs of zcl-id so I had to make the change to all of them to be sure.

./node_modules/zcl-id/definitions/common.json
./node_modules/zigbee-shepherd/node_modules/zcl-packet/node_modules/zcl-id/definitions/common.json
./node_modules/zigbee-shepherd/node_modules/zcl-id/definitions/common.json
./node_modules/zigbee-shepherd/node_modules/zive/node_modules/zcl-id/definitions/common.json
./node_modules/zigbee-shepherd/node_modules/ziee/node_modules/zcl-id/definitions/common.json

It now fails with the following error on any button press.

2018-7-1 15:18:10 DEBUG Using zigbee-shepherd with settings: '{"net":{"panId":6754,"channelList":[11]},"dbPath":"/opt/zigbee2mqtt/data/database.db","sp":{"baudrate":115200,"rtscts":true}}'
2018-7-1 15:18:10 INFO Starting zigbee2mqtt version 0.0.0 (commit #7cec5f2)
2018-7-1 15:18:10 INFO Starting zigbee-shepherd
2018-7-1 15:18:11 INFO zigbee-shepherd started
2018-7-1 15:18:11 INFO Currently 1 devices are joined:
2018-7-1 15:18:11 INFO Dimmer (0x0017880103cb42ce): 324131092621 - Philips Hue dimmer Switch (EndDevice)
2018-7-1 15:18:11 WARN `permit_join` set to  `true` in configuration.yaml.
2018-7-1 15:18:11 WARN Allowing new devices to join.
2018-7-1 15:18:11 WARN Set `permit_join` to `false` once you joined all devices.
2018-7-1 15:18:11 INFO Zigbee: allowing new devices to join.
2018-7-1 15:18:11 INFO Connecting to MQTT server at mqtt://192.168.1.6:1883
2018-7-1 15:18:11 INFO zigbee-shepherd ready
2018-7-1 15:18:11 INFO Connected to MQTT server
2018-7-1 15:18:11 INFO MQTT publish, topic: 'zigbee2mqtt/bridge/state', payload: 'online'
/opt/zigbee2mqtt/node_modules/zigbee-shepherd/node_modules/zcl-packet/lib/functional.js:34
        throw new Error('Unrecognized command');
        ^

Error: Unrecognized command
    at new FuncPayload (/opt/zigbee2mqtt/node_modules/zigbee-shepherd/node_modules/zcl-packet/lib/functional.js:34:15)
    at /opt/zigbee2mqtt/node_modules/zigbee-shepherd/node_modules/zcl-packet/lib/zcl.js:33:22
    at Dissolve.<anonymous> (/opt/zigbee2mqtt/node_modules/zigbee-shepherd/node_modules/zcl-packet/lib/zcl.js:121:9)
    at Object.onceWrapper (events.js:315:30)
    at emitOne (events.js:116:13)
    at Dissolve.emit (events.js:211:7)
    at Dissolve.<anonymous> (/opt/zigbee2mqtt/node_modules/zigbee-shepherd/node_modules/dissolve-chunks/index.js:73:29)
    at emitNone (events.js:106:13)
    at Dissolve.emit (events.js:208:7)
    at emitReadable_ (/opt/zigbee2mqtt/node_modules/zigbee-shepherd/node_modules/dissolve/node_modules/readable-stream/lib/_stream_readable.js:456:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! zigbee2mqtt@0.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the zigbee2mqtt@0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2018-07-01T05_18_21_031Z-debug.log
tb-killa commented 6 years ago

I got some free time to do some work on zigbee2mqtt.

First of all thx to @Koenkk for this great work:

BTW: I use only this two snapshots:

https://github.com/Koenkk/zigbee-shepherd-converters/commit/043bc66d57c6d13f54b260ac9f9bb7d870f2203c

https://github.com/Koenkk/zigbee-shepherd/commit/bc13accb066c99e5b6658db4ab8f5c0c28b2fa4e

I modified the "devices.js" part like mentioned before inside this thread (log-infos i posted).

{
        zigbeeModel: ['RWL020', 'RWL021'],
        model: '324131092621',
        vendor: 'Philips',
        description: 'Hue Dimmer Switch',
        supports: 'TODO',
        fromZigbee: [fz._324131092621_on, fz._324131092621_off],
        toZigbee: [],
        configure: (ieeeAddr, shepherd, coordinator, callback) => {
            const device = shepherd.find(ieeeAddr, 1);
            const actions = [
                (cb) => device.bind('genOnOff', coordinator, cb),
                (cb) => device.bind('genLevelCtrl', coordinator, cb),
            ];

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

after bring the device in pairing mode while zigbee2mqtt starts i could use all four buttons:

7/1/2018, 5:43:29 PM INFO zigbee-shepherd ready
7/1/2018, 5:43:29 PM INFO Connected to MQTT server
7/1/2018, 5:43:29 PM INFO MQTT publish, topic: 'zigbee2mqtt/bridge/state', payload: 'online'
7/1/2018, 5:47:55 PM INFO MQTT publish, topic: 'zigbee2mqtt/0x0017880103caab06', payload: '{"action":"on"}'
7/1/2018, 5:47:59 PM INFO MQTT publish, topic: 'zigbee2mqtt/0x0017880103caab06', payload: '{"action":"off"}'
7/1/2018, 5:48:02 PM WARN No converter available for '324131092621' with cid 'genLevelCtrl' and type 'cmdStep'
7/1/2018, 5:48:02 PM WARN Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices.
7/1/2018, 5:48:03 PM WARN No converter available for '324131092621' with cid 'genLevelCtrl' and type 'cmdStep'
7/1/2018, 5:48:03 PM WARN Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices.

We should now add our genLevelCtrl and the cmdStep inside the fromZigbee.js

Edit: You could use the genLevelCtrl in onhold mode so if you hold them we got multiple cmdStep Messages and a final 7/1/2018, 5:51:13 PM WARN No converter available for '324131092621' with cid 'genLevelCtrl' and type 'cmdStop'

Koenkk commented 6 years ago

@tb-killa great!

tb-killa commented 6 years ago

@Koenkk I will post some log for you.

This is press and hold "brighter" and then leave the button:

7/1/2018, 6:11:00 PM INFO Succesfully configured 0x0017880103caab06
  zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object] +191ms
  zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +20ms
  zigbee-shepherd:af dispatchIncomingMsg(): type: zclIncomingMsg, msg: [object Object] +1ms
7/1/2018, 6:11:00 PM DEBUG Recieved zigbee message with data {"cid":"genLevelCtrl","data":{"stepmode":0,"stepsize":56,"transtime":9}}
7/1/2018, 6:11:00 PM WARN No converter available for '324131092621' with cid 'genLevelCtrl' and type 'cmdStep'
7/1/2018, 6:11:00 PM WARN Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices.
  zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object] +777ms
  zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +15ms
  zigbee-shepherd:af dispatchIncomingMsg(): type: zclIncomingMsg, msg: [object Object] +2ms
7/1/2018, 6:11:01 PM DEBUG Recieved zigbee message with data {"cid":"genLevelCtrl","data":{"stepmode":0,"stepsize":56,"transtime":9}}
7/1/2018, 6:11:01 PM WARN No converter available for '324131092621' with cid 'genLevelCtrl' and type 'cmdStep'
7/1/2018, 6:11:01 PM WARN Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices.
  zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object] +776ms
  zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +7ms
  zigbee-shepherd:af dispatchIncomingMsg(): type: zclIncomingMsg, msg: [object Object] +1ms
7/1/2018, 6:11:01 PM DEBUG Recieved zigbee message with data {"cid":"genLevelCtrl","data":{"stepmode":0,"stepsize":56,"transtime":9}}
7/1/2018, 6:11:01 PM WARN No converter available for '324131092621' with cid 'genLevelCtrl' and type 'cmdStep'
7/1/2018, 6:11:01 PM WARN Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices.
  zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object] +788ms
  zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +12ms
  zigbee-shepherd:af dispatchIncomingMsg(): type: zclIncomingMsg, msg: [object Object] +12ms
7/1/2018, 6:11:02 PM DEBUG Recieved zigbee message with data {"cid":"genLevelCtrl","data":{"stepmode":0,"stepsize":56,"transtime":9}}
7/1/2018, 6:11:02 PM WARN No converter available for '324131092621' with cid 'genLevelCtrl' and type 'cmdStep'
7/1/2018, 6:11:02 PM WARN Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices.
  zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object] +778ms
  zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +14ms
  zigbee-shepherd:af dispatchIncomingMsg(): type: zclIncomingMsg, msg: [object Object] +1ms
7/1/2018, 6:11:03 PM DEBUG Recieved zigbee message with data {"cid":"genLevelCtrl","data":{"stepmode":0,"stepsize":56,"transtime":9}}
7/1/2018, 6:11:03 PM WARN No converter available for '324131092621' with cid 'genLevelCtrl' and type 'cmdStep'
7/1/2018, 6:11:03 PM WARN Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices.
  zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object] +961ms
  zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +8ms
  zigbee-shepherd:af dispatchIncomingMsg(): type: zclIncomingMsg, msg: [object Object] +1ms
7/1/2018, 6:11:04 PM DEBUG Recieved zigbee message with data {"cid":"genLevelCtrl","data":{"stepmode":0,"stepsize":56,"transtime":9}}
7/1/2018, 6:11:04 PM WARN No converter available for '324131092621' with cid 'genLevelCtrl' and type 'cmdStep'
7/1/2018, 6:11:04 PM WARN Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices.
  zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object] +614ms
  zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +13ms
  zigbee-shepherd:af dispatchIncomingMsg(): type: zclIncomingMsg, msg: [object Object] +1ms
7/1/2018, 6:11:05 PM DEBUG Recieved zigbee message with data {"cid":"genLevelCtrl","data":{"stepmode":0,"stepsize":56,"transtime":9}}
7/1/2018, 6:11:05 PM WARN No converter available for '324131092621' with cid 'genLevelCtrl' and type 'cmdStep'
7/1/2018, 6:11:05 PM WARN Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices.
  zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object] +784ms
  zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +16ms
  zigbee-shepherd:af dispatchIncomingMsg(): type: zclIncomingMsg, msg: [object Object] +5ms
7/1/2018, 6:11:05 PM DEBUG Recieved zigbee message with data {"cid":"genLevelCtrl","data":{"stepmode":0,"stepsize":56,"transtime":9}}
7/1/2018, 6:11:05 PM WARN No converter available for '324131092621' with cid 'genLevelCtrl' and type 'cmdStep'
7/1/2018, 6:11:05 PM WARN Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices.
  zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object] +315ms
  zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +15ms
  zigbee-shepherd:af dispatchIncomingMsg(): type: zclIncomingMsg, msg: [object Object] +1ms
7/1/2018, 6:11:06 PM DEBUG Recieved zigbee message with data {"cid":"genLevelCtrl","data":{}}
7/1/2018, 6:11:06 PM WARN No converter available for '324131092621' with cid 'genLevelCtrl' and type 'cmdStop'
7/1/2018, 6:11:06 PM WARN Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices.

This if hold the lower button and then leave:

7/1/2018, 6:12:46 PM DEBUG Recieved zigbee message with data {"cid":"genLevelCtrl","data":{"stepmode":0,"stepsize":30,"transtime":9}}
7/1/2018, 6:12:46 PM WARN No converter available for '324131092621' with cid 'genLevelCtrl' and type 'cmdStep'
7/1/2018, 6:12:46 PM WARN Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices.
  zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object] +736ms
  zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +8ms
  zigbee-shepherd:af dispatchIncomingMsg(): type: zclIncomingMsg, msg: [object Object] +1ms
7/1/2018, 6:12:47 PM DEBUG Recieved zigbee message with data {"cid":"genLevelCtrl","data":{"stepmode":0,"stepsize":56,"transtime":9}}
7/1/2018, 6:12:47 PM WARN No converter available for '324131092621' with cid 'genLevelCtrl' and type 'cmdStep'
7/1/2018, 6:12:47 PM WARN Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices.
  zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object] +789ms
  zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +9ms
  zigbee-shepherd:af dispatchIncomingMsg(): type: zclIncomingMsg, msg: [object Object] +1ms
7/1/2018, 6:12:47 PM DEBUG Recieved zigbee message with data {"cid":"genLevelCtrl","data":{"stepmode":0,"stepsize":56,"transtime":9}}
7/1/2018, 6:12:47 PM WARN No converter available for '324131092621' with cid 'genLevelCtrl' and type 'cmdStep'
7/1/2018, 6:12:47 PM WARN Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices.
  zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object] +137ms
  zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +13ms
  zigbee-shepherd:af dispatchIncomingMsg(): type: zclIncomingMsg, msg: [object Object] +2ms
7/1/2018, 6:12:48 PM DEBUG Recieved zigbee message with data {"cid":"genLevelCtrl","data":{}}
7/1/2018, 6:12:48 PM WARN No converter available for '324131092621' with cid 'genLevelCtrl' and type 'cmdStop'
7/1/2018, 6:12:48 PM WARN Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices.
tb-killa commented 6 years ago

@Koenkk because of your questions above:

This is the log if i pressed once (first brighter then lower)

 zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object] +2m
  zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +11ms
  zigbee-shepherd:af dispatchIncomingMsg(): type: zclIncomingMsg, msg: [object Object] +2ms
7/1/2018, 6:14:23 PM DEBUG Recieved zigbee message with data {"cid":"genLevelCtrl","data":{"stepmode":0,"stepsize":30,"transtime":9}}
7/1/2018, 6:14:23 PM WARN No converter available for '324131092621' with cid 'genLevelCtrl' and type 'cmdStep'
7/1/2018, 6:14:23 PM WARN Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices.
  zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object] +8s
  zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +9ms
  zigbee-shepherd:af dispatchIncomingMsg(): type: zclIncomingMsg, msg: [object Object] +1ms
7/1/2018, 6:14:31 PM DEBUG Recieved zigbee message with data {"cid":"genLevelCtrl","data":{"stepmode":1,"stepsize":30,"transtime":9}}
7/1/2018, 6:14:31 PM WARN No converter available for '324131092621' with cid 'genLevelCtrl' and type 'cmdStep'
7/1/2018, 6:14:31 PM WARN Please see: https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices.
tb-killa commented 6 years ago

data with stepmode: 0 is for heigher and with 1 is lower.

var direction = data.stepmode === 0 ? 'up' : 'down'; // 0=up,1=down

stepsize defined the single-press or push-and-hold state

var mode = data.stepsize === 30 ? 'press' : 'hold'; // 30=press,56=hold
Koenkk commented 6 years ago

@tb-killa can you update and check if the dimming works?

tb-killa commented 6 years ago

@Koenkk Nice .. work great.

7/2/2018, 8:13:55 PM DEBUG Recieved zigbee message with data {"cid":"genOnOff","data":{}}
7/2/2018, 8:13:55 PM INFO MQTT publish, topic: 'zigbee2mqtt/Philips-Hue-Switch', payload: '{"action":"on"}'
  zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object] +1s
  zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +188ms
  zigbee-shepherd:af dispatchIncomingMsg(): type: zclIncomingMsg, msg: [object Object] +19ms
7/2/2018, 8:13:56 PM DEBUG Recieved zigbee message with data {"cid":"genOnOff","data":{"effectid":0,"effectvariant":0}}
7/2/2018, 8:13:56 PM INFO MQTT publish, topic: 'zigbee2mqtt/Philips-Hue-Switch', payload: '{"action":"off"}'
  zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object] +1s
  zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +20ms
  zigbee-shepherd:af dispatchIncomingMsg(): type: zclIncomingMsg, msg: [object Object] +1ms
7/2/2018, 8:13:57 PM DEBUG Recieved zigbee message with data {"cid":"genLevelCtrl","data":{"stepmode":0,"stepsize":30,"transtime":9}}
7/2/2018, 8:13:57 PM INFO MQTT publish, topic: 'zigbee2mqtt/Philips-Hue-Switch', payload: '{"brightness":255}'
  zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object] +2s
  zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +12ms
  zigbee-shepherd:af dispatchIncomingMsg(): type: zclIncomingMsg, msg: [object Object] +9ms
7/2/2018, 8:13:59 PM DEBUG Recieved zigbee message with data {"cid":"genLevelCtrl","data":{"stepmode":1,"stepsize":30,"transtime":9}}
7/2/2018, 8:13:59 PM INFO MQTT publish, topic: 'zigbee2mqtt/Philips-Hue-Switch', payload: '{"brightness":205}'
  zigbee-shepherd:af dispatchIncomingMsg(): type: incomingMsg, msg: [object Object] +767ms
  zigbee-shepherd:msgHdlr IND <-- AF:incomingMsg, transId: 0 +6ms
  zigbee-shepherd:af dispatchIncomingMsg(): type: zclIncomingMsg, msg: [object Object] +1ms
7/2/2018, 8:14:00 PM DEBUG Recieved zigbee message with data {"cid":"genLevelCtrl","data":{"stepmode":1,"stepsize":30,"transtime":9}}
7/2/2018, 8:14:00 PM INFO MQTT publish, topic: 'zigbee2mqtt/Philips-Hue-Switch', payload: '{"brightness":155}'

But it think we should give the User the Choice what Attributes we should transport. So i think we should transport via mqtt:

up
down
up-pressed-counter (since pressed event timer starts)
down-pressed-counter (since pressed event timer starts)

BTW: This Remote Device is also a great and cheap 4 Button Remote with "two buttons with multiple states". So the WAF Factor seems to be great ;) I will use them with some selfprinted Icons on Front for the different Rooms.

Koenkk commented 6 years ago

@tb-killa implemented, possible actions are: up-press, down-press, up-hold, down-hold, up-hold-release, down-hold-release.

Can you also test if the brightness works when holding the buttons?

clockbrain commented 6 years ago

I'm still keen to get this working but am a bit lost with the various patches. Is there a simple list of the patches I should apply to test this. (Not sure if I applied the previous code correctly).

Or if it is close to working I can wait till the patches are checked in and I'll try again from the master.

Koenkk commented 6 years ago

@clockbrain all code is in this branch: https://github.com/Koenkk/zigbee-shepherd-converters/tree/hue_remote

clockbrain commented 6 years ago

Thanks but it still doesn't want to cooperate with me. I can pair the dimmer but as soon as I press any button I get:

/opt/zigbee2mqtt/node_modules/zigbee-shepherd/node_modules/zcl-packet/lib/functional.js:33
        throw new Error('Unrecognized command');
        ^

Error: Unrecognized command
    at new FuncPayload (/opt/zigbee2mqtt/node_modules/zigbee-shepherd/node_modules/zcl-packet/lib/functional.js:33:15)
    at /opt/zigbee2mqtt/node_modules/zigbee-shepherd/node_modules/zcl-packet/lib/zcl.js:33:22
    at Dissolve.<anonymous> (/opt/zigbee2mqtt/node_modules/zigbee-shepherd/node_modules/zcl-packet/lib/zcl.js:121:9)
    at Object.onceWrapper (events.js:315:30)
    at emitOne (events.js:116:13)
    at Dissolve.emit (events.js:211:7)
    at Dissolve.<anonymous> (/opt/zigbee2mqtt/node_modules/zigbee-shepherd/node_modules/dissolve-chunks/index.js:73:29)
    at emitNone (events.js:106:13)
    at Dissolve.emit (events.js:208:7)
    at emitReadable_ (/opt/zigbee2mqtt/node_modules/zigbee-shepherd/node_modules/dissolve/node_modules/readable-stream/lib/_stream_readable.js:456:10)

I've refreshed using this sequence:

# Update
git checkout HEAD -- npm-shrinkwrap.json
git pull
rm -rf node_modules
npm install
cd node_modules
rm -rf zigbee-shepherd-converters zigbee-shepherd
git clone https://github.com/Koenkk/zigbee-shepherd-converters.git -b hue_remote
git clone https://github.com/Koenkk/zigbee-shepherd.git -b hue_remote
cd zigbee-shepherd
npm install
cd ../zigbee-shepherd-converters
npm install

I also add the line

"manuSpecificCluster1": 64512

to zcl-id/definitions/common.json as advised earlier. I make sure there is only 1 copy of zcl-id in the tree.

So, I've done this whole sequence about 5 times now and same result each time. I've also reflashed the firmware a few times in case that was the problem but would have to say I'm stuck at this point.

tb-killa commented 6 years ago

@clockbrain Please read my Post above: https://github.com/Koenkk/zigbee2mqtt/issues/36#issuecomment-401615228

I dont use the manuSpecificCluster1 binding.

Will provide some more logs this evening if i got some free time.

Koenkk commented 6 years ago

@clockbrain sorry, you also need this zigbee-shepherd branch: https://github.com/koenkk/zigbee-shepherd/tree/hue_remote

tb-killa commented 6 years ago

@Koenkk Looks great

2018-7-3 22:44:55 INFO Succesfully configured 0x0017880103caab06
2018-7-3 22:45:32 INFO MQTT publish, topic: 'zigbee2mqtt/0x0017880103caab06', payload: '{"action":"on"}'
2018-7-3 22:45:36 INFO MQTT publish, topic: 'zigbee2mqtt/0x0017880103caab06', payload: '{"action":"off"}'
2018-7-3 22:45:40 INFO MQTT publish, topic: 'zigbee2mqtt/0x0017880103caab06', payload: '{"action":"up-press","brightness":255}'
2018-7-3 22:45:44 INFO MQTT publish, topic: 'zigbee2mqtt/0x0017880103caab06', payload: '{"action":"down-press","brightness":205}'
2018-7-3 22:45:47 INFO MQTT publish, topic: 'zigbee2mqtt/0x0017880103caab06', payload: '{"action":"up-press","brightness":255}'
2018-7-3 22:45:48 INFO MQTT publish, topic: 'zigbee2mqtt/0x0017880103caab06', payload: '{"action":"up-hold"}'
2018-7-3 22:45:49 INFO MQTT publish, topic: 'zigbee2mqtt/0x0017880103caab06', payload: '{"action":"up-hold"}'
2018-7-3 22:45:50 INFO MQTT publish, topic: 'zigbee2mqtt/0x0017880103caab06', payload: '{"brightness":255,"action":"up-hold-release"}'
2018-7-3 22:45:57 INFO MQTT publish, topic: 'zigbee2mqtt/0x0017880103caab06', payload: '{"action":"down-press","brightness":205}'
2018-7-3 22:45:58 INFO MQTT publish, topic: 'zigbee2mqtt/0x0017880103caab06', payload: '{"action":"down-hold"}'
2018-7-3 22:45:59 INFO MQTT publish, topic: 'zigbee2mqtt/0x0017880103caab06', payload: '{"action":"down-hold"}'
2018-7-3 22:45:59 INFO MQTT publish, topic: 'zigbee2mqtt/0x0017880103caab06', payload: '{"brightness":165.3,"action":"down-hold-release"}'
tb-killa commented 6 years ago

This is my database.db entry after the successfully configured.

{"id":2,"type":"EndDevice","ieeeAddr":"0x0017880103caab06","nwkAddr":15394,"manufId":4107,"manufName":"Philips","powerSource":"Battery","modelId":"RWL021","epList":[1,2],"status":"online","joinTime":1530650683,"endpoints":{"1":{"profId":49246,"epId":1,"devId":2096,"inClusterList":[0],"outClusterList":[0,3,4,5,6,8],"clusters":{"genBasic":{"dir":{"value":3},"attrs":{"zclVersion":1,"appVersion":2,"stackVersion":1,"hwVersion":1,"manufacturerName":"Philips","modelId":"RWL021","dateCode":"20160302","powerSource":3,"swBuildId":"5.45.1.17846"}},"genIdentify":{"dir":{"value":2},"attrs":{}},"genGroups":{"dir":{"value":2},"attrs":{}},"genScenes":{"dir":{"value":2},"attrs":{}},"genOnOff":{"dir":{"value":2},"attrs":{}},"genLevelCtrl":{"dir":{"value":2},"attrs":{}}}},"2":{"profId":260,"epId":2,"devId":12,"inClusterList":[0,1,3,15,64512],"outClusterList":[25],"clusters":{"64512":{"dir":{"value":1},"attrs":{}},"genBasic":{"dir":{"value":1},"attrs":{"zclVersion":1,"appVersion":2,"stackVersion":1,"hwVersion":1,"manufacturerName":"Philips","modelId":"RWL021","dateCode":"20160302","powerSource":3,"swBuildId":"5.45.1.17846"}},"genPowerCfg":{"dir":{"value":1},"attrs":{"batteryVoltage":28,"batteryPercentageRemaining":200}},"genIdentify":{"dir":{"value":1},"attrs":{}},"genBinaryInput":{"dir":{"value":1},"attrs":{}},"genOta":{"dir":{"value":2},"attrs":{}}}}},"_id":"5xl8FRujrwMGLJi6"}

We need now the battery informations also to complete this issue

arteck commented 6 years ago

very nice..plz marge it

Koenkk commented 6 years ago

@tb-killa updated:

tb-killa commented 6 years ago

@Koenkk Tested:

2018-7-4 22:25:44 INFO Succesfully configured 0x0017880103caab06
spinlock: false []
2018-7-4 22:25:49 INFO MQTT publish, topic: 'zigbee2mqtt/philips-hue-switch', payload: '{"action":"on"}'
2018-7-4 22:26:00 INFO MQTT publish, topic: 'zigbee2mqtt/philips-hue-switch', payload: '{"action":"off"}'
2018-7-4 22:26:02 INFO MQTT publish, topic: 'zigbee2mqtt/philips-hue-switch', payload: '{"action":"up-press","brightness":255}'
2018-7-4 22:26:03 INFO MQTT publish, topic: 'zigbee2mqtt/philips-hue-switch', payload: '{"action":"up-hold","brightness":255}'
2018-7-4 22:26:04 INFO MQTT publish, topic: 'zigbee2mqtt/philips-hue-switch', payload: '{"action":"up-hold","brightness":255}'
spinlock: true []
2018-7-4 22:26:06 INFO MQTT publish, topic: 'zigbee2mqtt/philips-hue-switch', payload: '{"action":"down-press","brightness":205}'
2018-7-4 22:26:07 INFO MQTT publish, topic: 'zigbee2mqtt/philips-hue-switch', payload: '{"action":"down-hold","brightness":255}'
2018-7-4 22:26:08 INFO MQTT publish, topic: 'zigbee2mqtt/philips-hue-switch', payload: '{"action":"down-hold","brightness":173.9}'
2018-7-4 22:26:08 INFO MQTT publish, topic: 'zigbee2mqtt/philips-hue-switch', payload: '{"action":"down-hold","brightness":94.7}'
2018-7-4 22:26:09 INFO MQTT publish, topic: 'zigbee2mqtt/philips-hue-switch', payload: '{"action":"down-hold","brightness":14.900000000000006}'
2018-7-4 22:26:10 INFO MQTT publish, topic: 'zigbee2mqtt/philips-hue-switch', payload: '{"brightness":0,"action":"null-hold-release"}'
2018-7-4 22:26:17 INFO MQTT publish, topic: 'zigbee2mqtt/philips-hue-switch', payload: '{"action":"up-press","brightness":50}'
2018-7-4 22:26:17 INFO MQTT publish, topic: 'zigbee2mqtt/philips-hue-switch', payload: '{"action":"up-hold","brightness":50}'
2018-7-4 22:26:18 INFO MQTT publish, topic: 'zigbee2mqtt/philips-hue-switch', payload: '{"brightness":89.8,"action":"null-hold-release"}'
2018-7-4 22:26:22 INFO MQTT publish, topic: 'zigbee2mqtt/philips-hue-switch', payload: '{"action":"down-press","brightness":39.8}'
2018-7-4 22:26:23 INFO MQTT publish, topic: 'zigbee2mqtt/philips-hue-switch', payload: '{"action":"down-hold","brightness":39.8}'
2018-7-4 22:26:24 INFO MQTT publish, topic: 'zigbee2mqtt/philips-hue-switch', payload: '{"action":"down-hold","brightness":0}'
2018-7-4 22:26:24 INFO MQTT publish, topic: 'zigbee2mqtt/philips-hue-switch', payload: '{"brightness":0,"action":"null-hold-release"}'
2018-7-4 22:26:34 INFO Device incoming...
2018-7-4 22:26:34 INFO MQTT publish, topic: 'zigbee2mqtt/bridge/log', payload: '{"type":"pairing","message":"device incoming"}'
device already in network
2018-7-4 22:26:46 INFO MQTT publish, topic: 'zigbee2mqtt/philips-hue-switch', payload: '{"action":"up-press","brightness":50}'
2018-7-4 22:26:48 INFO MQTT publish, topic: 'zigbee2mqtt/philips-hue-switch', payload: '{"action":"down-press","brightness":0}'
2018-7-4 22:26:53 INFO MQTT publish, topic: 'zigbee2mqtt/philips-hue-switch', payload: '{"action":"on"}'
spinlock: false []
device already in network
2018-7-4 22:27:05 INFO MQTT publish, topic: 'zigbee2mqtt/philips-hue-switch', payload: '{"action":"off"}'

Sadly no battery informations or return of No converter available

Koenkk commented 6 years ago

@tb-killa can you update and try again?

tb-killa commented 6 years ago

@Koenkk I updated and pair again, but sadly now new messages or power code inside debug message.

Koenkk commented 6 years ago

@tb-killa did you see the Sucesfully configured message for this device?

tb-killa commented 6 years ago

It seems to be that it failed:

2018-07-05T19:26:46.637Z - info: zigbee-shepherd ready
2018-07-05T19:26:46.676Z - info: Connected to MQTT server
2018-07-05T19:26:46.679Z - info: MQTT publish, topic: 'zigbee2mqtt/bridge/state', payload: 'online'
2018-07-05T19:27:36.014Z - error: Failed to configure 0x0017880103caab06
2018-07-05T19:30:34.331Z - debug: Recieved zigbee message with data {"cid":"genOnOff","data":{}}
2018-07-05T19:30:34.336Z - info: MQTT publish, topic: 'zigbee2mqtt/0x0017880103caab06', payload: '{"action":"on"}'
2018-07-05T19:30:35.972Z - debug: Recieved zigbee message with data {"cid":"genOnOff","data":{"effectid":0,"effectvariant":0}}
2018-07-05T19:30:35.975Z - info: MQTT publish, topic: 'zigbee2mqtt/0x0017880103caab06', payload: '{"action":"off"}'
2018-07-05T19:30:40.813Z - debug: Recieved zigbee message with data {"cid":"genLevelCtrl","data":{"stepmode":0,"stepsize":30,"transtime":9}}
2018-07-05T19:30:40.818Z - info: MQTT publish, topic: 'zigbee2mqtt/0x0017880103caab06', payload: '{"action":"up-press","brightness":255}'
2018-07-05T19:30:42.675Z - debug: Recieved zigbee message with data {"cid":"genLevelCtrl","data":{"stepmode":1,"stepsize":30,"transtime":9}}
2018-07-05T19:30:42.680Z - info: MQTT publish, topic: 'zigbee2mqtt/0x0017880103caab06', payload: '{"action":"down-press","brightness":205}'
2018-07-05T19:43:01.025Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:43:02.585Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:43:09.621Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:43:16.630Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:43:23.619Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:43:30.619Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:43:37.619Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:43:44.619Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:43:51.618Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:43:58.618Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:44:05.617Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:44:12.617Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:44:12.628Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:44:12.630Z - info: Device incoming...
2018-07-05T19:44:12.633Z - info: MQTT publish, topic: 'zigbee2mqtt/bridge/log', payload: '{"type":"pairing","message":"device incoming"}'
2018-07-05T19:44:12.638Z - debug: Recieved zigbee message with data "online"
2018-07-05T19:45:16.707Z - debug: Recieved zigbee message with data {"cid":"genOnOff","data":{}}
2018-07-05T19:45:16.710Z - info: MQTT publish, topic: 'zigbee2mqtt/0x0017880103caab06', payload: '{"action":"on"}'
2018-07-05T19:46:05.491Z - debug: Recieved zigbee message with data {"cid":"genOnOff","data":{"effectid":0,"effectvariant":0}}
2018-07-05T19:46:05.495Z - info: MQTT publish, topic: 'zigbee2mqtt/0x0017880103caab06', payload: '{"action":"off"}'

Will remove and try again

tb-killa commented 6 years ago

Nope it doesnt configured correct :(

2018-07-05T19:56:18.865Z - info: Connected to MQTT server
2018-07-05T19:56:18.869Z - info: MQTT publish, topic: 'zigbee2mqtt/bridge/state', payload: 'online'
2018-07-05T19:57:02.079Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:57:02.085Z - info: Connecting with device...
2018-07-05T19:57:02.090Z - info: MQTT publish, topic: 'zigbee2mqtt/bridge/log', payload: '{"type":"pairing","message":"connecting with device"}'
2018-07-05T19:57:02.522Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:57:02.527Z - info: Connecting with device...
2018-07-05T19:57:02.531Z - info: MQTT publish, topic: 'zigbee2mqtt/bridge/log', payload: '{"type":"pairing","message":"connecting with device"}'
2018-07-05T19:57:04.095Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:57:04.098Z - info: Connecting with device...
2018-07-05T19:57:04.100Z - info: MQTT publish, topic: 'zigbee2mqtt/bridge/log', payload: '{"type":"pairing","message":"connecting with device"}'
2018-07-05T19:57:05.177Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:57:05.180Z - info: Connecting with device...
2018-07-05T19:57:05.183Z - info: MQTT publish, topic: 'zigbee2mqtt/bridge/log', payload: '{"type":"pairing","message":"connecting with device"}'
2018-07-05T19:57:05.696Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:57:05.701Z - info: Connecting with device...
2018-07-05T19:57:05.705Z - info: MQTT publish, topic: 'zigbee2mqtt/bridge/log', payload: '{"type":"pairing","message":"connecting with device"}'
2018-07-05T19:57:07.285Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:57:07.290Z - info: Connecting with device...
2018-07-05T19:57:07.293Z - info: MQTT publish, topic: 'zigbee2mqtt/bridge/log', payload: '{"type":"pairing","message":"connecting with device"}'
2018-07-05T19:57:08.170Z - error: Failed to configure 0x90fd9ffffed17c15
2018-07-05T19:57:08.879Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:57:08.883Z - info: Connecting with device...
2018-07-05T19:57:08.887Z - info: MQTT publish, topic: 'zigbee2mqtt/bridge/log', payload: '{"type":"pairing","message":"connecting with device"}'
2018-07-05T19:57:09.872Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:57:09.875Z - info: Connecting with device...
2018-07-05T19:57:09.878Z - info: MQTT publish, topic: 'zigbee2mqtt/bridge/log', payload: '{"type":"pairing","message":"connecting with device"}'
2018-07-05T19:57:10.392Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:57:10.394Z - info: Connecting with device...
2018-07-05T19:57:10.397Z - info: MQTT publish, topic: 'zigbee2mqtt/bridge/log', payload: '{"type":"pairing","message":"connecting with device"}'
2018-07-05T19:57:10.889Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:57:10.891Z - info: Connecting with device...
2018-07-05T19:57:10.893Z - info: MQTT publish, topic: 'zigbee2mqtt/bridge/log', payload: '{"type":"pairing","message":"connecting with device"}'
2018-07-05T19:57:11.398Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:57:11.401Z - info: Connecting with device...
2018-07-05T19:57:11.406Z - info: MQTT publish, topic: 'zigbee2mqtt/bridge/log', payload: '{"type":"pairing","message":"connecting with device"}'
2018-07-05T19:57:12.452Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:57:12.455Z - info: Connecting with device...
2018-07-05T19:57:12.457Z - info: MQTT publish, topic: 'zigbee2mqtt/bridge/log', payload: '{"type":"pairing","message":"connecting with device"}'
2018-07-05T19:57:12.481Z - debug: Recieved zigbee message with data "0x0017880103caab06"
2018-07-05T19:57:12.484Z - info: Device incoming...
2018-07-05T19:57:12.487Z - info: MQTT publish, topic: 'zigbee2mqtt/bridge/log', payload: '{"type":"pairing","message":"device incoming"}'
2018-07-05T19:57:12.490Z - info: New device with address 0x0017880103caab06 connected!
2018-07-05T19:57:12.526Z - info: MQTT publish, topic: 'zigbee2mqtt/bridge/log', payload: '{"type":"device_connected","message":"0x0017880103caab06"}'
2018-07-05T19:57:12.541Z - debug: Recieved zigbee message with data "online"
2018-07-05T19:57:15.459Z - error: Failed to configure 0x0017880103caab06
Koenkk commented 6 years ago

Can you provide the log after running with the following in devices.js:

    {
        zigbeeModel: ['RWL020', 'RWL021'],
        model: '324131092621',
        vendor: 'Philips',
        description: 'Hue dimmer Switch',
        supports: 'on/off',
        fromZigbee: [fz._324131092621_on, fz._324131092621_off, fz._324131092621_step, fz._324131092621_stop],
        toZigbee: [],
        configure: (ieeeAddr, shepherd, coordinator, callback) => {
            const ep1 = shepherd.find(ieeeAddr, 1);
            const actions = [
                (cb) => ep1.bind('genOnOff', coordinator, cb),
                (cb) => ep1.bind('genLevelCtrl', coordinator, cb),
            ];

            execute(ep1, actions, (result) => {
                if (result) {
                    const ep2 = shepherd.find(ieeeAddr, 2);
                    ep2.bind('genPowerCfg', coordinator, (err) => {
                        console.log('genPowerCfg bind result', err);

                        ep2.report('genPowerCfg', 'batteryVoltage', 0, 1000, 0, (err) => {
                            console.log('genPowerCfg report', err);

                            callback(!err);
                        });
                    });
                } else {
                    callback(result);
                }
            });
        },
    },
tb-killa commented 6 years ago

@Koenkk : Nope :(

zigbee-shepherd:msgHdlr IND <-- ZDO:bindRsp +1ms
genPowerCfg bind result null
 zigbee-shepherd:af dispatchIncomingMsg(): type: zclIncomingMsg, msg: [object Object] +1ms
genPowerCfg report unreportableAttribute
2018-7-6 14:57:26 ERROR Failed to configure 0x0017880103caab06
Koenkk commented 6 years ago

Reading the zigbee cluster library specification, reporting of batteryVoltage is not possible, but batteryPercentageRemaining should.

Can you try:

    {
        zigbeeModel: ['RWL020', 'RWL021'],
        model: '324131092621',
        vendor: 'Philips',
        description: 'Hue dimmer Switch',
        supports: 'on/off',
        fromZigbee: [fz._324131092621_on, fz._324131092621_off, fz._324131092621_step, fz._324131092621_stop],
        toZigbee: [],
        configure: (ieeeAddr, shepherd, coordinator, callback) => {
            const ep1 = shepherd.find(ieeeAddr, 1);
            const actions = [
                (cb) => ep1.bind('genOnOff', coordinator, cb),
                (cb) => ep1.bind('genLevelCtrl', coordinator, cb),
            ];

            execute(ep1, actions, (result) => {
                if (result) {
                    const ep2 = shepherd.find(ieeeAddr, 2);
                    ep2.bind('genPowerCfg', coordinator, (err) => {
                        console.log('genPowerCfg bind result', err);

                        ep2.report('genPowerCfg', 'batteryPercentageRemaining', 0, 1000, 0, (err) => {
                            console.log('genPowerCfg report', err);

                            callback(!err);
                        });
                    });
                } else {
                    callback(result);
                }
            });
        },
    },
tb-killa commented 6 years ago

@Koenkk will try it tomorrow. Look at this, there is battery reporting available : https://github.com/digitalgecko/mySmartThings/blob/master/devicetypes/digitalgecko/hue-dimmer-switch-zha.src/hue-dimmer-switch-zha.groovy

clockbrain commented 6 years ago

@Koenkk I'm now getting good results from Hue dimmer except no battery information. Can I suggest you merge as-is. Its difficult for me to test the hue_remote branch because it doesn't include some devices in master that I use. Manually trying to merge the code just causes breakage.

Here's the MQTT stream I now get from the hue_remote branch

pi@raspberrypi ~ $ mosquitto_sub -t "zigbee2mqtt/Dimmer" -h 192.168.x.x-u mosuser
{"action":"on"}
{"action":"down-press","brightness":205}
{"action":"down-hold","brightness":205}
{"brightness":118,"action":"down-hold-release"}
{"action":"up-press","brightness":168}
{"action":"up-hold","brightness":168}
{"brightness":230.7,"action":"up-hold-release"}
{"action":"down-press","brightness":180.7}
{"action":"up-press","brightness":230.7}
{"action":"off"}

Minor issue - order of entries for *-hold-release is backwards to the others. Could you swap lines 547 and 548 in fromZigbee.js/_324131092621_stop to fix that?

thanks for all your good work.