Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
11.77k stars 1.64k forks source link

[New device support]: Tuya thermostat TS0601 _TZE204_pcdmj88b #19462

Closed Tilt7238 closed 2 months ago

Tilt7238 commented 10 months ago

Link

https://de.aliexpress.com/item/1005006066560400.html

Database entry

{"id":7,"type":"EndDevice","ieeeAddr":"0xa4c138c059067de9","nwkAddr":46572,"manufId":4417,"manufName":"_TZE204_pcdmj88b","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":{"65506":56,"65508":0,"appVersion":73,"modelId":"TS0601","manufacturerName":"_TZE204_pcdmj88b","powerSource":3,"zclVersion":3,"stackVersion":0,"hwVersion":1,"dateCode":""}}},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":73,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{},"lastSeen":1698512485137,"defaultSendRequestWhen":"immediate"}

Comments

I bought 2 of these thermostats and tried it with the existing TV02-Zigbee external converter in Tuya.ts , but it didn't work. I also tried the converter below which I found in another issue

External converter

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: [
        {modelID: 'TS0601', manufacturerName: '_TZE200_a4bpgplm'},
        {modelID: 'TS0601', manufacturerName: '_TZE200_dv8abrrz'},
        {modelID: 'TS0601', manufacturerName: '_TZE200_z1tyspqw'},
        {modelID: 'TS0601', manufacturerName: '_TZE200_rtrmfadk'},
    ],
    model: 'TS0601_thermostat_1',
    vendor: 'TuYa',
    description: 'Thermostatic radiator valve',
    whiteLabel: [
        {vendor: 'Unknown/id3.pl', model: 'GTZ06'},
    ],
    onEvent: tuya.onEventSetLocalTime,
    fromZigbee: [tuya.fz.datapoints],
    toZigbee: [tuya.tz.datapoints],
    configure: tuya.configureMagicPacket,
    exposes: [
        e.battery(), e.child_lock(), e.max_temperature(), e.min_temperature(),
        e.position(), e.window_detection(),
        e.binary('window', ea.STATE, 'CLOSED', 'OPEN').withDescription('Window status closed or open '),
        e.binary('alarm_switch', ea.STATE, 'ON', 'OFF').withDescription('Thermostat in error state'),
        e.climate()
            .withLocalTemperature(ea.STATE).withSetpoint('current_heating_setpoint', 5, 35, 0.5, ea.STATE_SET)
            .withLocalTemperatureCalibration(-30, 30, 0.1, ea.STATE_SET)
            .withPreset(['auto', 'manual', 'off', 'on'],
                'MANUAL MODE ☝ - In this mode, the device executes manual temperature setting. ' +
            'When the set temperature is lower than the "minimum temperature", the valve is closed (forced closed). ' +
            'AUTO MODE ⏱ - In this mode, the device executes a preset week programming temperature time and temperature. ' +
            'ON - In this mode, the thermostat stays open ' +
            'OFF - In this mode, the thermostat stays closed')
            .withSystemMode(['auto', 'heat', 'off'], ea.STATE)
            .withRunningState(['idle', 'heat'], ea.STATE),
        ...tuya.exposes.scheduleAllDays(ea.STATE_SET, 'HH:MM/C HH:MM/C HH:MM/C HH:MM/C'),
        e.binary('boost_heating', ea.STATE_SET, 'ON', 'OFF')
            .withDescription('Boost Heating: press and hold "+" for 3 seconds, ' +
            'the device will enter the boost heating mode, and the ▷╵◁ will flash. The countdown will be displayed in the APP'),
        e.numeric('boost_time', ea.STATE_SET).withUnit('min').withDescription('Countdown in minutes')
            .withValueMin(0).withValueMax(1000),
    ],
    meta: {
        tuyaDatapoints: [
            [1, null,
                {
                    from: (v) => {
                        utils.assertNumber(v, 'system_mode');
                        const presetLookup = {0: 'auto', 1: 'manual', 2: 'off', 3: 'on'};
                        const systemModeLookup = {0: 'auto', 1: 'auto', 2: 'off', 3: 'heat'};
                        return {preset: presetLookup[v], system_mode: systemModeLookup[v]};
                    },
                },
            ],
            [1, 'system_mode', tuya.valueConverterBasic.lookup({'auto': tuya.enum(1), 'off': tuya.enum(2), 'heat': tuya.enum(3)})],
            [1, 'preset', tuya.valueConverterBasic.lookup(
                {'auto': tuya.enum(0), 'manual': tuya.enum(1), 'off': tuya.enum(2), 'on': tuya.enum(3)})],
            [2, 'current_heating_setpoint', tuya.valueConverter.divideBy10],
            [3, 'local_temperature', tuya.valueConverter.divideBy10],
            [4, 'boost_heating', tuya.valueConverter.onOff],
            [5, 'boost_time', tuya.valueConverter.countdown],
            [6, 'running_state', tuya.valueConverterBasic.lookup({'heat': 1, 'idle': 0})],
            [7, 'window', tuya.valueConverterBasic.lookup({'OPEN': 1, 'CLOSE': 0})],
            [8, 'window_detection', tuya.valueConverter.onOff],
            [12, 'child_lock', tuya.valueConverter.lockUnlock],
            [13, 'battery', tuya.valueConverter.raw],
            [14, 'alarm_switch', tuya.valueConverter.onOff],
            [15, 'min_temperature', tuya.valueConverter.divideBy10],
            [16, 'max_temperature', tuya.valueConverter.divideBy10],
            [17, 'schedule_monday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(1)],
            [18, 'schedule_tuesday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(2)],
            [19, 'schedule_wednesday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(3)],
            [20, 'schedule_thursday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(4)],
            [21, 'schedule_friday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(5)],
            [22, 'schedule_saturday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(6)],
            [23, 'schedule_sunday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(7)],
            [101, 'local_temperature_calibration', tuya.valueConverter.localTempCalibration1],
            [102, 'position', tuya.valueConverter.divideBy10],
        ],
    },
};

module.exports = definition;

Supported color modes

No response

Color temperature range

No response