Skip to content

Commit

Permalink
SMSZB-120: add OTA and expose firmware version (#2750)
Browse files Browse the repository at this point in the history
Co-authored-by: Stigh <stigh@stigh-ubuntu-20.10>
  • Loading branch information
TheStigh and Stigh committed Jul 1, 2021
1 parent 8b0b910 commit dd3407c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
25 changes: 25 additions & 0 deletions converters/fromZigbee.js
Original file line number Diff line number Diff line change
Expand Up @@ -1441,6 +1441,20 @@ const converters = {
// #endregion

// #region Non-generic converters
ias_smoke_alarm_1_develco: {
cluster: 'ssIasZone',
type: 'commandStatusChangeNotification',
convert: (model, msg, publish, options, meta) => {
const zoneStatus = msg.data.zonestatus;
return {
smoke: (zoneStatus & 1) > 0,
battery_low: (zoneStatus & 1<<3) > 0,
supervision_reports: (zoneStatus & 1<<4) > 0,
restore_reports: (zoneStatus & 1<<5) > 0,
test: (zoneStatus & 1<<8) > 0,
};
},
},
command_on_presence: {
cluster: 'genOnOff',
type: 'commandOn',
Expand Down Expand Up @@ -6038,6 +6052,17 @@ const converters = {
return {action: `scene_${scenes[msg.data.level]}`};
},
},
smszb120_fw: {
cluster: 'genBasic',
type: ['attributeReport', 'readResponse'],
convert: (model, msg, publish, options, meta) => {
const result = {};
if (0x8000 in msg.data) {
result.current_firmware = msg.data[0x8000].join('.');
}
return result;
},
},
// #endregion

// #region Ignore converters (these message dont need parsing).
Expand Down
6 changes: 5 additions & 1 deletion devices/develco.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const fz = {...require('../converters/fromZigbee'), legacy: require('../lib/lega
const tz = require('../converters/toZigbee');
const constants = require('../lib/constants');
const reporting = require('../lib/reporting');
const ota = require('../lib/ota');
const e = exposes.presets;
const ea = exposes.access;

Expand Down Expand Up @@ -140,13 +141,16 @@ module.exports = [
model: 'SMSZB-120',
vendor: 'Develco',
description: 'Smoke detector with siren',
fromZigbee: [fz.temperature, fz.battery, fz.ias_smoke_alarm_1, fz.ignore_basic_report, fz.ignore_genOta],
fromZigbee: [fz.temperature, fz.battery, fz.ias_smoke_alarm_1_develco, fz.ignore_basic_report, fz.smszb120_fw],
toZigbee: [tz.warning],
ota: ota.zigbeeOTA,
meta: {battery: {voltageToPercentage: '3V_2100'}},
configure: async (device, coordinatorEndpoint, logger) => {
const options = {manufacturerCode: 4117};
const endpoint = device.getEndpoint(35);
await reporting.bind(endpoint, coordinatorEndpoint, ['genPowerCfg', 'ssIasZone', 'genBasic']);
await reporting.batteryVoltage(endpoint);
await endpoint.read('genBasic', [0x8000], options);
const endpoint2 = device.getEndpoint(38);
await reporting.bind(endpoint2, coordinatorEndpoint, ['msTemperatureMeasurement']);
await reporting.temperature(endpoint2, {min: constants.repInterval.MINUTE, max: constants.repInterval.MINUTES_10, change: 10});
Expand Down

0 comments on commit dd3407c

Please sign in to comment.