Skip to content

Commit

Permalink
Support ZGRC-KEY-013. Koenkk/zigbee2mqtt#642
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenkk committed May 19, 2019
1 parent 5f4ed03 commit a8f55c9
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
59 changes: 59 additions & 0 deletions converters/fromZigbee.js
Original file line number Diff line number Diff line change
Expand Up @@ -2470,6 +2470,65 @@ const converters = {
};
},
},
ZGRC013_cmdOn: {
cid: 'genOnOff',
type: 'cmdOn',
convert: (model, msg, publish, options) => {
const button = msg.endpoints[0].epId;
if (button) {
return {click: `${button}_on`};
}
},
},
ZGRC013_cmdOff: {
cid: 'genOnOff',
type: 'cmdOff',
convert: (model, msg, publish, options) => {
const button = msg.endpoints[0].epId;
if (button) {
return {click: `${button}_off`};
}
},
},
ZGRC013_brightness: {
cid: 'genLevelCtrl',
type: 'cmdMove',
convert: (model, msg, publish, options) => {
const button = msg.endpoints[0].epId;
const direction = msg.data.data.movemode == 0 ? 'up' : 'down';
if (button) {
return {click: `${button}_${direction}`};
}
},
},
ZGRC013_brightness_onoff: {
cid: 'genLevelCtrl',
type: 'cmdMoveWithOnOff',
convert: (model, msg, publish, options) => {
const button = msg.endpoints[0].epId;
const direction = msg.data.data.movemode == 0 ? 'up' : 'down';
if (button) {
return {click: `${button}_${direction}`};
}
},
},
ZGRC013_brightness_stop: {
cid: 'genLevelCtrl',
type: 'cmdStopWithOnOff',
convert: (model, msg, publish, options) => {
const button = msg.endpoints[0].epId;
if (button) {
return {click: `${button}_stop`};
}
},
},
ZGRC013_scene: {
cid: 'genScenes',
type: 'cmdRecall',
convert: (model, msg, publish, options) => {
return {click: `scene_${msg.data.data.groupid}_${msg.data.data.sceneid}`};
},
},

// Ignore converters (these message dont need parsing).
ignore_fan_change: {
Expand Down
24 changes: 24 additions & 0 deletions devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -4021,6 +4021,30 @@ const devices = [
],
toZigbee: [],
},

// RGB genie
{
zigbeeModel: ['ZGRC-KEY-013'],
model: 'ZGRC-KEY-013',
vendor: 'RGB Genie',
description: '3 Zone remote and dimmer',
supports: 'click',
fromZigbee: [
fz.generic_battery, fz.ZGRC013_brightness_onoff, fz.ZGRC013_brightness, fz.ZGRC013_brightness_stop,
fz.ZGRC013_cmdOn, fz.ZGRC013_cmdOff, fz.ZGRC013_scene,
],
toZigbee: [],
configure: (ieeeAddr, shepherd, coordinator, callback) => {
const device = shepherd.find(ieeeAddr, 1);
const cfg = {direction: 0, attrId: 0, dataType: 16, minRepIntval: 0, maxRepIntval: 1000, repChange: 0};
const actions = [
(cb) => device.bind('genOnOff', coordinator, cb),
(cb) => device.foundation('genOnOff', 'configReport', [cfg], foundationCfg, cb),
];

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

module.exports = devices.map((device) =>
Expand Down

0 comments on commit a8f55c9

Please sign in to comment.