Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial OSRAM Smart+ Motion Sensor support #153

Merged
merged 7 commits into from
Dec 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions converters/fromZigbee.js
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,32 @@ const converters = {
};
},
},
ias_zone_motion_dev_change: {
cid: 'ssIasZone',
type: 'devChange',
convert: (model, msg, publish, options) => {
if (msg.data.data.zoneType === 0x000D) { // type 0x000D = motion sensor
const zoneStatus = msg.data.data.zoneStatus;
return {
occupancy: (zoneStatus & 1<<1) > 0, // Bit 1 = Alarm 2: Presence Indication
tamper: (zoneStatus & 1<<2) > 0, // Bit 2 = Tamper status
battery_low: (zoneStatus & 1<<3) > 0, // Bit 3 = Battery LOW indicator (trips around 2.4V)
};
}
},
},
ias_zone_motion_status_change: {
cid: 'ssIasZone',
type: 'statusChange',
convert: (model, msg, publish, options) => {
const zoneStatus = msg.data.zoneStatus;
return {
occupancy: (zoneStatus & 1<<1) > 0, // Bit 1 = Alarm 2: Presence Indication
tamper: (zoneStatus & 1<<2) > 0, // Bit 2 = Tamper status
battery_low: (zoneStatus & 1<<3) > 0, // Bit 3 = Battery LOW indicator (trips around 2.4V)
};
},
},

// Ignore converters (these message dont need parsing).
ignore_doorlock_change: {
Expand Down
24 changes: 24 additions & 0 deletions devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,30 @@ const devices = [
fromZigbee: generic.light_onoff_brightness().fromZigbee,
toZigbee: generic.light_onoff_brightness().toZigbee,
},
{
zigbeeModel: ['Motion Sensor-A'],
model: 'AC01353010G',
vendor: 'OSRAM',
description: 'SMART+ Motion Sensor',
supports: 'occupancy and temperature',
fromZigbee: [
fz.generic_temperature, fz.ignore_temperature_change, fz.ias_zone_motion_dev_change,
fz.ias_zone_motion_status_change,
],
toZigbee: [],
configure: (ieeeAddr, shepherd, coordinator, callback) => {
const device = shepherd.find(ieeeAddr, 1);
const actions = [
(cb) => device.write('ssIasZone', 'iasCieAddr', coordinator.device.getIeeeAddr(), cb),
(cb) => device.functional('ssIasZone', 'enrollRsp', {enrollrspcode: 0, zoneid: 23}, cb),
(cb) => device.bind('msTemperatureMeasurement', coordinator, cb),
(cb) => device.report('msTemperatureMeasurement', 'measuredValue', 30, 600, 1, cb),
(cb) => device.bind('genPowerCfg', coordinator, cb),
(cb) => device.report('genPowerCfg', 'batteryPercentageRemaining', 0, 1000, 0, cb),
];
execute(device, actions, callback);
},
},

// Hive
{
Expand Down