Open DERBESSE opened 4 months ago
Hello I have the same reference here the files I made
External definition
const fz = require('zigbee-herdsman-converters/converters/fromZigbee.js');
const tz = require('zigbee-herdsman-converters/converters/toZigbee.js');
const exposes = require('zigbee-herdsman-converters/lib/exposes.js');
const reporting = require('zigbee-herdsman-converters/lib/reporting.js');
const modernExtend = require('zigbee-herdsman-converters/lib/modernExtend.js');
const e = exposes.presets;
const ea = exposes.access;
const tuya = require('zigbee-herdsman-converters/lib/tuya.js');
const definition = {
fingerprint: [
{
modelID: 'TS0601',
manufacturerName: '_TZE200_ytryxh0a',
},
],
model: 'TS0601_thermostat',
vendor: 'Tuya',
description: 'Radiator valve with thermostat',
whiteLabel: [
{ vendor: 'Xanlite', model: 'KZTETHEAU' },
],
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
onEvent: tuya.onEventSetTime, // Add this if you are getting no converter for 'commandMcuSyncTime'
configure: tuya.configureMagicPacket,
exposes: [
e
.climate()
.withPreset(['auto', 'manual', 'holiday',])
.withLocalTemperature(ea.STATE)
.withSetpoint('current_heating_setpoint', 5, 30, 0.5, ea.STATE_SET)
.withLocalTemperatureCalibration(-9, 9, 0.1, ea.STATE_SET),
e.comfort_temperature().withValueMin(5).withValueMax(30),
e.eco_temperature().withValueMin(5).withValueMax(30),
e.holiday_temperature().withValueMin(0).withValueMax(30),
e.window_detection(),
e.open_window_temperature().withValueMin(5).withValueMax(25),
e.binary('boost_heating', ea.STATE_SET, 'ON', 'OFF'),
...tuya.exposes.scheduleAllDays(ea.STATE, 'HH:MM/C'),
e.child_lock(),
e.battery().withUnit('%'),
tuya.exposes.errorStatus(),
],
meta: {
tuyaDatapoints: [
[2, 'preset', tuya.valueConverterBasic.lookup({ auto: tuya.enum(0), manual: tuya.enum(1), holiday: tuya.enum(2), confort: tuya.enum(3) }), ],
[16, 'current_heating_setpoint', tuya.valueConverter.divideBy2],
[34, 'battery', tuya.valueConverter.batteryVoltToPercent],
[30, 'child_lock', tuya.valueConverter.lockUnlock],
[24, 'local_temperature', tuya.valueConverter.divideBy10],
[45, 'error_status', tuya.valueConverter.raw],
[101, 'comfort_temperature', tuya.valueConverter.divideBy2],
[102, 'eco_temperature', tuya.valueConverter.divideBy2],
[103, 'holiday_start_stop', tuya.valueConverter.thermostatHolidayStartStop],
[104, 'local_temperature_calibration', tuya.valueConverter.localTempCalibration1],
[105, 'holiday_temperature', tuya.valueConverter.divideBy2],
[106, 'boost_heating', tuya.valueConverter.onOff],
[107, 'window_detection', tuya.valueConverter.onOff],
[109, 'schedule_monday', tuya.valueConverter.thermostatScheduleDayMultiDP2],
[110, 'schedule_tuesday', tuya.valueConverter.thermostatScheduleDayMultiDP2],
[111, 'schedule_wednesday', tuya.valueConverter.thermostatScheduleDayMultiDP2],
[112, 'schedule_thursday', tuya.valueConverter.thermostatScheduleDayMultiDP2],
[113, 'schedule_friday', tuya.valueConverter.thermostatScheduleDayMultiDP2],
[114, 'schedule_saturday', tuya.valueConverter.thermostatScheduleDayMultiDP2],
[115, 'schedule_sunday', tuya.valueConverter.thermostatScheduleDayMultiDP2],
[116, 'open_window_temperature', tuya.valueConverter.divideBy2],
[117, 'open_window_time', tuya.valueConverter.raw],
[118, 'boost_time', tuya.valueConverter.countdown],
],
},
extend: [
// A preferred new way of extending functionality.
],
};
module.exports = definition;
But you need to modify 'zigbee-herdsman-converters/lib/tuya.js' with new réferences
batteryVoltToPercent: exports.valueConverterBasic.scale(0, 147, 0, 100),
divideBy2: exports.valueConverterBasic.divideBy(2),
And the next part is for the schedule but only to read them not to send it
// the _TZE200_ytryxh0a as 5 times zone and 5 min delay
// exemple message for schedule {"0":81,"1":28,"2":73,"3":44,"4":110,"5":32,"6":205,"7":106,"8":22,"9":98,"10":32,"11":106,"12":32,"13":98,"14":32,"15":106,"16":32,"17":34}
// the time is start to 0 00:00 to 255 21:15 and 0 for 21:20 and 32 for 24:00 but after 21:15 is adding 64 to the temperature
// the temperature is divided by 2 to have 0.5 resolution after 21:15 64 unit is added to the temperature
// "1" temp1 "2" time1 "3" temp2 "4" time2 ... "9" temp5 "10" time5
// all other data are unknown
thermostatScheduleDayMultiDP2: {
from: (v) => {
const schedule = [];
for (let index = 1; index < 11; index = index + 2) {
let time = v[index + 1];
let temp = v[index];
if (temp > 64){
time = time + 256;
temp = temp - 64;
}
temp = temp / 2;
const totalMinutes = time * 5;
const hours = totalMinutes / 60;
const rHours = Math.floor(hours);
const minutes = (hours - rHours) * 60;
const rMinutes = Math.round(minutes);
const strHours = rHours.toString().padStart(2, '0');
const strMinutes = rMinutes.toString().padStart(2, '0');
schedule.push(`${strHours}:${strMinutes}/${temp}`);
}
return schedule.join(' ');
},
to: (v) => {
// const payload = [0];
// const transitions = v.split(' ');
//if (transitions.length != 5) {
// throw new Error('Invalid schedule: there should be 5 transitions');
//}
//for (const transition of transitions) {
// const timeTemp = transition.split('/');
// if (timeTemp.length != 2) {
// throw new Error('Invalid schedule: wrong transition format: ' + transition);
// }
// const hourMin = timeTemp[0].split(':');
// const hour = parseInt(hourMin[0]);
// const min = parseInt(hourMin[1]);
// const temperature = Math.floor(parseFloat(timeTemp[1]) * 10);
// if (hour < 0 || hour > 24 || min < 0 || min > 60 || temperature < 50 || temperature > 300) {
// throw new Error('Invalid hour, minute or temperature of: ' + transition);
// }
//
// payload.push(hour, min, (temperature & 0xff00) >> 8, temperature & 0xff);
// }
// return payload;
},
},
Hello Mouni68 Thanks you ! Now, the devices is supported. But, please how to modify 'zigbee-herdsman-converters/lib/tuya.js' with new réferences ? Thanks for your help
I'm using Zigbee2mqtt in a docker (alpine) on a Unraid server, I have acces to the app/data directory so I execute in command ligne cp node_modules/zigbee-herdsman-converters/devices/tuya.js data/tuya.js
and the file is accessible to modify after I reverse the process with cp data/tuya.js node_modules/zigbee-herdsman-converters/lib/tuya.js
Don't forget to restart the docker
But is just for testing, I don't know how to add this to the next update, if someone can do it?
Could you make a pull request to add out-of-the-box support? This can be done by clicking here
Hello Mouni68
Thanks you !
Now, my devices are supported too,
But i have a trouble with the 'current_heating_setpoint
i cannot set a manual temperatur , only the presset mod working,
And off my m2qtt drawing i see the thermostat but it`s lonely ( for the signal ) ,
have you any idee maybe ?
Hello, since 5 day I'm trying to make it work, I bought 2 smart socket to cover more area. I have seen that the thermostat are very bad, low signal will broke all the thing you will send. I have 8 thermostat and sometime you need to turn the wheel to "wake up". When it's near the coordinator it's better, very bad antena inside. When you pair the device you need to see all the informations inside the stat tab, otherwise start pairing again.
Hello, I have the same thermostatic valves, and I tried to follow your procedures to integrate them into Z2M, without success. I managed to create the "external definition" but I'm not sure how to modify 'zigbee-herdsman-converters/lib/tuya.js' with new references. In which part of the file should I copy/paste these values?
The valve is a priori recognized without that, but like @aml57 I have the following error: "z2m: Publish 'set' 'current_heating_setpoint' to '0xa4c138cbe9115e11' failed: 'TypeError: Cannot read properties of undefined (reading 'to') '"
In France, these thermostatic valves are installed free of charge as part of a bonus. There is a good chance that the problem arises very often with these references, I hope that they will be integrated by default very soon. THANKS !
Hello, since 5 day I'm trying to make it work, I bought 2 smart socket to cover more area. I have seen that the thermostat are very bad, low signal will broke all the thing you will send. I have 8 thermostat and sometime you need to turn the wheel to "wake up". When it's near the coordinator it's better, very bad antena inside. When you pair the device you need to see all the informations inside the stat tab, otherwise start pairing again.
Have you made any progress on the subject? I tried things that didn't work... As indicated above, the equipment seems recognized after the modifications but modification of the set temperature remains impossible... THANKS
Sorry, too much time to make it work. Now that it's a little colder in France, I was able to test in a real situation, I'm getting back to the problem
When its close to my Sonoff Dongle-E Zigbee with NCP Firmware it's working but more away the set temperature does'nt work or you need to turn the wheel before to wake up... useless. I'm using Jeedom and I made a script that sends the information, checks and if it's not good sends it again up to 3 times. but despite this certain radiators do not take the new temperature.
I also took advantage of the government's free offer but its products are of poor quality. poor reception and above all half of the thermosats fell from the radiators due to defective adapter ring.
It's strange because with the original router, this one I have to place it in the middle of the living room, which is not practical, the instructions seem to work every time. with Z2M it's not all the time. I don't know how to solve this problem
Désolé, trop de temps pour le faire fonctionner. Maintenant qu'il fait un peu plus froid en France, j'ai pu tester en situation réelle, je reviens au problème
Quand il est proche de mon Sonoff Dongle-E Zigbee avec Firmware NCP ça fonctionne mais plus loin la température réglée ne fonctionne pas ou il faut tourner la molette avant de se réveiller... inutile. J'utilise Jeedom et j'ai fait un script qui envoie l'information, vérifiez et si ce n'est pas bon la renvoyer jusqu'à 3 fois. mais malgré cela certains radiateurs ne prennent pas la nouvelle température.
J'ai aussi profité de l'offre gratuite du gouvernement mais ses produits sont de mauvaise qualité. mauvaise réception et surtout la moitié des thermosats sont tombées des radiateurs à cause d'une bague d'adaptation défectueuse.
C'est étrange car avec le routeur d'origine, celui-ci je dois le placer au milieu du salon, ce qui n'est pas pratique, les instructions semblent fonctionner à chaque fois. avec Z2M ce n'est pas tout le temps. Je ne sais pas comment résoudre ce problème
bonjour, ou dois je mettre les modifications "batteryVoltToPercent: exports.valueConverterBasic.scale(0, 147, 0, 100), divideBy2: exports.valueConverterBasic.divideBy(2), " dans le fichier tuya.js ?
Si tu veux l'intégrer dans la prochaine mise a jour, envoie moi ton tuya.js et ton convertisseur externe et je vais les soumettre merci :)
Link
https://www.xanlite.com/fr/regulation-denergie/1779-product-3700619438993.html
Database entry
{"id":8,"type":"EndDevice","ieeeAddr":"0xa4c138c3459a0a60","nwkAddr":21209,"manufId":4417,"manufName":"_TZE200_ytryxh0a","powerSource":"Battery","modelId":"TS0601","epList":[1],"endpoints":{"1":{"profId":260,"epId":1,"devId":81,"inClusterList":[4,5,61184,0],"outClusterList":[25,10],"clusters":{"genBasic":{"attributes":{"stackVersion":0,"dateCode":""}}},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":67,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{},"lastSeen":1718565228534}
Comments
Hi, I purchased this device but could not register it in HA. it is showing up on Z2M but is showing as Unsupported. Thanks for your help
External definition