-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathairqmon.js
48 lines (44 loc) · 1.79 KB
/
airqmon.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const {} = require('zigbee-herdsman-converters/lib/modernExtend');
// const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
//const extend = require('zigbee-herdsman-converters/lib/extend');
const ota = require('zigbee-herdsman-converters/lib/ota');
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const {} = require('zigbee-herdsman-converters/lib/tuya');
const utils = require('zigbee-herdsman-converters/lib/utils');
const globalStore = require('zigbee-herdsman-converters/lib/store');
const e = exposes.presets;
const ea = exposes.access;
const fz = {
airqmon_co2: {
cluster: 'genAnalogInput',
type: ['attributeReport', 'readResponse'],
convert: (model, msg, publish, options) => {
if (msg.endpoint.ID == 2 && msg.data['presentValue'] >= 400) {
return {co2: msg.data['presentValue']};
}
},
},
airqmon_temperature: {
cluster: 'genAnalogInput',
type: ['attributeReport', 'readResponse'],
convert: (model, msg, publish, options) => {
if (msg.endpoint.ID == 1) {
return {temperature: msg.data['presentValue']};
}
},
},
};
const definition = {
zigbeeModel: ['AirQMon'],
model: 'AirQMon',
vendor: 'SLS',
description: 'CO₂ sensor',
extend: [],
fromZigbee: [fz.airqmon_co2, fz.airqmon_temperature],// We will add this later
toZigbee: [], // Should be empty, unless device can be controlled (e.g. lights, switches).
exposes: [e.co2(), e.temperature(),],
};
module.exports = definition;