zigbee-herdsman-converters icon indicating copy to clipboard operation
zigbee-herdsman-converters copied to clipboard

convert two tuya Datapoints into one expose

Open nakata5321 opened this issue 1 year ago • 5 comments

Hello.

Description

I'm writing now converter for new ACMELEC thermostat, model - AE-940K-Daikin. I've got next external definition:

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 extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;
const tuya = require('zigbee-herdsman-converters/lib/tuya');

const definition = {
    fingerprint: [
        {
            modelID: 'TS0601',
            manufacturerName: '_TZE200_wem3gxyx',
        },
    ],
    model: 'TS0601_new',
    vendor: 'TuYa',
    description: 'ACMELEC thermostat, model - AE-940K-Daikin. Can work with DAikin vrv system',
    fromZigbee: [tuya.fz.datapoints],
    toZigbee: [tuya.tz.datapoints],
    onEvent: tuya.onEventSetTime,
    configure: tuya.configureMagicPacket,
    exposes: [
	e.binary('state', ea.STATE_SET, 'ON', 'OFF').withDescription('Turn the thermostat ON/OFF'),
	e.climate()
	    .withSystemMode(['cool', 'heat', 'fan_only', 'dry'], ea.STATE_SET)
	    .withSetpoint('current_heating_setpoint', 16, 32, 1, ea.STATE_SET)
	    .withFanMode(['low', 'medium', 'high', 'auto'], ea.STATE_SET)
	    .withLocalTemperature(ea.STATE),
	e.child_lock(),
    ],
    meta: {
        tuyaDatapoints: [
		[1, 'state', tuya.valueConverter.onOff],
		[2, 'system_mode', tuya.valueConverterBasic.lookup({'cool': tuya.enum(0), 'heat': tuya.enum(1), 'fan_only': tuya.enum(2), 'dry': tuya.enum(3)})],
                [16, 'current_heating_setpoint', tuya.valueConverter.raw],
                [28, 'fan_mode', tuya.valueConverterBasic.lookup(
                    {'low': tuya.enum(0), 'medium': tuya.enum(1), 'high': tuya.enum(2), 'auto': tuya.enum(3)})],
                [40, 'child_lock', tuya.valueConverter.lockUnlock],
        ],
    },
};

module.exports = definition;

it's work and I can control it in zigbee2mqtt frontend. image

And I also see it in home assistant: image

But I don't like that Turn ON/OFF button separated from thermostat HVAC modes, so i have to manually turn on it every time before i will choose HVAC mode.

Question/Problem

Is in possible to connect together datapoint(1) - turn ON/OFF button and datapoint(2) - Hvac modes.

As result, I expect to see one more mode in HVAC modes "off" which will off thermostat, or turn on in any mode.

nakata5321 avatar Jan 10 '24 13:01 nakata5321

You can create a custom value converter which send a value to multiple datapoints, example

Koenkk avatar Jan 10 '24 20:01 Koenkk

hi @nakata5321 I have this same device, I managed to get it working with my own external converter through trial and error but it seems to require multiple attempts before the device becomes responsive. Also the thermostat does not seem to report any temperature measurement which I thought was a bit strange. How is your current code looking? Is it working well?

laikakajsa avatar Apr 02 '24 23:04 laikakajsa

hi @nakata5321 I have this same device, I managed to get it working with my own external converter through trial and error but it seems to require multiple attempts before the device becomes responsive. Also the thermostat does not seem to report any temperature measurement which I thought was a bit strange. How is your current code looking? Is it working well?

Hi @laikakajsa, While I make my automation with this device, I've release that I need turn on/off and choose HVAC mode separately, so i don't make custom converter. But if you can share here your variant of converter - it will be cool.

And yes, My device also don''t share temperature. I've contacted with seller and he told me that these devices don't have temperature sensor inside.

nakata5321 avatar Apr 03 '24 06:04 nakata5321

Hi, I have the AE-669K and it worked like a charm with @nakata5321 code, thank you!. Just one question, how did you find the Tuya Datapoints? Do you have a Tuya Hub and followed this guide or it was just trial and error?

xaviermartinez avatar Aug 03 '24 19:08 xaviermartinez

Hi, I have the AE-669K and it worked like a charm with @nakata5321 code, thank you!. Just one question, how did you find the Tuya Datapoints? Do you have a Tuya Hub and followed this guide or it was just trial and error?

Hi, This is cool, that it helped you. Yes, i have Tuya Hub, so i follow the article. Since i buy a lot of devices and some of them not in Z2M module, i've decided to buy one Tuya hub for testing purpose.

nakata5321 avatar Aug 05 '24 06:08 nakata5321