From d779c199982bd4d4ee30396b555e3dfb29dd2cd6 Mon Sep 17 00:00:00 2001 From: abc Date: Wed, 31 May 2023 14:34:30 +0800 Subject: [PATCH 1/4] add acceleration --- src/converters/fromZigbee.js | 11 +++++++++++ src/devices/third_reality.js | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/converters/fromZigbee.js b/src/converters/fromZigbee.js index f0bcf8f87d5d1..88b5721f1d1d4 100644 --- a/src/converters/fromZigbee.js +++ b/src/converters/fromZigbee.js @@ -6067,6 +6067,17 @@ const converters = { } }, }, + thirdreality_acceleration: { + cluster: 'ssIasZone', + type: ['commandStatusChangeNotification', 'attributeReport', 'readResponse'], + convert: (model, msg, publish, options, meta) => { + const payload = {}; + if (msg.data['65280']) payload.x_axis = msg.data['65280']; + if (msg.data['65281']) payload.y_axis = msg.data['65281']; + if (msg.data['65282']) payload.z_axis = msg.data['65282']; + return payload; + }, + }, // #endregion // #region Ignore converters (these message dont need parsing). diff --git a/src/devices/third_reality.js b/src/devices/third_reality.js index 83894636cb00e..5c308b444903f 100644 --- a/src/devices/third_reality.js +++ b/src/devices/third_reality.js @@ -197,10 +197,10 @@ module.exports = [ model: '3RVS01031Z', vendor: 'Third Reality', description: 'Zigbee vibration sensor', - fromZigbee: [fz.ias_vibration_alarm_1, fz.battery], + fromZigbee: [fz.ias_vibration_alarm_1, fz.battery, fz.thirdreality_acceleration], toZigbee: [], ota: ota.zigbeeOTA, - exposes: [e.vibration(), e.battery_low(), e.battery(), e.battery_voltage()], + exposes: [e.vibration(), e.battery_low(), e.battery(), e.battery_voltage(), e.x_axis(), e.y_axis(), e.z_axis()], configure: async (device, coordinatorEndpoint, logger) => { const endpoint = device.getEndpoint(1); await endpoint.read('genPowerCfg', ['batteryPercentageRemaining']); From 6844a50948a9c879511e15f32201e83e5d0ee833 Mon Sep 17 00:00:00 2001 From: abc Date: Wed, 31 May 2023 14:54:31 +0800 Subject: [PATCH 2/4] add acceleration --- src/converters/fromZigbee.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/converters/fromZigbee.js b/src/converters/fromZigbee.js index 88b5721f1d1d4..891a3a0bb254f 100644 --- a/src/converters/fromZigbee.js +++ b/src/converters/fromZigbee.js @@ -6068,8 +6068,8 @@ const converters = { }, }, thirdreality_acceleration: { - cluster: 'ssIasZone', - type: ['commandStatusChangeNotification', 'attributeReport', 'readResponse'], + cluster: 'seMetering', + type: ['attributeReport', 'readResponse'], convert: (model, msg, publish, options, meta) => { const payload = {}; if (msg.data['65280']) payload.x_axis = msg.data['65280']; From 33a6c172c9c7ef218e25e451652d61c1ca4a4cee Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Wed, 31 May 2023 09:46:46 +0200 Subject: [PATCH 3/4] Update third_reality.js --- src/devices/third_reality.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/devices/third_reality.js b/src/devices/third_reality.js index 5c308b444903f..91073c657b5f0 100644 --- a/src/devices/third_reality.js +++ b/src/devices/third_reality.js @@ -6,6 +6,20 @@ const extend = require('../lib/extend'); const ota = require('../lib/ota'); const e = exposes.presets; +const fzLocal = { + thirdreality_acceleration: { + cluster: 'seMetering', + type: ['attributeReport', 'readResponse'], + convert: (model, msg, publish, options, meta) => { + const payload = {}; + if (msg.data['65280']) payload.x_axis = msg.data['65280']; + if (msg.data['65281']) payload.y_axis = msg.data['65281']; + if (msg.data['65282']) payload.z_axis = msg.data['65282']; + return payload; + }, + }, +}; + module.exports = [ { zigbeeModel: ['3RSS009Z'], @@ -197,7 +211,7 @@ module.exports = [ model: '3RVS01031Z', vendor: 'Third Reality', description: 'Zigbee vibration sensor', - fromZigbee: [fz.ias_vibration_alarm_1, fz.battery, fz.thirdreality_acceleration], + fromZigbee: [fz.ias_vibration_alarm_1, fz.battery, fzLocal.thirdreality_acceleration], toZigbee: [], ota: ota.zigbeeOTA, exposes: [e.vibration(), e.battery_low(), e.battery(), e.battery_voltage(), e.x_axis(), e.y_axis(), e.z_axis()], From f86d8bfe80ada0106de05a2dae7dbd7fb81359ee Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Wed, 31 May 2023 09:47:01 +0200 Subject: [PATCH 4/4] Update fromZigbee.js --- src/converters/fromZigbee.js | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/converters/fromZigbee.js b/src/converters/fromZigbee.js index 891a3a0bb254f..f0bcf8f87d5d1 100644 --- a/src/converters/fromZigbee.js +++ b/src/converters/fromZigbee.js @@ -6067,17 +6067,6 @@ const converters = { } }, }, - thirdreality_acceleration: { - cluster: 'seMetering', - type: ['attributeReport', 'readResponse'], - convert: (model, msg, publish, options, meta) => { - const payload = {}; - if (msg.data['65280']) payload.x_axis = msg.data['65280']; - if (msg.data['65281']) payload.y_axis = msg.data['65281']; - if (msg.data['65282']) payload.z_axis = msg.data['65282']; - return payload; - }, - }, // #endregion // #region Ignore converters (these message dont need parsing).