Skip to content

Instantly share code, notes, and snippets.

@Koenkk
Last active January 8, 2023 07:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Koenkk/6878634d9cd8ba56d00e19d4938ae7c1 to your computer and use it in GitHub Desktop.
Save Koenkk/6878634d9cd8ba56d00e19d4938ae7c1 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: [{modelID: 'TS0601', manufacturerName: '_TZE200_bq5c8xfe'},
{modelID: 'TS0601', manufacturerName: '_TZE200_bjawzodf'},
{modelID: 'TS0601', manufacturerName: '_TZE200_9yapgbuv'},
{modelID: 'TS0601', manufacturerName: '_TZE200_qyflbnbj'}],
model: 'TS0601_temperature_humidity_sensor',
vendor: 'TuYa',
description: 'Temperature & humidity sensor',
fromZigbee: [fz.tuya_temperature_humidity_sensor],
toZigbee: [],
configure: tuya.configureMagicPacket,
exposes: (device, options) => {
const exps = [e.temperature(), e.humidity(), e.linkquality()];
if (device.manufacturerName === '_TZE200_9yapgbuv') {
exps.push(e.battery_low());
exps.push(exposes.enum('battery_level', ea.STATE, ['low', 'middle', 'high']).withDescription('Battery level state'));
} else {
exps.push(e.battery());
}
if (!device || device.manufacturerName === '_TZE200_qyflbnbj') {
exps.push(e.battery_low());
exps.push(exposes.enum('battery_level', ea.STATE, ['low', 'middle', 'high']).withDescription('Battery level state'));
}
return exps;
},
};
module.exports = definition;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment