diff --git a/docgen/integrating-with-homeassistant.js b/docgen/integrating-with-homeassistant.js index 1d23f55a5..6da7b1d09 100644 --- a/docgen/integrating-with-homeassistant.js +++ b/docgen/integrating-with-homeassistant.js @@ -92,14 +92,17 @@ devices.forEach((device) => { configuration += '```yaml\n'; const configurations = homeassistant._getMapping()[device.model]; - configurations.forEach((d, i) => { - configuration += homeassistantConfig(d); - if (configurations.length > 1 && i < configurations.length - 1) { - configuration += '\n'; - } - }); - configuration += '```\n\n'; + if (configurations) { + configurations.forEach((d, i) => { + configuration += homeassistantConfig(d); + if (configurations.length > 1 && i < configurations.length - 1) { + configuration += '\n'; + } + }); + + configuration += '```\n\n'; + } }); diff --git a/docs/integrating-with-homeassistant.md b/docs/integrating-with-homeassistant.md index d5752b22a..17d45f337 100644 --- a/docs/integrating-with-homeassistant.md +++ b/docs/integrating-with-homeassistant.md @@ -1988,6 +1988,28 @@ light: command_topic: "zigbee2mqtt//set" ``` +### 900008-WW +```yaml +light: + - platform: "mqtt_json" + state_topic: "zigbee2mqtt/" + availability_topic: "zigbee2mqtt/bridge/state" + brightness: true + command_topic: "zigbee2mqtt//set" +``` + +### Mega23M12 +```yaml +light: + - platform: "mqtt_json" + state_topic: "zigbee2mqtt/" + availability_topic: "zigbee2mqtt/bridge/state" + brightness: true + color_temp: true + xy: true + command_topic: "zigbee2mqtt//set" +``` + ### 4256251-RZHAC ```yaml switch: diff --git a/docs/supported-devices.md b/docs/supported-devices.md index c9d31b51e..29aad811c 100644 --- a/docs/supported-devices.md +++ b/docs/supported-devices.md @@ -1,6 +1,6 @@ *NOTE: This file has been generated, do not edit this file manually!* -Currently **129** devices are supported from **25** different vendors. +Currently **131** devices are supported from **27** different vendors. In case you own a Zigbee device which is **NOT** listed here, please see [How to support new devices](https://github.com/Koenkk/zigbee2mqtt/wiki/How-to-support-new-devices). @@ -34,6 +34,11 @@ In case you own a Zigbee device which is **NOT** listed here, please see | DNCKATSW003 | Custom devices (DiY) [DNCKAT triple key wired wall light switch](https://github.com/dzungpv/dnckatsw00x/) (hold/release, on/off) | ![https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/DNCKATSW003.jpg](https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/DNCKATSW003.jpg) | | DNCKATSW004 | Custom devices (DiY) [DNCKAT quadruple key wired wall light switch](https://github.com/dzungpv/dnckatsw00x/) (hold/release, on/off) | ![https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/DNCKATSW004.jpg](https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/DNCKATSW004.jpg) | +### Dresden Elektronik +| Model | Description | Picture | +| ------------- | ------------- | -------------------------- | +| Mega23M12 | Dresden Elektronik ZigBee Light Link wireless electronic ballast (on/off, brightness, color temperature, color xy) | ![https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/Mega23M12.jpg](https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/Mega23M12.jpg) | + ### EDP | Model | Description | Picture | | ------------- | ------------- | -------------------------- | @@ -67,7 +72,7 @@ In case you own a Zigbee device which is **NOT** listed here, please see | LED1536G5 | IKEA TRADFRI LED bulb E12/E14 400 lumen, dimmable, white spectrum, opal white (on/off, brightness, color temperature) | ![https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/LED1536G5.jpg](https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/LED1536G5.jpg) | | LED1622G12 | IKEA TRADFRI LED bulb E26 1000 lumen, dimmable, opal white (on/off, brightness) | ![https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/LED1622G12.jpg](https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/LED1622G12.jpg) | | LED1624G9 | IKEA TRADFRI LED bulb E27/E26 600 lumen, dimmable, color, opal white (on/off, brightness, color temperature, color xy) | ![https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/LED1624G9.jpg](https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/LED1624G9.jpg) | -| LED1649C5 | IKEA TRADFRI LED bulb E12/E14 400 lumen, dimmable warm white, chandelier opal (on/off, brightness) | ![https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/LED1649C5.jpg](https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/LED1649C5.jpg) | +| LED1649C5 | IKEA TRADFRI LED bulb E12/E14/E17 400 lumen, dimmable warm white, chandelier opal (on/off, brightness) | ![https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/LED1649C5.jpg](https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/LED1649C5.jpg) | | ICTC-G-1 | IKEA TRADFRI wireless dimmer (brightness [0-255], quick rotate for instant 0/255) | ![https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/ICTC-G-1.jpg](https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/ICTC-G-1.jpg) | | ICPSHC24-10EU-IL-1 | IKEA TRADFRI driver for wireless control (10 watt) (on/off, brightness) | ![https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/ICPSHC24-10EU-IL-1.jpg](https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/ICPSHC24-10EU-IL-1.jpg) | | ICPSHC24-30EU-IL-1 | IKEA TRADFRI driver for wireless control (30 watt) (on/off, brightness) | ![https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/ICPSHC24-30EU-IL-1.jpg](https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/ICPSHC24-30EU-IL-1.jpg) | @@ -226,7 +231,7 @@ In case you own a Zigbee device which is **NOT** listed here, please see | MCCGQ01LM | Xiaomi MiJia door & window contact sensor (contact) | ![https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/MCCGQ01LM.jpg](https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/MCCGQ01LM.jpg) | | MCCGQ11LM | Xiaomi Aqara door & window contact sensor (contact) | ![https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/MCCGQ11LM.jpg](https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/MCCGQ11LM.jpg) | | SJCGQ11LM | Xiaomi Aqara water leak sensor (water leak true/false) | ![https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/SJCGQ11LM.jpg](https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/SJCGQ11LM.jpg) | -| MFKZQ01LM | Xiaomi Mi smart home cube (shake, wakeup, fall, tap, slide, flip180, flip90, rotate_left and rotate_right) | ![https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/MFKZQ01LM.jpg](https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/MFKZQ01LM.jpg) | +| MFKZQ01LM | Xiaomi Mi/Aqara smart home cube (shake, wakeup, fall, tap, slide, flip180, flip90, rotate_left and rotate_right) | ![https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/MFKZQ01LM.jpg](https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/MFKZQ01LM.jpg) | | ZNCZ02LM | Xiaomi Mi power plug ZigBee (on/off, power measurement) | ![https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/ZNCZ02LM.jpg](https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/ZNCZ02LM.jpg) | | QBCZ11LM | Xiaomi Aqara socket Zigbee (on/off, power measurement) | ![https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/QBCZ11LM.jpg](https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/QBCZ11LM.jpg) | | JTYJ-GD-01LM/BW | Xiaomi MiJia Honeywell smoke detector (smoke) | ![https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/JTYJ-GD-01LM-BW.jpg](https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/JTYJ-GD-01LM-BW.jpg) | @@ -234,4 +239,9 @@ In case you own a Zigbee device which is **NOT** listed here, please see | A6121 | Xiaomi Vima Smart Lock (inserted, forgotten, key error) | ![https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/A6121.jpg](https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/A6121.jpg) | | DJT11LM | Xiaomi Aqara vibration sensor (drop, tilt and touch) | ![https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/DJT11LM.jpg](https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/DJT11LM.jpg) | +### ilux +| Model | Description | Picture | +| ------------- | ------------- | -------------------------- | +| 900008-WW | ilux Dimmable A60 E27 LED Bulb (on/off, brightness) | ![https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/900008-WW.jpg](https://github.com/Koenkk/zigbee2mqtt/raw/dev/images/devices/900008-WW.jpg) | + diff --git a/images/devices/900008-WW.jpg b/images/devices/900008-WW.jpg new file mode 100644 index 000000000..ad814e832 Binary files /dev/null and b/images/devices/900008-WW.jpg differ diff --git a/images/devices/Mega23M12.jpg b/images/devices/Mega23M12.jpg new file mode 100644 index 000000000..bdb51c7d1 Binary files /dev/null and b/images/devices/Mega23M12.jpg differ diff --git a/lib/extension/homeassistant.js b/lib/extension/homeassistant.js index f3dcacc95..a00ef0ebb 100644 --- a/lib/extension/homeassistant.js +++ b/lib/extension/homeassistant.js @@ -396,6 +396,8 @@ const mapping = { 'RB 285 C': [configurations.light_brightness_colortemp_colorxy], '3216331P5': [configurations.light_brightness_colortemp], 'AC08562': [configurations.light_brightness], + '900008-WW': [configurations.light_brightness], + 'Mega23M12': [configurations.light_brightness_colortemp_colorxy], }; /** diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 3d1d25d08..594f7d7f8 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -219,9 +219,9 @@ "dev": true }, "acorn-jsx": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.0.0.tgz", - "integrity": "sha512-XkB50fn0MURDyww9+UYL3c1yLbOBz0ZFvrdYlGB8l+Ije1oSC75qAqrzSPjYQbdnQUzhlUGNKuesryAv0gxZOg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.0.1.tgz", + "integrity": "sha512-HJ7CfNHrfJLlNTzIEUTj43LNWGkqpRLxm3YjAlcD0ACydk9XynzYsCBHxut+iqt+1aBXkx9UP/w/ZqMr13XIzg==", "dev": true }, "ajv": { @@ -666,7 +666,7 @@ }, "callsites": { "version": "0.2.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", + "resolved": "http://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", "dev": true }, @@ -1001,7 +1001,7 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" } } @@ -3708,10 +3708,11 @@ }, "dependencies": { "clone-deep": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.0.tgz", - "integrity": "sha512-aNJ5/7Bz2IYBb7nIj34TLGk78lBXpXUgV9qsLngtTvJ9+scsZNnlU0OX2S2N4ax/sUQt7sDBkXiGjGJEmNbXOQ==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", "requires": { + "is-plain-object": "^2.0.4", "kind-of": "^6.0.2", "shallow-clone": "^3.0.0" } @@ -3851,9 +3852,9 @@ "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=" }, "queue": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/queue/-/queue-4.5.0.tgz", - "integrity": "sha512-DwxpAnqJuoQa+wyDgQuwkSshkhlqIlWEvwvdAY27fDPunZ2cVJzXU4JyjY+5l7zs7oGLaYAQm4MbLOVFAHFBzA==", + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/queue/-/queue-4.5.1.tgz", + "integrity": "sha512-AMD7w5hRXcFSb8s9u38acBZ+309u6GsiibP4/0YacJeaurRshogB7v/ZcVPxP5gD5+zIw6ixRHdutiYUJfwKHw==", "requires": { "inherits": "~2.0.0" } @@ -4302,7 +4303,7 @@ }, "stream-browserify": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz", + "resolved": "http://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz", "integrity": "sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds=", "requires": { "inherits": "~2.0.1", @@ -4326,7 +4327,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "requires": { "safe-buffer": "~5.1.0" @@ -4804,9 +4805,9 @@ } }, "zigbee-shepherd-converters": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/zigbee-shepherd-converters/-/zigbee-shepherd-converters-5.0.2.tgz", - "integrity": "sha512-+G4QkFGVg13Iyb4dW8vijaz305DpFoQTICqgconguCS5mhHJYORBKVVKQ1FywkdbDLIIkF4IYUyO+Y74vMhufg==", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/zigbee-shepherd-converters/-/zigbee-shepherd-converters-5.0.3.tgz", + "integrity": "sha512-dBEAAWniNWWiP5T7anG6uQR19x9dyFIXuoxTT9cMTjPb1fswqGg+Ie8NJhBKcFDVwJyP8gz3hOFuHWJlc/22mw==", "requires": { "debounce": "*", "zcl-id": "*" diff --git a/package.json b/package.json index c7312cab5..a27f6d479 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "rimraf": "*", "winston": "2.4.2", "zigbee-shepherd": "git+https://github.com/Koenkk/zigbee-shepherd.git#ce52ac4131e2a505af6197b4a26d2b5360e4eb80", - "zigbee-shepherd-converters": "5.0.2" + "zigbee-shepherd-converters": "5.0.3" }, "devDependencies": { "chai": "*", diff --git a/test/devicePublish.test.js b/test/devicePublish.test.js index 2ad89eb59..082d17923 100644 --- a/test/devicePublish.test.js +++ b/test/devicePublish.test.js @@ -42,6 +42,51 @@ describe('DevicePublish', () => { chai.assert.deepEqual(zigbee.publish.getCall(0).args[6], null); }); + it('Should publish messages to zigbee devices when brightness is in %', () => { + zigbee.publish.resetHistory(); + zigbee.getDevice = sinon.fake.returns({modelId: 'TRADFRI bulb E27 CWS opal 600lm'}); + devicePublish = new DevicePublish(zigbee, mqtt, null, null); + devicePublish.onMQTTMessage('zigbee2mqtt/0x12345678/set', JSON.stringify({brightness: '92%'})); + chai.assert.isTrue(zigbee.publish.calledOnce); + chai.assert.strictEqual(zigbee.publish.getCall(0).args[0], '0x12345678'); + chai.assert.strictEqual(zigbee.publish.getCall(0).args[1], 'genLevelCtrl'); + chai.assert.strictEqual(zigbee.publish.getCall(0).args[2], 'moveToLevelWithOnOff'); + chai.assert.strictEqual(zigbee.publish.getCall(0).args[3], 'functional'); + chai.assert.deepEqual(zigbee.publish.getCall(0).args[4], {level: '235', transtime: 0}); + chai.assert.deepEqual(zigbee.publish.getCall(0).args[5], cfg.default); + chai.assert.deepEqual(zigbee.publish.getCall(0).args[6], null); + }); + + it('Should publish messages to zigbee devices with color_temp', () => { + zigbee.publish.resetHistory(); + zigbee.getDevice = sinon.fake.returns({modelId: 'TRADFRI bulb E27 CWS opal 600lm'}); + devicePublish = new DevicePublish(zigbee, mqtt, null, null); + devicePublish.onMQTTMessage('zigbee2mqtt/0x12345678/set', JSON.stringify({color_temp: '222'})); + chai.assert.isTrue(zigbee.publish.calledOnce); + chai.assert.strictEqual(zigbee.publish.getCall(0).args[0], '0x12345678'); + chai.assert.strictEqual(zigbee.publish.getCall(0).args[1], 'lightingColorCtrl'); + chai.assert.strictEqual(zigbee.publish.getCall(0).args[2], 'moveToColorTemp'); + chai.assert.strictEqual(zigbee.publish.getCall(0).args[3], 'functional'); + chai.assert.deepEqual(zigbee.publish.getCall(0).args[4], {colortemp: '222', transtime: 0}); + chai.assert.deepEqual(zigbee.publish.getCall(0).args[5], cfg.default); + chai.assert.deepEqual(zigbee.publish.getCall(0).args[6], null); + }); + + it('Should publish messages to zigbee devices with color_temp in %', () => { + zigbee.publish.resetHistory(); + zigbee.getDevice = sinon.fake.returns({modelId: 'TRADFRI bulb E27 CWS opal 600lm'}); + devicePublish = new DevicePublish(zigbee, mqtt, null, null); + devicePublish.onMQTTMessage('zigbee2mqtt/0x12345678/set', JSON.stringify({color_temp: '100%'})); + chai.assert.isTrue(zigbee.publish.calledOnce); + chai.assert.strictEqual(zigbee.publish.getCall(0).args[0], '0x12345678'); + chai.assert.strictEqual(zigbee.publish.getCall(0).args[1], 'lightingColorCtrl'); + chai.assert.strictEqual(zigbee.publish.getCall(0).args[2], 'moveToColorTemp'); + chai.assert.strictEqual(zigbee.publish.getCall(0).args[3], 'functional'); + chai.assert.deepEqual(zigbee.publish.getCall(0).args[4], {colortemp: '500', transtime: 0}); + chai.assert.deepEqual(zigbee.publish.getCall(0).args[5], cfg.default); + chai.assert.deepEqual(zigbee.publish.getCall(0).args[6], null); + }); + it('Should publish messages to zigbee devices with non-default ep', () => { zigbee.publish.resetHistory(); zigbee.getDevice = sinon.fake.returns({modelId: 'lumi.ctrl_neutral1'});