Skip to content

Instantly share code, notes, and snippets.

@sakulisko
Forked from Koenkk/ext.js
Last active July 9, 2023 00:23
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 sakulisko/d6c21dacf1f0e5ed303901519b3abeb4 to your computer and use it in GitHub Desktop.
Save sakulisko/d6c21dacf1f0e5ed303901519b3abeb4 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_qyflbnbj'},
{modelID: 'TS0601', manufacturerName: '_TZE200_cirvgep4'},
{modelID: 'TS0601', manufacturerName: '_TZE200_9yapgbuv'},
{modelID: 'TS0601', manufacturerName: '_TZE200_zl1kmjqx'}
],
model: 'TS0601_temperature_humidity_sensor',
vendor: 'TuYa',
description: 'Temperature & humidity sensor',
fromZigbee: [tuya.fz.datapoints],
configure: tuya.configureMagicPacket,
toZigbee: [],
onEvent: tuya.onEventSetLocalTime,
exposes: (device, options) => {
const exps = [e.temperature(), e.humidity(), 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'));
}
exps.push(e.linkquality());
return exps;
},
meta: {
tuyaDatapoints: [
[2, 'humidity', tuya.valueConverter.raw],
[1, 'temperature', tuya.valueConverter.divideBy10],
],
},
};
module.exports = definition;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment