Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Tilt7238 opened this issue Oct 28, 2023 · 49 comments
Open

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

Tilt7238 opened this issue Oct 28, 2023 · 49 comments
Labels
new device support New device support request

Comments

@Tilt7238
Copy link

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

@Tilt7238 Tilt7238 added the new device support New device support request label Oct 28, 2023
@ha-jos
Copy link

ha-jos commented Nov 1, 2023

Same issue, I ordered the zigbee gateway so I can map the correct data.
The expected delivery will be by the end of next week.

If I find time and the correct mapping data i will try to contribute it so others can use is too.

@T0ytoy
Copy link

T0ytoy commented Nov 7, 2023

I'm very much intersted as I bought multiple of these radiator valves and can't use them right now :(
I'd love to help in any way but I don't have a tuya gateway nor the knowledge to developp an adapter for new devices.

I'll follow this thread with care though!

@Erwsaym
Copy link

Erwsaym commented Nov 7, 2023

I'm interested too !
Thanks in advance if you find the way to bring compatibility !

@jim-fx
Copy link

jim-fx commented Nov 8, 2023

I have a tuya zigbee gateway and followed the steps outlined in the zigbee2mqtt wiki to Find Tuya Datapoints

Through this I obtained the following data points for _TZE204_pcdmj88b thermostat:

{
  "2": "Mode",
  "4": "Set temperature",
  "5": "Current temperature",
  "6": "Battery capacity",
  "7": "Child lock",
  "8": "Temperature scale",
  "9": "Set temperature ceiling",
  "10": "The lower limit of temperature",
  "14": "Window check",
  "16": "Window temp",
  "17": "Window time",
  "18": "Backlight brightness",
  "19": "Factory data reset",
  "21": "Holiday temperature",
  "24": "Home temp",
  "25": "Leave temp",
  "28": "Week program",
  "29": "Week program Tuesday",
  "30": "Week program Wednesday",
  "31": "Week program Thursday",
  "32": "Week program Friday",
  "33": "Week program Saturday",
  "34": "Week program Sunday",
  "35": "Fault alarm",
  "36": "Frost protection",
  "37": "Rapid warming",
  "38": "Rapid heating countdown",
  "39": "Switch Scale",
  "47": "Temperature correction",
  "48": "Valve testing",
  "49": "State of the valve",
  "101": "111"
}

I will try to write an external converter myself, but I am not sure if i can do it :)

@T0ytoy
Copy link

T0ytoy commented Nov 8, 2023

Thanks a lot for spending time on this, I'm really glad! I'll try and look how to make a converter, but I welcome anyone more experimented to beat me to it!

@tnako
Copy link

tnako commented Nov 9, 2023

Here is mine

const exposes = require('zigbee-herdsman-converters/lib/exposes');
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const e = exposes.presets;
const ea = exposes.access;

