Skip to content

Instantly share code, notes, and snippets.

@Koenkk

Koenkk/ext.js Secret

Created November 14, 2023 20:17
Show Gist options
  • Save Koenkk/43579e5e8d06e84f2af77dfa3b2196a7 to your computer and use it in GitHub Desktop.
Save Koenkk/43579e5e8d06e84f2af77dfa3b2196a7 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 legacy = require('zigbee-herdsman-converters/lib/legacy');
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', ['_TZE200_yjjdcqsq', '_TZE200_9yapgbuv', '_TZE204_upagmta9', '_TZE200_cirvgep4', '_TZE200_upagmta9']),
model: 'TS0601_temperature_humidity_sensor_2',
vendor: 'TuYa',
description: 'Temperature and humidity sensor',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
onEvent: tuya.onEvent({queryOnDeviceAnnounce: true}),
configure: async (device, coordinatorEndpoint, logger) => {
await tuya.configureMagicPacket(device, coordinatorEndpoint, logger);
await device.getEndpoint(1).command('manuSpecificTuya', 'dataQuery', {});
},
exposes: [e.temperature(), e.humidity(), tuya.exposes.batteryState(), tuya.exposes.temperatureUnit()],
meta: {
tuyaDatapoints: [
[1, 'temperature', tuya.valueConverter.divideBy10],
[2, 'humidity', tuya.valueConverter.raw],
[3, 'battery_state', tuya.valueConverter.batteryState],
[9, 'temperature_unit', tuya.valueConverter.temperatureUnitEnum],
],
},
whiteLabel: [
tuya.whitelabel('TuYa', 'ZTH01', 'Temperature and humidity sensor', ['_TZE200_yjjdcqsq']),
tuya.whitelabel('TuYa', 'ZTH02', 'Temperature and humidity sensor', ['_TZE200_9yapgbuv']),
tuya.whitelabel('TuYa', 'ZTH05', 'Temperature and humidity sensor', ['_TZE204_upagmta9', '_TZE200_upagmta9']),
tuya.whitelabel('TuYa', 'ZTH08-E', 'Temperature and humidity sensor', ['_TZE200_cirvgep4']),
],
};
module.exports = definition;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment