[External Converter]: TS0601 from _TZE284_kwi6bbk4
Link
https://de.aliexpress.com/item/1005010493675411.html
Database entry
{"id":25,"type":"EndDevice","ieeeAddr":"0xa4c138607e2401f5","nwkAddr":6021,"manufId":4417,"manufName":"_TZE284_kwi6bbk4","powerSource":"Battery","modelId":"TS0601","epList":[1],"endpoints":{"1":{"profId":260,"epId":1,"devId":81,"inClusterList":[4,5,61184,0,60672],"outClusterList":[25,10],"clusters":{"genBasic":{"attributes":{"65487":14400,"65503":""kV1\u0019"kV1\u0007\u0000\u0000\u0000\u0000\u0011","65506":56,"65508":1,"65534":0,"stackVersion":0,"dateCode":"","appVersion":80,"manufacturerName":"_TZE284_kwi6bbk4","zclVersion":3,"modelId":"TS0601","powerSource":3,"hwVersion":1}}},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":80,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"interviewState":"SUCCESSFUL","meta":{"configured":"0.0.0"},"lastSeen":1774428436870}
Zigbee2MQTT version
2.9.1 (unknown)
External converter
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const e = require('zigbee-herdsman-converters/lib/exposes').presets;
const fs = require('fs');
const path = require('path');
const LOG_DIR = '/homeassistant/zigbee2mqtt/log_custom';
const LOG_BASE = 'tuya_debug';
// Hilfsfunktion: aktuelles Datum im Dateinamen
function getLogFileName() {
const now = new Date();
const dateStr = now.toISOString().split('T')[0]; // YYYY-MM-DD
return path.join(LOG_DIR, `${LOG_BASE}.log`);
}
// Funktion, die deine Logzeile schreibt (beliebig erweiterbar)
function logLine(str) {
const line = `${new Date().toISOString()} ${str}\n`;
fs.appendFileSync(getLogFileName(), line, { encoding: 'utf8' });
}
const fzLocal = {
outdoor_sensor: {
cluster: 'genBasic',
type: ['attributeReport', 'readResponse'],
convert: (model, msg, publish, options, meta) => {
const data = msg.data;
if (data['65503'] !== undefined) {
const raw = Buffer.from(data['65503'], 'binary');
const hex = [...raw].map(b => b.toString(16).padStart(2,'0')).join(' ');
const vals = [...raw].map((b, i) => 'b'+i+'='+b).join(' ');
// Log‑Zeile mit Zeit, Len, Hex, Vals
const logContent = `Len=${raw.length} Hex=${hex} Vals=${vals}`;
logLine('TuyaZeit=' + new Date().toISOString() + ' ' + logContent);
if (raw[2] === 79 && raw[3] === 49) {
const humidity = raw[0];
const temperature = raw[0] - raw[1] / 10;
const tempRounded = Math.round(temperature * 10) / 10;
const bat = raw[4];
// TuyaCalc in die Log‑Datei
logLine(`TuyaCalc: temp=${tempRounded} hum=${humidity} bat=${bat}`);
// falls du trotzdem im Zigbee2MQTT‑Log sehen willst:
console.log(`TuyaCalc: temp=${tempRounded} hum=${humidity} bat=${bat}`);
return {
temperature: tempRounded,
humidity: humidity,
battery: bat,
};
}
}
return null;
},
},
};
module.exports = [
{
fingerprint: tuya.fingerprint('TS0601', ['_TZE284_kwi6bbk4']),
model: 'TS0601_kwi6bbk4',
vendor: 'Tuya',
description: 'Outdoor Temperature & Humidity Sensor (ZTH13)',
fromZigbee: [fzLocal.outdoor_sensor],
toZigbee: [],
exposes: [e.temperature(), e.humidity(), e.battery()],
},
];
What does/doesn't work with the external definition?
Outdoor Temperature & Humidity Sensor (ZTH13) (Tuya) Have started to make an converter, but it did not work properly. Maybe someone kann help? i think the sensor delivers every 15 minutes new values.
Notes
software_build_id: undefined
date_code: ``
endpoints:
{"1":{"clusters":{"input":["genGroups","genScenes","manuSpecificTuya","genBasic","zosungIRTransmit"],"output":["genOta","genTime"]}}}
🙏 Thank you for creating this issue and sharing your external converter!
In case all features work, please submit a pull request on this repository so the device can be supported out-of-the-box with the next release. For instructions on how to create a pull request see the docs.
If NOT all features work, please follow the How To Support new devices. Since this is a Tuya also consider How To Support new Tuya devices.
If you need help with the process, feel free to ask here and we'll be happy to assist.
Shorter Code without Logging.
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const e = require('zigbee-herdsman-converters/lib/exposes').presets;
const fzLocal = {
outdoor_sensor: {
cluster: 'genBasic',
type: ['attributeReport', 'readResponse'],
convert: (model, msg, publish, options, meta) => {
const data = msg.data;
if (data['65503'] !== undefined) {
const raw = Buffer.from(data['65503'], 'binary');
const now = new Date().toISOString();
const hex = [...raw].map(b => b.toString(16).padStart(2,'0')).join(' ');
const dec = [...raw].map(b => b.toString().padStart(3,' ')).join(' ');
console.log('TuyaZeit=' + now + ' Len=' + raw.length);
console.log('TuyaHex=' + hex);
console.log('TuyaDez=' + dec);
// Alle möglichen Int16 Kombinationen
for (let i = 0; i <= raw.length - 2; i++) {
const le = raw.readInt16LE(i);
const be = raw.readInt16BE(i);
console.log('TuyaPos' + i + '= LE:' + le + ' BE:' + be + ' /10LE:' + (le/10).toFixed(1) + ' /10BE:' + (be/10).toFixed(1));
}
}
},
},
};
module.exports = [
{
fingerprint: tuya.fingerprint('TS0601', ['_TZE284_kwi6bbk4']),
model: 'TS0601_kwi6bbk4',
vendor: 'Tuya',
description: 'Outdoor Temperature & Humidity Sensor (ZTH13)',
fromZigbee: [fzLocal.outdoor_sensor],
toZigbee: [],
exposes: [e.temperature(), e.humidity(), e.battery()],
},
];
Hi @matrizze, I'm on this topic also, I'm using ZHA. Already tried different formulas, still collecting values, but no luck so far. Do you have any updates?
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days