Last active
January 8, 2023 07:55
-
-
Save Koenkk/6878634d9cd8ba56d00e19d4938ae7c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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