G

tuya-mmwave.js

public
Guest Feb 16, 2025 2 days 21
Clone
JavaScript tuya-mmwave.js 71 lines (69 loc) | 3.61 KB
1
const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
2
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
3
const exposes = require('zigbee-herdsman-converters/lib/exposes');
4
const tuya = require('zigbee-herdsman-converters/lib/tuya');
5
const e = exposes.presets;
6
const ea = exposes.access;
7
8
const definition = {
9
zigbeeModel: ['TS0225'],
10
fingerprint: tuya.fingerprint('TS0225', ['_TZE3210_eep3fewj']),
11
model: 'ZG-205Z/A',
12
vendor: 'Tuya',
13
description: '5.8Ghz/24Ghz Human presence sensor',
14
fromZigbee: [tuya.fz.datapoints],
15
toZigbee: [tuya.tz.datapoints],
16
configure: tuya.configureMagicPacket,
17
exposes: [
18
e.presence(),
19
e.illuminance().withUnit('lx'),
20
e.numeric('large_motion_detection_sensitivity', ea.STATE_SET)
21
.withValueMin(0).withValueMax(10).withValueStep(1).withUnit('x')
22
.withDescription('Motion detection sensitivity'),
23
e.numeric('large_motion_detection_distance', ea.STATE_SET)
24
.withValueMin(0).withValueMax(10).withValueStep(0.01).withUnit('m')
25
.withDescription('Motion detection distance'),
26
e.enum('motion_state', ea.STATE, ['none', 'small', 'medium', 'large', 'huge', 'gigantic'])
27
.withDescription('State of the motion'),
28
e.numeric('fading_time', ea.STATE_SET)
29
.withValueMin(0).withValueMax(28800).withValueStep(1).withUnit('s')
30
.withDescription('For how much time presence should stay true after detecting it'),
31
e.numeric('medium_motion_detection_distance', ea.STATE_SET)
32
.withValueMin(0).withValueMax(6).withValueStep(0.01).withUnit('m')
33
.withDescription('Medium motion detection distance'),
34
e.numeric('medium_motion_detection_sensitivity', ea.STATE_SET)
35
.withValueMin(0).withValueMax(10).withValueStep(1).withUnit('x')
36
.withDescription('Medium motion detection sensitivity'),
37
e.binary('indicator', ea.STATE_SET, 'ON', 'OFF')
38
.withDescription('LED Indicator'),
39
e.numeric('small_detection_distance', ea.STATE_SET)
40
.withValueMin(0).withValueMax(6).withValueStep(0.01).withUnit('m')
41
.withDescription('Small detection distance'),
42
e.numeric('small_detection_sensitivity', ea.STATE_SET)
43
.withValueMin(0).withValueMax(10).withValueStep(1).withUnit('x')
44
.withDescription('Small detection sensitivity'),
45
],
46
onEvent: tuya.onEventSetTime,
47
meta: {
48
tuyaDatapoints: [
49
[1, 'presence', tuya.valueConverter.trueFalse1],
50
[2, 'large_motion_detection_sensitivity', tuya.valueConverter.raw],
51
[4, 'large_motion_detection_distance', tuya.valueConverter.divideBy100],
52
[101, 'motion_state', tuya.valueConverterBasic.lookup({
53
none: tuya.enum(0),
54
large: tuya.enum(1),
55
medium: tuya.enum(2),
56
small: tuya.enum(3),
57
huge: tuya.enum(4),
58
gigantic: tuya.enum(5),
59
})],
60
[102, 'fading_time', tuya.valueConverter.raw],
61
[104, 'medium_motion_detection_distance', tuya.valueConverter.divideBy100],
62
[105, 'medium_motion_detection_sensitivity', tuya.valueConverter.raw],
63
[106, 'illuminance', tuya.valueConverter.raw],
64
[107, 'indicator', tuya.valueConverter.onOff],
65
[108, 'small_detection_distance', tuya.valueConverter.divideBy100],
66
[109, 'small_detection_sensitivity', tuya.valueConverter.raw],
67
],
68
},
69
};
70
71
module.exports = definition;