kabbi/zigbee2mqtt-adapter

Need help adding support for new devices.

FabienTregan opened this issue · 3 comments

Hi. I try to add new device (ikea tradfri spot).

I think the addons runs well in webthings:

  • I see traces at webthings start:
2019-12-17 22:56:53.279 WARN   : manifest.json did not exist for add-on zigbee2mqtt-adapter
2019-12-17 22:56:53.281 INFO   : Not checking SHA256SUMS file for zigbee2mqtt-adapter since a .git directory was detec      ted
2019-12-17 22:56:53.307 INFO   : Loading add-on: zigbee2mqtt-adapter
2019-12-17 22:56:54.022 INFO   : zigbee2mqtt: Opening database: /home/pi/.mozilla-iot/config/db.sqlite3
2019-12-17 22:56:54.532 INFO   : zigbee2mqtt: Loading add-on zigbee2mqtt-adapter from /home/pi/.mozilla-iot/addons/zig      bee2mqtt-adapter
2019-12-17 22:56:55.004 INFO   : PageKite connected!
2019-12-17 22:56:55.007 INFO   : Starting certificate renewal.
2019-12-17 22:56:55.023 INFO   : Certificate not yet due for renewal.
2019-12-17 22:57:03.384 INFO   : Checking for add-on updates...
2019-12-17 22:57:05.839 INFO   : Not updating zigbee2mqtt-adapter since a .git directory was detected
2019-12-17 22:57:05.842 INFO   : Finished updating add-ons
  • When I try to add devices in webthings, I see an MQTT request to list devices:
zigbee2mqtt/bridge/config/devices/get (null)
zigbee2mqtt/bridge/config/devices [{"ieeeAddr":"0x00124b0019367fa1","type":"Coordinator","netw
...

the answer does contains some bulbs that I am trying to add:

    {
      "ieeeAddr": "0x14b457fffe487b91",
      "type": "Router",
      "networkAddress": 64343,
      "model": "LED1537R6",
      "friendly_name": "lum/salon/n10",
      "manufacturerID": 4476,
      "manufacturerName": "IKEA of Sweden",
      "powerSource": "Mains (single phase)",
      "modelID": "TRADFRI bulb GU10 WS 400lm",
      "hardwareVersion": 1,
      "softwareBuildID": "2.0.022",
      "dateCode": "20190308",
      "lastSeen": null
    }

(note: device needs to have / in its friend_name because that makes my node red flows way easier to maintain, but is this compatible with

this.client.subscribe(`${this.config.prefix}/+`);
?)
So I added the following in devices.js:

  'LED1537R6': {
    name: 'LED1537R6',
    '@type': ['Light', 'OnOffSwitch'],
    properties: {
      state: {
        '@type': 'OnOffProperty',
        type: 'boolean',
        fromMqtt: v => v === 'ON',
        toMqtt: v => (v ? 'ON' : 'OFF'),
      },
      brightness: {
        '@type': 'BrightnessProperty',
        type: 'number',
        minimum: 0,
        maximum: 255
      },
      color_temp: {
        type: 'integer',
        minimum: 0,
        maximum: 500,
      },
      linkquality: {
        type: 'integer',
        readOnly: true,
      },
    },
  },

but when I try to add device, the bulbs are not found:

2019-12-17 22:57:22.100 INFO   : About to call startPairing on ZigbeeMqttAdapter
2019-12-17 22:57:30.131 INFO   : Opened a new things socket
2019-12-17 22:58:22.107 INFO   : Pairing timeout
2019-12-17 22:58:22.112 ERROR  : Thing was not added
2019-12-17 22:58:22.114 ERROR  : addNewThing cancelled

Did I use the wrong name? Am I forced to factory request all my devicesand repair them from WebThings ?
I also tryed with TRADFRI bulb GU10 WS 400lm as name. I don't have supported devices to test withthem.

I added some trace before line 115 there:

addDevice(info) {
const description = Devices[info.modelId];
if (!description) {
return;
}

and it seemd that Z2M send modelID when 'modelId` is expected.:

2019-12-18 00:13:55.476 ERROR  : zigbee2mqtt: Ignoring unkown device  {
2019-12-18 00:13:55.477 ERROR  : zigbee2mqtt:   ieeeAddr: '0x14b457fffe487b91',
2019-12-18 00:13:55.478 ERROR  : zigbee2mqtt:   type: 'Router',
2019-12-18 00:13:55.478 ERROR  : zigbee2mqtt:   networkAddress: 64343,
2019-12-18 00:13:55.479 ERROR  : zigbee2mqtt:   model: 'LED1537R6',
2019-12-18 00:13:55.479 ERROR  : zigbee2mqtt:   friendly_name: 'n10',
2019-12-18 00:13:55.480 ERROR  : zigbee2mqtt:   manufacturerID: 4476,
2019-12-18 00:13:55.480 ERROR  : zigbee2mqtt:   manufacturerName: 'IKEA of Sweden',
2019-12-18 00:13:55.480 ERROR  : zigbee2mqtt:   powerSource: 'Mains (single phase)',
2019-12-18 00:13:55.481 ERROR  : zigbee2mqtt:   modelID: 'TRADFRI bulb GU10 WS 400lm',
2019-12-18 00:13:55.481 ERROR  : zigbee2mqtt:   hardwareVersion: 1,
2019-12-18 00:13:55.482 ERROR  : zigbee2mqtt:   softwareBuildID: '2.0.022',
2019-12-18 00:13:55.482 ERROR  : zigbee2mqtt:   dateCode: '20190308',
2019-12-18 00:13:55.483 ERROR  : zigbee2mqtt:   lastSeen: null
2019-12-18 00:13:55.484 ERROR  : zigbee2mqtt: }

Ok, replacing modelId with modelID line 113 fixed it !

I will add the bulb to the devices list