From f750bb34f9a04aba09db14ee9f69a28eaaf3ac98 Mon Sep 17 00:00:00 2001 From: Koenkk Date: Wed, 16 May 2018 20:15:50 +0200 Subject: [PATCH] Support JTYJ-GD-01LM/BW. #4 --- lib/converters/zigbee2mqtt.js | 10 ++++++++-- lib/devices.js | 6 ++++++ lib/homeassistant.js | 12 ++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/lib/converters/zigbee2mqtt.js b/lib/converters/zigbee2mqtt.js index 7d8c2b92..fa87457f 100644 --- a/lib/converters/zigbee2mqtt.js +++ b/lib/converters/zigbee2mqtt.js @@ -45,7 +45,7 @@ const store = {} const parsers = [ { - devices: ['WXKG01LM', 'RTCGQ01LM', 'WSDCGQ01LM', 'MCCGQ01LM', 'WXKG11LM', 'MCCGQ11LM', 'RTCGQ11LM', 'WSDCGQ11LM', 'SJCGQ11LM', 'MFKZQ01LM'], + devices: ['WXKG01LM', 'RTCGQ01LM', 'WSDCGQ01LM', 'MCCGQ01LM', 'WXKG11LM', 'MCCGQ11LM', 'RTCGQ11LM', 'WSDCGQ11LM', 'SJCGQ11LM', 'MFKZQ01LM', 'JTYJ-GD-01LM/BW'], cid: 'genBasic', type: 'attReport', convert: (msg) => { @@ -321,6 +321,12 @@ const parsers = [ } } }, + { + devices: ['JTYJ-GD-01LM/BW'], + cid: 'ssIasZone', + type: 'statusChange', + convert: (msg) => {return {smoke: msg.data.zoneStatus === 1}} + }, // Ignore parsers (these message dont need parsing). { @@ -330,7 +336,7 @@ const parsers = [ convert: () => null }, { - devices: ['WXKG11LM', 'MCCGQ11LM', 'RTCGQ11LM', 'WSDCGQ11LM', 'SJCGQ11LM', 'MCCGQ01LM', 'RTCGQ01LM', 'WXKG01LM', 'WSDCGQ01LM'], + devices: ['WXKG11LM', 'MCCGQ11LM', 'RTCGQ11LM', 'WSDCGQ11LM', 'SJCGQ11LM', 'MCCGQ01LM', 'RTCGQ01LM', 'WXKG01LM', 'WSDCGQ01LM', 'JTYJ-GD-01LM/BW'], cid: 'genBasic', type: 'devChange', convert: () => null diff --git a/lib/devices.js b/lib/devices.js index 4c9a1ca0..532965bc 100644 --- a/lib/devices.js +++ b/lib/devices.js @@ -105,6 +105,12 @@ const devices = { supports: 'on/off, power measurement', vendor: 'Xiaomi', }, + 'lumi.sensor_smoke': { + model: 'JTYJ-GD-01LM/BW', + description: 'MiJia Honeywell smoke detector', + supports: 'smoke', + vendor: 'Xiaomi', + }, // IKEA 'TRADFRI bulb E27 WS opal 980lm': { diff --git a/lib/homeassistant.js b/lib/homeassistant.js index 1449046e..50116298 100644 --- a/lib/homeassistant.js +++ b/lib/homeassistant.js @@ -35,6 +35,17 @@ const configurations = { json_attributes: ['battery'] } }, + 'binary_sensor_smoke': { + type: 'binary_sensor', + object_id: 'smoke', + discovery_payload: { + payload_on: true, + payload_off: false, + value_template: '{{ value_json.smoke }}', + device_class: 'smoke', + json_attributes: ['battery'] + } + }, // Sensor 'sensor_illuminance': { @@ -197,6 +208,7 @@ const mapping = { 'LED1536G5': [configurations.light_brightness_colortemp], '7146060PH': [configurations.light_brightness_colortemp_xy], 'F7C033': [configurations.light_brightness], + 'JTYJ-GD-01LM/BW': [configurations.binary_sensor_smoke], }; // A map of all discoverd devices