Skip to content

Instantly share code, notes, and snippets.

@rpearl
Last active July 31, 2023 17:57
Show Gist options
  • Save rpearl/553184b310b8aa50d7e37f6a000fac51 to your computer and use it in GitHub Desktop.
Save rpearl/553184b310b8aa50d7e37f6a000fac51 to your computer and use it in GitHub Desktop.
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 utils = require('zigbee-herdsman-converters/lib/utils');
const globalStore = require('zigbee-herdsman-converters/lib/store');
const e = exposes.presets;
const ea = exposes.access;
const definition = {
fingerprint: tuya.fingerprint('TS0601', ['_TZE204_qasjif9e']),
model: 'ZY-M100-S',
vendor: 'TuYa',
description: 'Mini Human Breathe Sensor',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
exposes: [
e.illuminance_lux(), e.presence(),
e.numeric('target_distance', ea.STATE).withDescription('Distance to target').withUnit('m'),
e.numeric('radar_sensitivity', ea.STATE_SET).withValueMin(0).withValueMax(9).withValueStep(1)
.withDescription('sensitivity of the radar'),
e.numeric('minimum_range', ea.STATE_SET).withValueMin(0).withValueMax(9.5).withValueStep(0.15)
.withDescription('Minimum range').withUnit('m'),
e.numeric('maximum_range', ea.STATE_SET).withValueMin(0).withValueMax(9.5).withValueStep(0.15)
.withDescription('Maximum range').withUnit('m'),
e.numeric('detection_delay', ea.STATE_SET).withValueMin(0).withValueMax(10).withValueStep(0.1)
.withDescription('Detection delay').withUnit('s'),
e.numeric('fading_time', ea.STATE_SET).withValueMin(0.5).withValueMax(1500).withValueStep(1)
.withDescription('Fading time').withUnit('s'),
],
meta: {
tuyaDatapoints: [
[1, 'presence', tuya.valueConverter.trueFalse1],
[9, 'target_distance', tuya.valueConverter.divideBy100],
[104, 'illuminance_lux', tuya.valueConverter.raw],
[2, 'radar_sensitivity', tuya.valueConverter.raw],
[4, 'maximum_range', tuya.valueConverter.divideBy100],
[3, 'minimum_range', tuya.valueConverter.divideBy100],
[102, 'fading_time', tuya.valueConverter.divideBy10],
[101, 'detection_delay', tuya.valueConverter.divideBy10],
],
},
};
module.exports = definition;
@rpearl
Copy link
Author

rpearl commented Jul 31, 2023

NOTE: This device is now in the dev branch so you probably don't need this converter unless you want to stay on the stable branch.

You can switch to the dev branch by following these instructions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment