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 modernExtend = require('zigbee-herdsman-converters/lib/modernExtend'); const e = exposes.presets; const ea = exposes.access; const tuya = require('zigbee-herdsman-converters/lib/tuya'); const definition = { // Since a lot of Tuya devices use the same modelID, but use different datapoints // it's necessary to provide a fingerprint instead of a zigbeeModel fingerprint: [ { // The model ID from: Device with modelID 'TS0601' is not supported // You may need to add \u0000 at the end of the name in some cases modelID: 'TS0601', // The manufacturer name from: Device with modelID 'TS0601' is not supported. manufacturerName: '_TZE284_xnbkhhdr', }, ], model: 'ZWT198', vendor: 'Tuya', icon: '/var/www/html/plugins/z2m/data/img/ZWT198.jpg', description: 'Central Heating Thermostat', fromZigbee: [tuya.fz.datapoints], toZigbee: [tuya.tz.datapoints], onEvent: tuya.onEventSetLocalTime, //configure: tuya.configureMagicPacket, exposes: [ e.binary("factory_reset", ea.STATE_SET, "ON", "OFF").withDescription("Full factory reset, use with caution!"), e.child_lock(), e.temperature_sensor_select(["internal", "external", "both"]), e .climate() .withSystemMode(["off", "heat"], ea.STATE_SET) .withPreset(["manual", "auto", "temporary_manual"]) .withSetpoint("current_heating_setpoint", 5, 35, 0.5, ea.STATE_SET) .withRunningState(["idle", "heat"], ea.STATE) .withLocalTemperature(ea.STATE) .withLocalTemperatureCalibration(-9.9, 9.9, 0.1, ea.STATE_SET), e.binary("frost_protection", ea.STATE_SET, "ON", "OFF").withDescription("Antifreeze function"), e .max_temperature_limit() .withUnit("°C") .withValueMin(15) .withValueMax(35) .withValueStep(0.5) .withPreset("default", 20, "Default value") .withDescription("Maximum upper temperature"), e .numeric("deadzone_temperature", ea.STATE_SET) .withUnit("°C") .withValueMax(10) .withValueMin(0.1) .withValueStep(0.1) .withPreset("default", 1, "Default value") .withDescription("The delta between local_temperature (5 { // https://github.com/Koenkk/zigbee2mqtt/issues/21353#issuecomment-1938328429 // https://github.com/Koenkk/zigbee2mqtt/issues/28035 /*if (device.manufacturerName === "_TZE204_lzriup1j" || device.manufacturerName === "_TZE204_gops3slb") { return { auto: tuya.enum(1), manual: tuya.enum(0), temporary_manual: tuya.enum(2), }; }*/ return { auto: tuya.enum(0), manual: tuya.enum(1), temporary_manual: tuya.enum(2), }; }), ], [9, "child_lock", tuya.valueConverter.lockUnlock], [11, "faultalarm", tuya.valueConverter.raw], [14, "running_state", tuya.valueConverter.onOff], [15, "max_temperature_limit", tuya.valueConverter.divideBy10], [19, "local_temperature_calibration", tuya.valueConverter.localTempCalibration3], [ 101, "running_state", tuya.valueConverterBasic.lookup({ heat: tuya.enum(1), idle: tuya.enum(0), }), ], [102, "frost_protection", tuya.valueConverter.onOff], [103, "factory_reset", tuya.valueConverter.onOff], [ 104, "working_day", tuya.valueConverterBasic.lookup((_, device) => { // https://github.com/Koenkk/zigbee2mqtt/issues/23979 if (device.manufacturerName === "_TZE200_viy9ihs7") { return { disabled: tuya.enum(0), "6-1": tuya.enum(1), "5-2": tuya.enum(2), "7": tuya.enum(3), }; } return { disabled: tuya.enum(0), "6-1": tuya.enum(2), "5-2": tuya.enum(1), "7": tuya.enum(3), }; }), ], [ 106, "sensor", tuya.valueConverterBasic.lookup({ internal: tuya.enum(0), external: tuya.enum(1), both: tuya.enum(2), }), ], [107, "deadzone_temperature", tuya.valueConverter.divideBy10], [109, null, tuya.valueConverter.ZWT198_schedule], [109, "schedule_weekday", tuya.valueConverter.ZWT198_schedule], [109, "schedule_holiday", tuya.valueConverter.ZWT198_schedule], [110, "backlight_mode", tuya.valueConverter.backlightModeOffLowMediumHigh], // ============== found but not functional datapoints: // [16, 'min_temperature_limit', tuya.valueConverter.divideBy10], // datapoint listed in Tuya, but no communication from device // [105, 'dp105', tuya.valueConverter.onOff], // not listed in Tuya, but device sends datapoint // [111, 'dp111', tuya.valueConverter.onOff], // not listed in Tuya, but device sends datapoint // These are the schedule values in bytes, 8 periods in total (4 bytes per period). // For each period: // 1st byte: hour // 2nd byte: minute // 3rd, 4th bytes: temperature multiplied by 10 // On the device last 2 periods are ignored if schedule_mode is 7day. When schedule_mode is disabled, // scheduling can't be configured at all on the device. // For example, if schedule_mode is weekday/sat+sun and this byte array is received: // [6,10,1,144,8,10,0,170,11,40,0,170,12,40,0,170,17,10,0,230,22,10,0,170,8,5,0,200,23,0,0,160] // Then the schedule is: // Mon-Fri: 6:10 --> 40C, 8:10 --> 17C, 11:40 --> 17C, 12:40 --> 17C, 17:10 --> 23C, 22:10 --> 17C // Sat-Sun: 8:05 --> 20C, 23:00 --> 16C ], }, }; module.exports = definition;