Skip to content

Commit

Permalink
Add device to support Trust Remote control ZYCT-202 (#300)
Browse files Browse the repository at this point in the history
* Add device to support Trust Remote control ZYCT-202

Koenkk/zigbee2mqtt#635

* Add the concerters for the Trust Remote control ZYCT-202

The groupid has been processed in the button press. So you have the action and the selector mode in 1 state value and can easily be used in a Home Assistant Automation state rule.

* Add the concerters for the Trust Remote control ZYCT-202

The groupid has been processed in the button press. So you have the action and the selector mode in 1 state value and can easily be used in a Home Assistant Automation state rule.

(Koenkk/zigbee2mqtt#635)

* Update devices.js

Fixed spaces line 1941

* Update devices.js

Fixed the maximum line length of 120  max-len

* Separated the action and groupid in the return rules

Have separated the action and groupid in the return rules...

* Update fromZigbee.js
  • Loading branch information
hwijers authored and Koenkk committed Feb 23, 2019
1 parent 0315f48 commit 9ebf35a
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
32 changes: 32 additions & 0 deletions converters/fromZigbee.js
Original file line number Diff line number Diff line change
Expand Up @@ -1801,6 +1801,38 @@ const converters = {
return {action: `${direction}`};
},
},
ZYCT202_on: {
cid: 'genOnOff',
type: 'cmdOn',
convert: (model, msg, publish, options) => {
return {action: 'on', action_group: msg.groupid};
},
},
ZYCT202_off: {
cid: 'genOnOff',
type: 'cmdOffWithEffect',
convert: (model, msg, publish, options) => {
return {action: 'off', action_group: msg.groupid};
},
},
ZYCT202_stop: {
cid: 'genLevelCtrl',
type: 'cmdStop',
convert: (model, msg, publish, options) => {
return {action: 'stop', action_group: msg.groupid};
},
},
ZYCT202_up_down: {
cid: 'genLevelCtrl',
type: 'cmdMove',
convert: (model, msg, publish, options) => {
const value = msg.data.data['movemode'];
let action = null;
if (value === 0) action = {'action': 'up-press', 'action_group': msg.groupid};
else if (value === 1) action = {'action': 'down-press', 'action_group': msg.groupid};
return action ? action : null;
},
},
cover_position: {
cid: 'genLevelCtrl',
type: 'devChange',
Expand Down
21 changes: 21 additions & 0 deletions devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -1975,6 +1975,27 @@ const devices = [
},

// Trust
{
zigbeeModel: ['\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000'+
'\u0000\u0000\u0000\u0000\u0000'],
model: 'ZYCT-202',
vendor: 'Trust',
description: 'Remote control',
supports: 'on, off, stop, up-press, down-press',
fromZigbee: [
fz.ZYCT202_on, fz.ZYCT202_off, fz.ZYCT202_stop, fz.ZYCT202_up_down,
],
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.foundation('genOnOff', 'configReport', [cfg], foundationCfg, cb),
];

execute(device, actions, callback);
},
},
{
zigbeeModel: ['ZLL-DimmableLigh'],
model: 'ZLED-2709',
Expand Down

0 comments on commit 9ebf35a

Please sign in to comment.