Skip to content

Commit

Permalink
feat: Expose x_axis, y_axis and z_axis for Third Reality 3RVS01…
Browse files Browse the repository at this point in the history
…031Z (#5822)

* add acceleration

* add acceleration

* Update third_reality.js

* Update fromZigbee.js

---------

Co-authored-by: abc <abc@qq.com>
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
  • Loading branch information
3 people authored May 31, 2023
1 parent 5ac0a39 commit 54218df
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/devices/third_reality.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down Expand Up @@ -197,10 +211,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, fzLocal.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']);
Expand Down

0 comments on commit 54218df

Please sign in to comment.