Skip to content

Commit

Permalink
Fix OSRAM mini switch broadcast and improve integration. Koenkk/zigbe…
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenkk committed May 14, 2019
1 parent 46e287c commit 7756df8
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 25 deletions.
41 changes: 27 additions & 14 deletions converters/fromZigbee.js
Original file line number Diff line number Diff line change
Expand Up @@ -2302,52 +2302,65 @@ const converters = {
return {pressure: precisionRoundOptions(pressure, options, 'pressure')};
},
},
AC0251100NJ_on: {
AC0251100NJ_cmdOn: {
cid: 'genOnOff',
type: 'cmdOn',
convert: (model, msg, publish, options) => {
return {action: 'up'};
},
},
AC0251100NJ_off: {
AC0251100NJ_cmdOff: {
cid: 'genOnOff',
type: 'cmdOff',
convert: (model, msg, publish, options) => {
return {action: 'down'};
},
},
AC0251100NJ_on_hold: {
AC0251100NJ_cmdMoveWithOnOff: {
cid: 'genLevelCtrl',
type: 'cmdMoveWithOnOff',
convert: (model, msg, publish, options) => {
return {action: 'on_hold'};
return {action: 'up_hold'};
},
},
AC0251100NJ_off_hold: {
AC0251100NJ_cmdStop: {
cid: 'genLevelCtrl',
type: 'cmdMove',
type: 'cmdStop',
convert: (model, msg, publish, options) => {
return {action: 'off_hold'};
const map = {
1: 'up_release',
2: 'down_release',
};

return {action: map[msg.endpoints[0].epId]};
},
},
AC0251100NJ_release: {
AC0251100NJ_cmdMove: {
cid: 'genLevelCtrl',
type: 'cmdMoveToLevelWithOnOff',
type: 'cmdMove',
convert: (model, msg, publish, options) => {
return {action: 'circle_press'};
return {action: 'down_hold'};
},
},

AC0251100NJ_circle_release: {
AC0251100NJ_cmdMoveHue: {
cid: 'lightingColorCtrl',
type: 'cmdMoveHue',
convert: (model, msg, publish, options) => {
return {action: 'circle_hold'};
if (msg.data.data.movemode === 0) {
return {action: 'circle_release'};
}
},
},
AC0251100NJ_circle: {
AC0251100NJ_cmdMoveToSaturation: {
cid: 'lightingColorCtrl',
type: 'cmdMoveToSaturation',
convert: (model, msg, publish, options) => {
return {action: 'circle_hold'};
},
},
AC0251100NJ_cmdMoveToColorTemp: {
cid: 'lightingColorCtrl',
type: 'cmdMoveToColorTemp',
convert: (model, msg, publish, options) => {
return {action: 'circle_click'};
},
Expand Down
28 changes: 17 additions & 11 deletions devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -1330,23 +1330,29 @@ const devices = [
model: 'AC0251100NJ',
vendor: 'OSRAM',
description: 'Smart+ switch mini',
supports: 'on/off, brightness',
supports: 'circle, up, down and hold/release',
fromZigbee: [
fz.AC0251100NJ_on, fz.AC0251100NJ_off, fz.AC0251100NJ_on_hold, fz.AC0251100NJ_off_hold,
fz.AC0251100NJ_release, fz.AC0251100NJ_circle, fz.AC0251100NJ_circle_release,
fz.generic_batteryvoltage_3000_2500,
fz.AC0251100NJ_cmdOn, fz.AC0251100NJ_cmdMoveWithOnOff, fz.AC0251100NJ_cmdStop,
fz.AC0251100NJ_cmdMoveToColorTemp, fz.AC0251100NJ_cmdMoveHue, fz.AC0251100NJ_cmdMoveToSaturation,
fz.AC0251100NJ_cmdOff, fz.AC0251100NJ_cmdMove, fz.generic_batteryvoltage_3000_2500,
],
toZigbee: [],
configure: (ieeeAddr, shepherd, coordinator, callback) => {
const device = shepherd.find(ieeeAddr, 1);
const groupid = 1801;
const ep1 = shepherd.find(ieeeAddr, 1);
const ep2 = shepherd.find(ieeeAddr, 2);
const ep3 = shepherd.find(ieeeAddr, 3);

const actions = [
(cb) => device.bind('genOnOff', coordinator, cb),
(cb) => device.bind('lightingColorCtrl', coordinator, cb),
(cb) => device.bind('genLevelCtrl', coordinator, cb),
(cb) => device.bind('genPowerCfg', coordinator, cb),
(cb) => device.report('genPowerCfg', 'batteryVoltage', 900, 3600, 0, cb),
(cb) => ep1.bind('genOnOff', coordinator, cb),
(cb) => ep1.bind('genLevelCtrl', coordinator, cb),
(cb) => ep2.bind('genOnOff', coordinator, cb),
(cb) => ep2.bind('genLevelCtrl', coordinator, cb),
(cb) => ep3.bind('lightingColorCtrl', coordinator, cb),
(cb) => ep1.bind('genPowerCfg', groupid, cb),
(cb) => ep1.report('genPowerCfg', 'batteryVoltage', 900, 3600, 0, cb),
];
execute(device, actions, callback);
execute(ep1, actions, callback);
},

},
Expand Down

0 comments on commit 7756df8

Please sign in to comment.