const definition = {
        fingerprint: [
            {modelID: 'TS0601', manufacturerName: '_TZE204_pcdmj88b'},
        ],
        model: 'TS0601_thermostat_3',
        vendor: 'TuYa',
        description: 'Thermostatic radiator valve',
        fromZigbee: [tuya.fz.datapoints],
        toZigbee: [tuya.tz.datapoints],
        onEvent: tuya.onEventSetTime,
        configure: tuya.configureMagicPacket,
        exposes: [
            e.child_lock(), e.battery_low(),
            e.climate()
                .withSetpoint('current_heating_setpoint', 5, 35, 1, ea.STATE_SET)
                .withLocalTemperature(ea.STATE)
                .withSystemMode(['auto', 'heat', 'off'], ea.STATE_SET)
                .withRunningState(['idle', 'heat'], ea.STATE)
                .withLocalTemperatureCalibration(-3, 3, 1, ea.STATE_SET),
            ...tuya.exposes.scheduleAllDays(ea.STATE_SET, 'HH:MM/C HH:MM/C HH:MM/C HH:MM/C HH:MM/C HH:MM/C'),
            e.binary('scale_protection', ea.STATE_SET, 'ON', 'OFF').withDescription('If the heat sink is not fully opened within ' +
                'two weeks or is not used for a long time, the valve will be blocked due to silting up and the heat sink will not be ' +
                'able to be used. To ensure normal use of the heat sink, the controller will automatically open the valve fully every ' +
                'two weeks. It will run for 30 seconds per time with the screen displaying "Ad", then return to its normal working state ' +
                'again.'),
            e.binary('frost_protection', ea.STATE_SET, 'ON', 'OFF').withDescription('When the room temperature is lower than ' +
                '5 °C, the valve opens; when the temperature rises to 8 °C, the valve closes.'),
            e.numeric('error', ea.STATE).withDescription('If NTC is damaged, "Er" will be on the TRV display.'),
        ],
        meta: {
            tuyaDatapoints: [
                [2, 'system_mode', tuya.valueConverterBasic.lookup({'auto': tuya.enum(0), 'heat': tuya.enum(1), 'off': tuya.enum(2)})],
                [4, 'current_heating_setpoint', tuya.valueConverter.divideBy10],
                [5, 'local_temperature', tuya.valueConverter.divideBy10],
                [6, 'battery', tuya.valueConverter.raw],
                [7, 'child_lock', tuya.valueConverter.lockUnlock],
                [28, 'schedule_monday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(1)],
                [29, 'schedule_tuesday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(2)],
                [30, 'schedule_wednesday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(3)],
                [31, 'schedule_thursday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(4)],
                [32, 'schedule_friday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(5)],
                [33, 'schedule_saturday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(6)],
                [34, 'schedule_sunday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(7)],
                [35, 'fault_alarm', tuya.valueConverter.errorOrBatteryLow],
                [36, 'frost_protection', tuya.valueConverter.onOff],
                [39, 'scale_protection', tuya.valueConverter.onOff],
                [47, 'local_temperature_calibration', tuya.valueConverter.localTempCalibration2],
                [49, 'valve_state', tuya.valueConverterBasic.lookup({'closed': tuya.enum(0), 'open': tuya.enum(1)})],
            ],
        },
    };

module.exports = definition;

Works/tested:

  • changing target temp current_heating_setpoint
  • collecting current temp local_temperature
  • valve state valve_state open/closed

Caveats

  • reused model/image 'TS0601_thermostat_3'
  • schedule not tested
  • system_mode looks like preset

@T0ytoy
Copy link

T0ytoy commented Nov 9, 2023

@tnako thank you very much for implementing the converter, I tested it and can confirm that changing target temperature works and triggers the valve. Local temperature is fine too and it can be adjusted +/-3°C. With that and some Home Assistant automation, I think we can pretty much do anything.

It would be perfect if we could directly act on the valve state (percentage opened ?) to rely on any external thermometer, but I can work around that. Would DP 48 "valve testing" be worth exploring?

Thanks again!

@jim-fx
Copy link

jim-fx commented Nov 9, 2023

@tnako thank you very much :)

I might be wrong, but I think DP 48 refers to the thermostat opening and closing the valve to the max/min for testing.

@Koenkk
Copy link
Owner

Koenkk commented Nov 9, 2023

@tnako could you create a PR?

@tnako
Copy link

tnako commented Nov 9, 2023

@tnako could you create a PR?

Sure. First time is best time and closer to weekends.

If I disappear after this promise:

Details
  • added presets
  • added boost mode
  • changed valve_state to running_state and heat/idle
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const e = exposes.presets;
const ea = exposes.access;

const definition = {
        fingerprint: [
            {modelID: 'TS0601', manufacturerName: '_TZE204_pcdmj88b'}, // Mine
        ],
        model: 'TS0601_thermostat_3',
        vendor: 'TuYa',
        description: 'Thermostatic radiator valve',
        fromZigbee: [tuya.fz.datapoints],
        toZigbee: [tuya.tz.datapoints],
        onEvent: tuya.onEventSetTime,
        configure: tuya.configureMagicPacket,
        exposes: [
            e.child_lock(),
            e.battery_low(),
            e.climate()
                .withSetpoint('current_heating_setpoint', 5, 35, 1, ea.STATE_SET)
                .withLocalTemperature(ea.STATE)
                .withPreset(['schedule', 'holiday', 'manual', 'comfort', 'eco'])
                .withRunningState(['idle', 'heat'], ea.STATE)
                .withLocalTemperatureCalibration(-3, 3, 1, ea.STATE_SET),
            ...tuya.exposes.scheduleAllDays(ea.STATE_SET, 'HH:MM/C HH:MM/C HH:MM/C HH:MM/C HH:MM/C HH:MM/C'),
            e.binary('scale_protection', ea.STATE_SET, 'ON', 'OFF').withDescription('If the heat sink is not fully opened within ' +
                'two weeks or is not used for a long time, the valve will be blocked due to silting up and the heat sink will not be ' +
                'able to be used. To ensure normal use of the heat sink, the controller will automatically open the valve fully every ' +
                'two weeks. It will run for 30 seconds per time with the screen displaying "Ad", then return to its normal working state ' +
                'again.'),
            e.binary('frost_protection', ea.STATE_SET, 'ON', 'OFF').withDescription('When the room temperature is lower than ' +
                '5 °C, the valve opens; when the temperature rises to 8 °C, the valve closes.'),
            e.numeric('error', ea.STATE).withDescription('If NTC is damaged, "Er" will be on the TRV display.'),
            e.binary('boost_heating', ea.STATE_SET, 'ON', 'OFF')
                .withDescription('Boost Heating: the device will enter the boost heating mode.'),
            ],
        meta: {
            tuyaDatapoints: [
                [2, 'preset', tuya.valueConverterBasic.lookup({'schedule': tuya.enum(0), 'holiday': tuya.enum(1), 'manual': tuya.enum(2), 'comfort': tuya.enum(3), 'eco': tuya.enum(4)})],
                [4, 'current_heating_setpoint', tuya.valueConverter.divideBy10],
                [5, 'local_temperature', tuya.valueConverter.divideBy10],
                [6, 'battery', tuya.valueConverter.raw],
                [7, 'child_lock', tuya.valueConverter.lockUnlock],
                [28, 'schedule_monday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(1)],
                [29, 'schedule_tuesday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(2)],
                [30, 'schedule_wednesday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(3)],
                [31, 'schedule_thursday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(4)],
                [32, 'schedule_friday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(5)],
                [33, 'schedule_saturday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(6)],
                [34, 'schedule_sunday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(7)],
                [35, 'fault_alarm', tuya.valueConverter.errorOrBatteryLow],
                [36, 'frost_protection', tuya.valueConverter.onOff],
                [37, 'boost_heating', tuya.valueConverter.onOff],
                [39, 'scale_protection', tuya.valueConverter.onOff],
                [47, 'local_temperature_calibration', tuya.valueConverter.localTempCalibration2],
                [49, 'running_state', tuya.valueConverterBasic.lookup({'idle': tuya.enum(0), 'heat': tuya.enum(1)})],
            ],
        },
    };

module.exports = definition;

@T0ytoy
Copy link

T0ytoy commented Nov 10, 2023

@tnako I updated with your last version, thank you very much.

It seems that the presets all have a fixed target temperature value (except manual mode) : eco is 20°C (how tf is that "eco"), comfort is 25°C (🔥 ), holiday ('away') is 15°C.

@jim-fx you have a tuya gateway, right? Do you know if those values are updatable at all with the official tuya app, or are they hard-coded and the only solution in homeassistant is to use manual mode?

Thanks again for all the work put into this :)

@jim-fx
Copy link

jim-fx commented Nov 10, 2023

Not sure, I would guess the values are hardcoded. But if you connect the thermostat to home assistant you don't need presets anymore? I accidentaly bought two, I dont mind sending you one 4 free if you would like to play around yourself :)

@T0ytoy
Copy link

T0ytoy commented Nov 10, 2023

@jim-fx that's very nice of you but not necessary, I already own 5 of them, only one is installed yet, though 😄
You're right that manual mode is enough, but preset would have been a nice "cherry on top" feature, for example in Home Assistant when no one is at home you trigger the "away" preset instead of setting the manual mode to 17°C, it's a bit easier to understand in the UI.

Anyway 'tis but a detail, thank you for answering ;)

@tnako
Copy link

tnako commented Nov 10, 2023

@T0ytoy added holiday_temperature, comfort_temperature and eco_temperature. Quick check show possibility to change preset temps

Details

const exposes = require('zigbee-herdsman-converters/lib/exposes');
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const e = exposes.presets;
const ea = exposes.access;

const definition = {
        fingerprint: [
            {modelID: 'TS0601', manufacturerName: '_TZE204_pcdmj88b'}, 
        ],
        model: 'TS0601_thermostat_1',
        vendor: 'TuYa',
        description: 'Thermostatic radiator valve',
        fromZigbee: [tuya.fz.datapoints],
        toZigbee: [tuya.tz.datapoints],
        onEvent: tuya.onEventSetLocalTime,
        configure: tuya.configureMagicPacket,
        exposes: [
            e.child_lock(),
            e.battery(),
            e.battery_low(),
            e.climate()
                .withSetpoint('current_heating_setpoint', 5, 35, 0.5, ea.STATE_SET)
                .withLocalTemperature(ea.STATE)
                .withPreset(['schedule', 'holiday', 'manual', 'comfort', 'eco'])
                .withSystemMode(['off', 'heat'], ea.STATE)
                .withLocalTemperatureCalibration(-3, 3, 1, ea.STATE_SET),
            ...tuya.exposes.scheduleAllDays(ea.STATE_SET, 'HH:MM/C HH:MM/C HH:MM/C HH:MM/C HH:MM/C HH:MM/C'),
            e.holiday_temperature().withValueMin(5).withValueMax(30),
            e.comfort_temperature().withValueMin(5).withValueMax(30),
            e.eco_temperature().withValueMin(5).withValueMax(30),
            e.binary('scale_protection', ea.STATE_SET, 'ON', 'OFF').withDescription('If the heat sink is not fully opened within ' +
                'two weeks or is not used for a long time, the valve will be blocked due to silting up and the heat sink will not be ' +
                'able to be used. To ensure normal use of the heat sink, the controller will automatically open the valve fully every ' +
                'two weeks. It will run for 30 seconds per time with the screen displaying "Ad", then return to its normal working state ' +
                'again.'),
            e.binary('frost_protection', ea.STATE_SET, 'ON', 'OFF').withDescription('When the room temperature is lower than ' +
                '5 °C, the valve opens; when the temperature rises to 8 °C, the valve closes.'),
            e.numeric('error', ea.STATE).withDescription('If NTC is damaged, "Er" will be on the TRV display.'),
            e.binary('boost_heating', ea.STATE_SET, 'ON', 'OFF')
                .withDescription('Boost Heating: the device will enter the boost heating mode.'),
            ],
        meta: {
            tuyaDatapoints: [
                [2, 'preset', tuya.valueConverterBasic.lookup({'schedule': tuya.enum(0), 'holiday': tuya.enum(1), 'manual': tuya.enum(2), 'comfort': tuya.enum(3), 'eco': tuya.enum(4)})],
                [4, 'current_heating_setpoint', tuya.valueConverter.divideBy10],
                [5, 'local_temperature', tuya.valueConverter.divideBy10],
                [6, 'battery', tuya.valueConverter.raw],
                [7, 'child_lock', tuya.valueConverter.lockUnlock],
                [21, 'holiday_temperature', tuya.valueConverter.divideBy10],
                [24, 'comfort_temperature', tuya.valueConverter.divideBy10],
                [25, 'eco_temperature', tuya.valueConverter.divideBy10],
                [28, 'schedule_monday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(1)],
                [29, 'schedule_tuesday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(2)],
                [30, 'schedule_wednesday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(3)],
                [31, 'schedule_thursday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(4)],
                [32, 'schedule_friday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(5)],
                [33, 'schedule_saturday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(6)],
                [34, 'schedule_sunday', tuya.valueConverter.thermostatScheduleDayMultiDPWithDayNumber(7)],
                [35, 'fault_alarm', tuya.valueConverter.errorOrBatteryLow],
                [36, 'frost_protection', tuya.valueConverter.onOff],
                [37, 'boost_heating', tuya.valueConverter.onOff],
                [39, 'scale_protection', tuya.valueConverter.onOff],
                [47, 'local_temperature_calibration', tuya.valueConverter.localTempCalibration2],
                [49, 'system_mode', tuya.valueConverterBasic.lookup({'off': tuya.enum(0), 'heat': tuya.enum(1)})],
            ],
        },
    };

module.exports = definition;

Going to create PR

@T0ytoy
Copy link

T0ytoy commented Nov 10, 2023

Thank you for looking it up! Those TRV went from unusable to good home assistant product in a few day, that is so great.

Looking up at your converter, I was wondering if the third parameter of :
.withLocalTemperatureCalibration(-3, 3, 1, ea.STATE_SET) was the increment size. If that is the case, it would be better at 0.5 or even 0.1, as 1C is a bit high for calibration. But maybe there is a hardware limitation and it cannot be done.

Thanks again!

@tnako
Copy link

tnako commented Nov 10, 2023

Yes, '1' is precision and you can put any step there. For this valve only 1C calibration works in my tests.

Personally I use home assistance and calibration way easy to do with template.sensors. Example of usage hoas filter on raw data: Red is raw valve values and Blue is 5min moving average.
21 19 18

@tnako
Copy link

tnako commented Nov 11, 2023

And merged to main branch. Thank everybody! With datapoints here was easy to make convertor 👍

@j4m3s
Copy link

j4m3s commented Nov 16, 2023

Thank you very much for doing this @tnako, it's really good of you. I've got one of these devices and have been playing with the device & the converter:

  • it appears that the temperature calibration can actually range between -12 and 12 from my testing.
  • I think it's this device rather than the one in the picture. I own both, the one pictured in zigbee2mqtt is a _TZE200_hue3yfsn I think.
  • The number of transition-points in the day schedule is hardcoded at 4 in tuya.ts here - I don't know how to know if that's a genuine limitation in the device or not. According to the AliExpress link above it supports 6 transitions each for 5+2, 6+1 or 7 individual days, the same as the TZE200_hue3yfsn. If that's the case, there should be another datapoint for "schedule" like this one.

@dockerpirate
Copy link

dockerpirate commented Nov 22, 2023

i tested dev branch, some functions need to be corrected:

  • 'current_heating_setpoint', 5, 45, 0.5
  • .withLocalTemperatureCalibration(-7, 7, 1, ea.STATE_SET)
  • frost_protection -> doesnt work
  • scale_protection -> is not present as setting on the device, you cant switch it on / off

not tested

  • battery low (battery status seems to work)
  • error state
  • shedule

And I'm missing functions:

  • blind spot
  • open window
  • thermal stop

202311222154

Maybe for description modell nr. is "BAB-1413Pro-E" and it looks similar to Tuya TV02, but it isnt
Screenshot_20231122_214417

-13230296381108418737

@apedance
Copy link

How do you even get those devices in pairing mode?
Only possible via Tuya gateway?

@shyney7
Copy link

shyney7 commented Nov 27, 2023

How do you even get those devices in pairing mode?
Only possible via Tuya gateway?

In the manual it says to press the reset button for >5seconds

@apedance
Copy link

Not sure what manual you have but mine doesn't have this option.

IMG_20231127_132357

@elmargrote
Copy link

elmargrote commented Nov 27, 2023

How do you even get those devices in pairing mode? Only possible via Tuya gateway?

There is a very small black button above the display which you can only see when you have device open.
You have to push that until the wlan symbol blinks.

@apedance
Copy link

I have a small black button.
The only thing it does when pressed once is change the orientation of the display.
When pressed longer nothing happens other than it turning off the display after 10s of pressing.

I can see the Wifi symbol. I have no idea how to pair this device.
Comms should be Zigbee.

IMG_20231127_160629
IMG_20231127_161050

@philanmar
Copy link

I have the same devices, to pair them, you have to "activate" the TRV by pressing a button, so the display is active (took me a little bit to figure this out cause i wondered why it did not start pairing), then you have to press that little, black button for a few seconds, then a blue LED should start to blink, which means the device is in pairing mode.

@shyney7
Copy link

shyney7 commented Nov 27, 2023

20231127_162914.jpg

This is the S2 button:
20231127_162959.jpg

But the support for this device is only going to be released with the next zigbee2mqtt update next month right?

@apedance
Copy link

Yes, well, I think.
I finally have pairing mode. Thank you guys.
But zigbee2mqtt can't see those devices yet.

@paszkoski
Copy link

Hello,
I got this thermostat to work with the latest dev branch, but I have one problem.
I can't get local temperature calibration to work with homeassistant. When I change it via zigbee2MQTT web interface it works fine, but when I try to change it via homeassistant entity number.[name]_local_temperature_calibration it doesn't work.
Does anybody have the same problem?

@apedance
Copy link

apedance commented Dec 1, 2023

I updated to the latest version which was released. (stable)
Support is in the changelog.

Still if I enter pariring mode (blue light blinking) - I cannot see the devices in zigbee2mqtt.
Any ideas?

@shyney7
Copy link

shyney7 commented Dec 1, 2023

I updated to the latest version which was released. (stable)
Support is in the changelog.

Still if I enter pariring mode (blue light blinking) - I cannot see the devices in zigbee2mqtt.
Any ideas?

Its working for me and was added after allowing new devices

@shyney7
Copy link

shyney7 commented Dec 1, 2023

Should work after enabling join. Maybe reset the device and then try again?

A problem that I am having is that the device just turns to off mode after a while although it's set to manual mode and was set to heat mode.

Screenshot_20231201_142919_Home Assistant.jpg

@apedance
Copy link

apedance commented Dec 1, 2023

I have two devices. I did reset both of them and tried to pair them.
Enable the device by pressing the big button and then pressing S2 for 5s until the Wifi light blinks in blue color.
Using zigbee2mqtt with a Sonoff V3 Dongle (recommended one) connected to Home Assistant Supervised. (Other Zigbee devices are workin flawlessly)

Yet, I can't connect those new devices. Must be a different devices?
My model printed on the manual is: BAB-1314Pro-E
Do you have any information on your make/model?

@shyney7
Copy link

shyney7 commented Dec 1, 2023

@apedance
BAB-1314Pro-E

@T0ytoy
Copy link

T0ytoy commented Dec 1, 2023

Same model number on my manual, everything works great on z2m with a Zigate+. The fact that both TRV can't connect might mean the problem iis with z2m or your dongle?

@apedance
Copy link

apedance commented Dec 1, 2023

Same model number on my manual, everything works great on z2m with a Zigate+. The fact that both TRV can't connect might mean the problem iis with z2m or your dongle?

hmmm. I am using the recommended SONOFF Zigbee 3.0 USB Dongle Plus ZBDongle-P with crrent version: 1.34.0-1 zigbee2mqtt.
Hue Sensors and other TRVs are working fine. Can this be related to the dongle specifically?

@shyney7 thanks. :)

edit: I reconnected the dongle and now they are working...

@shyney7
Copy link

shyney7 commented Dec 1, 2023

It seems that it switches to off after about 2-3 minutes. Every switch to on was triggered by me in the logs and the off switches were triggered without any input from my side?
Screenshot_20231201_145109_Home Assistant.jpg

@j4m3s
Copy link

j4m3s commented Dec 1, 2023

Looking at your graph that's because the actual current temperature (the blue line) is already above the target temperature (the pink line), so the TRV is doing what it's supposed to, turning off the heat. Or am I misunderstanding your question?

@apedance
Copy link

apedance commented Dec 1, 2023

Testing two right now.
They work fine so far. They have far worse signal rates LQI at the same conditions than a SONOFF TRVZB device for instance.

@shyney7
Copy link

shyney7 commented Dec 1, 2023

Looking at your graph that's because the actual current temperature (the blue line) is already above the target temperature (the pink line), so the TRV is doing what it's supposed to, turning off the heat. Or am I misunderstanding your question?

It's not the same behavior like my other tuya device. Its stays on even after reaching the target temperature. That makes more sense to me to keep the desired level. You don't want to close the valve completely after reaching the temperature and only opening it after the temperature is falling below level again.

Here is how it is on the other device (_TZE200_hue3yfsn):

Screenshot_20231201_222355_Home Assistant.jpg

This is also the reason why the temperature is overshooting as you can see in the graph below. At 16:00 I installed the new thermostat. It should look like before a steady temperature. Since the thermostat is closing completely and then opening completely the temperature is overshooting the target temperature all the time.
Screenshot_20231201_230306_Home Assistant.jpg

@j4m3s
Copy link

j4m3s commented Dec 1, 2023

The _TZE200_hue3yfsn doesn't expose its valve state though - the herdsman code for that device always reports the valve as open (unless the device is set to Heating Stop iirc). So the orange shading on the first graph will look that way even if you set the target temperature to 15 degrees and the valve is actually fully closed.

I think the reason the temperature graph you've posted varies so wildly is that the device only measures temperature to whole degrees, whereas the _TZE200_hue3yfsn measures to 0.1 degrees.

@dockerpirate
Copy link

Looking at your graph that's because the actual current temperature (the blue line) is already above the target temperature (the pink line), so the TRV is doing what it's supposed to, turning off the heat. Or am I misunderstanding your question?

It's not the same behavior like my other tuya device. Its stays on even after reaching the target temperature. That makes more sense to me to keep the desired level. You don't want to close the valve completely after reaching the temperature and only opening it after the temperature is falling below level again.

Here is how it is on the other device (_TZE200_hue3yfsn):

![

This is also the reason why the temperature is overshooting as you can see in the graph below. At 16:00 I installed the new thermostat. It should look like before a steady temperature. Since the thermostat is closing completely and then opening completely the temperature is overshooting the target temperature all the time. ![

But your problem has nothing to do with z2m. z2m sends the target value to the device and the device adjusts it. It's like a switch, if the switch flickers it has nothing to do with z2m

@shyney7
Copy link

shyney7 commented Dec 2, 2023

@j4m3s thanks for the clarification 👍. I didn't know that the _TZE200_hue3yfsn model doesn't transfer the valve state and thought that heating is the normal state. So everything is working fine from the z2m side . Although I think that these thermostats are useless with such a high delta. Not even the standard thermostats that just work mechanically without electronics work better than this. Is it possible to force on/off from HA so that I can use a PID controller e.g. to control the thermostat and use an external temperature sensor?

@j4m3s
Copy link

j4m3s commented Dec 2, 2023

This is one of the reasons why I've decided I don't like these devices and stopped using them - I've bought another _TZE200_hue3yfsn instead (although I really wish it exposed the valve state!).

To answer your question: you could create an automation which sets the target temperature to a high value when your external sensor shows the temperature is too low, and vice versa when the sensor shows it's too low. But I think you'd still see big swings due to the thermal inertia in the radiator. To avoid the swings you would want to control the % open of the valve to have it open a small amount when it's close to target. That's not possible with this device. The other alternative is to use an automation to adjust the temperature calibration value up or down according to the delta between the temperature the device detects and the external sensor. Unfortunately that doesn't work well on this device either - not only is the local device temperature resolution poor but the calibration can only be adjusted in 1 degree steps too.

So tnako has done a great job of adding support for the device to z2m, but IMO they're not very good devices so I dont use them.

@dockerpirate
Copy link

@j4m3s thanks for the clarification 👍. I didn't know that the _TZE200_hue3yfsn model doesn't transfer the valve state and thought that heating is the normal state. So everything is working fine from the z2m side . Although I think that these thermostats are useless with such a high delta. Not even the standard thermostats that just work mechanically without electronics work better than this. Is it possible to force on/off from HA so that I can use a PID controller e.g. to control the thermostat and use an external temperature sensor?

Maybe the problem is a high value for "blind spot"?

Screenshot_20231202-131156_Brave_1

@shyney7
Copy link

shyney7 commented Dec 2, 2023

@dockerpirate since it's already set to 1° by default I don't see any optimization potential here!?

@Chartreusito
Copy link
Sponsor

Thanks everyone for the work. I ordered TV02 a month ago and sadly go those cheaper TS0601. They really look flimsy compared to TV02, but at least thanks to you they works with z2m.

@j4m3s
Copy link

j4m3s commented Dec 8, 2023

Thanks everyone for the work. I ordered TV02 a month ago and sadly go those cheaper TS0601. They really look flimsy compared to TV02, but at least thanks to you they works with z2m.

Me too - it seems EARU are shipping these cheaper inferior units instead of the ones they're actually advertising. I opened a dispute on AliExpress to get a refund!

@Chartreusito
Copy link
Sponsor

Thanks everyone for the work. I ordered TV02 a month ago and sadly go those cheaper TS0601. They really look flimsy compared to TV02, but at least thanks to you they works with z2m.

Me too - it seems EARU are shipping these cheaper inferior units instead of the ones they're actually advertising. I opened a dispute on AliExpress to get a refund!

I did too but they asked me to return the product, just a loss of time and money, hopefully the next shipment is OK.

@j4m3s
Copy link

j4m3s commented Dec 8, 2023

What we really need is better firmware for the devices so that they use 0.1 degree increments for temp and calibration, and expose the valve open state. Then they'd be OK :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new device support New device support request
Projects
None yet
Development

No branches or pull requests