Skip to content

Instantly share code, notes, and snippets.

@vivalton
Last active May 9, 2024 13:57
Show Gist options
  • Save vivalton/72c27fe5d30e0d635c8a4a0762219d68 to your computer and use it in GitHub Desktop.
Save vivalton/72c27fe5d30e0d635c8a4a0762219d68 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 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_s1xgth2u'}
],
model: 'TS0601_temperature_humidity_sensor',
vendor: 'TuYa',
description: 'Temperature & humidity sensor (2)',
fromZigbee: [tuya.fz.datapoints],
//configure: tuya.configureMagicPacket,
configure: async (device, coordinatorEndpoint) => {
await tuya.configureMagicPacket(device, coordinatorEndpoint);
// Required to get the device to start reporting (-- Maybe needed? Copied this from another humidity sensor configuration)
await device.getEndpoint(1).command('manuSpecificTuya', 'dataQuery', {});
},
toZigbee: [],
onEvent: tuya.onEventSetLocalTime,
exposes: (device, options) => {
const exps = [e.temperature(), e.humidity(), e.battery(), tuya.exposes.temperatureUnit()];
exps.push(e.linkquality());
return exps;
},
meta: {
tuyaDatapoints: [
[1, 'temperature', tuya.valueConverter.divideBy10],
[2, 'humidity', tuya.valueConverter.raw],
[4, 'battery', tuya.valueConverter.raw], // maybe?
[9, 'temperature_unit', tuya.valueConverter.temperatureUnitEnum], // maybe?
[19, 'temperature_sensitivity', tuya.valueConverter.raw], // maybe?
],
},
};
module.exports = definition;
/*
[2024-05-09 13:28:09] debug: z2m: Received Zigbee message from '0xa4c138deb4bbcb8a', type 'commandDataResponse', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0],"type":"Buffer"},"datatype":4,"dp":9}],"seq":48129}' from endpoint 1 with groupID 0
[2024-05-09 13:22:58] debug: z2m: Received Zigbee message from '0xa4c138deb4bbcb8a', type 'commandDataResponse', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,1,94],"type":"Buffer"},"datatype":2,"dp":10}],"seq":44801}' from endpoint 1 with groupID 0
[2024-05-09 13:22:58] debug: z2m: Received Zigbee message from '0xa4c138deb4bbcb8a', type 'commandDataResponse', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,0],"type":"Buffer"},"datatype":2,"dp":11}],"seq":45057}' from endpoint 1 with groupID 0
[2024-05-09 13:22:58] debug: z2m: Received Zigbee message from '0xa4c138deb4bbcb8a', type 'commandDataResponse', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,6],"type":"Buffer"},"datatype":2,"dp":19}],"seq":45313}' from endpoint 1 with groupID 0
[2024-05-09 13:22:58] debug: z2m: Received Zigbee message from '0xa4c138deb4bbcb8a', type 'commandDataResponse', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,88],"type":"Buffer"},"datatype":2,"dp":4}],"seq":45569}' from endpoint 1 with groupID 0
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment