From 19f3fa578c711ca444bec388220d2250a3c2a001 Mon Sep 17 00:00:00 2001 From: Sujith Gannamaneni Date: Thu, 8 Sep 2022 11:38:44 -0400 Subject: [PATCH] New device support for Sonoff Zigbee 3.0 USB Dongle Plus (EFR32MG21) This PR will address the new device support request described under the below issue https://github.com/Koenkk/zigbee2mqtt/issues/13894 --- devices/sonoff.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/devices/sonoff.js b/devices/sonoff.js index 1ce116ae0c4fe..01ca131399fe3 100644 --- a/devices/sonoff.js +++ b/devices/sonoff.js @@ -5,6 +5,7 @@ const constants = require('../lib/constants'); const reporting = require('../lib/reporting'); const extend = require('../lib/extend'); const e = exposes.presets; +const ea = exposes.access; const ota = require('../lib/ota'); const fzLocal = { @@ -20,6 +21,19 @@ const fzLocal = { }, }; +const reader = { + router_config: { + cluster: 'genLevelCtrl', + type: ['attributeReport', 'readResponse'], + convert: (model, msg, publish, options, meta) => { + const result = {}; + if (msg.data.hasOwnProperty('currentLevel')) { + result.light_indicator_level = msg.data['currentLevel']; + } + } + } +}; + module.exports = [ { zigbeeModel: ['BASICZBR3'], @@ -189,4 +203,18 @@ module.exports = [ await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff']); }, }, + { + zigbeeModel: ['DONGLE-E_R'], + model: 'ZBDongle-E', + vendor: 'SONOFF', + description: 'Sonoff Zigbee 3.0 USB Dongle Plus (EFR32MG21) with router firmware (https://github.com/itead/Sonoff_Zigbee_Dongle_Firmware/tree/master/Dongle-E/Router)', + fromZigbee: [fz.linkquality_from_basic, reader.router_config], + toZigbee: [], + exposes: [exposes.numeric('light_indicator_level').withDescription('Brightness of the indicator light').withAccess(ea.STATE)], + configure: async (device, coordinatorEndpoint, logger) => { + const endpoint = device.getEndpoint(1); + device.powerSource = 'Mains (single phase)'; + device.save(); + }, + }, ];