zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

[Wrong device]: AVATTO Tuya ZigBee Smart Thermostat Low Power Battery Version

Open Liionboy opened this issue 2 years ago • 43 comments

Link

https://www.aliexpress.com/item/1005005822896810.html?spm=a2g0o.order_list.order_list_main.5.2efd1802haJd6J

Model

ZWT198

Description

Thermostat

Vendor

AVATTO

Picture (link)

https://ae01.alicdn.com/kf/S9d1b77a3456642c3986d50e9b788c8f9p/AVATTO-Tuya-ZigBee-Smart-Thermostat-Low-Power-Battery-Version-Water-Gas-Boiler-Temperature-Controller-Alexa-Google.jpg_80x80.jpg

Database entry

{"id":5,"type":"EndDevice","ieeeAddr":"0x3425b4fffe4c52d1","nwkAddr":4994,"manufId":4098,"manufName":"_TZE200_viy9ihs7","powerSource":"Battery","modelId":"TS0601","epList":[1],"endpoints":{"1":{"profId":260,"epId":1,"devId":81,"inClusterList":[0,4,5,61184],"outClusterList":[25,10],"clusters":{"genBasic":{"attributes":{"65503":"+\u001f�,i","65506":31,"65508":0,"65534":0,"modelId":"TS0601","manufacturerName":"_TZE200_viy9ihs7","stackVersion":0,"dateCode":"","zclVersion":3,"appVersion":65,"powerSource":3}}},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":65,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{"configured":-1440156621},"lastSeen":1697740964265,"defaultSendRequestWhen":"immediate"}

Notes

AVATTO Thermostat is seen like ONNDO smart thermostat and Temperature Calibration don't work:

image

image

Liionboy avatar Oct 19 '23 18:10 Liionboy

Is the same like this : https://www.zigbee2mqtt.io/devices/X5H-GB-B.html

Only this is power by battery

Liionboy avatar Oct 20 '23 06:10 Liionboy

Could you check if the issue is fixed with the following external converter: https://gist.github.com/Koenkk/c511c3857ee9ab474923b228bce07e1d

  • save this as file next to configuration.yaml as ext_converter.js
  • add it to configuration.yaml:
external_converters:
  - ext_converter.js
  • start z2m, check if issue is fixed

Koenkk avatar Oct 20 '23 18:10 Koenkk

Something is wrong because i have set Temperature when to start and now all thermostat start Heat even temperature is with +2

Liionboy avatar Oct 20 '23 20:10 Liionboy

This is error when i try to modify temperature or something on thermostat:

image

Liionboy avatar Oct 20 '23 20:10 Liionboy

This is thermostat:

https://www.aliexpress.com/item/1005005822896810.html?spm=a2g0o.order_list.order_list_main.5.1a961802dTJSX1

If you want i can connect 1 on Tuya and tell me how i can extract data from Tuya application

Liionboy avatar Oct 20 '23 20:10 Liionboy

That means this thermostat works differently. To add support for this:

  • Figure out the datapoints: https://www.zigbee2mqtt.io/advanced/support-new-devices/03_find_tuya_data_points.html
  • Create a new converter, you can take a look at existing thermostat converters to start with (e.g. this one

Koenkk avatar Oct 21 '23 07:10 Koenkk

I extract all of them but now i dont know how to put in a convert file :D :

{"1":"Switch","2":"Set temperature","3":"Current temperature","4":"Mode","9":"Child lock","11":"Fault alarm","15":"Set temperature upper limit","16":"Lower Temp","19":"Temperature correction","101":"Working status","102":"Frost protection function","103":"Reset","104":"Workday setting","107":"Output startup temperature difference","109":"Weekly procedure","110":"Backlight brightness"}

I will try or maybe you can help me faster then me :dancers:

edit; I dont know how to create this converter file with this value

Liionboy avatar Oct 21 '23 17:10 Liionboy

On Temperature calibration is from 0.1, 0.2, 0.3 ....... not and i think this is the problem and with -0.1, -0.2, -0.3 adn is from -9.9 to 9.0

Liionboy avatar Oct 21 '23 17:10 Liionboy

I don't knoow from where i can take function for convert

Liionboy avatar Oct 21 '23 18:10 Liionboy

i did a external convertor and change name:

image

Maybe on future will be implement all of expose because there are a lot in Tuya Application the list is below in 1 comment from me.

I saw in HASS Temp calibration is work, only in z2m are wrong number. Expose are same like that ONNDO Thermostat after i search on google only different is this is on Battery .

Thanks

Liionboy avatar Oct 21 '23 19:10 Liionboy

Once ready, please submit a pull request to update https://github.com/Koenkk/zigbee-herdsman-converters/blob/ca799050c761ff8268e57227db36e6beffe8d35c/src/devices/tuya.ts#L3927

Koenkk avatar Oct 22 '23 06:10 Koenkk

i dont know how to do a pull request so i will paste code here:

fingerprint: tuya.fingerprint('TS0601', ['_TZE200_viy9ihs7']), model: 'ZWT198', vendor: 'TuYa', description: 'AVATTO Battery Wall-Mount Thermostat', fromZigbee: [tuya.fz.datapoints], toZigbee: [tuya.tz.datapoints], onEvent: tuya.onEvent({timeStart: '2000'}), configure: tuya.configureMagicPacket, exposes: [ e.child_lock(), e.climate() .withSystemMode(['off', 'heat'], ea.STATE_SET) .withPreset(['auto', 'manual', 'temporary program']) .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.numeric('upper_temp', ea.STATE_SET).withUnit('°C').withValueMax(95) .withValueMin(15).withValueStep(1).withPreset('default', 60, 'Default value') .withDescription('Maximum upper temperature'), e.numeric('deadzone_temperature', ea.STATE_SET).withUnit('°C').withValueMax(10) .withValueMin(0.5).withValueStep(0.5).withPreset('default', 1, 'Default value') .withDescription('The delta between local_temperature and current_heating_setpoint to trigger Heat'), // Not working yet: // e.enum('schedule_mode', ea.STATE_SET, ['disabled','weekday/sat+sun','weekday+sat/sun','7day']) // .withDescription('Schedule mode') ], meta: { tuyaDatapoints: [ [1, 'system_mode', tuya.valueConverterBasic.lookup({'heat': true, 'off': false})], [2, 'current_heating_setpoint', tuya.valueConverter.divideBy10], [3, 'local_temperature', tuya.valueConverter.divideBy10], [4, 'preset', tuya.valueConverterBasic.lookup({'auto': tuya.enum(0), 'manual': tuya.enum(1), 'temporary program': tuya.enum(2)})], [9, 'child_lock', tuya.valueConverter.lockUnlock], [15, 'upper_temp', tuya.valueConverter.divideBy10], [19, 'local_temperature_calibration', tuya.valueConverter.divideBy10], [101, 'running_state', tuya.valueConverterBasic.lookup({'heat': tuya.enum(1), 'idle': tuya.enum(0)})], [102, 'frost_protection', tuya.valueConverter.onOff], [104, 'schedule_mode', tuya.valueConverterBasic.lookup( {'disabled': 0, 'weekday/sat+sun': 1, 'weekday+sat/sun': 2, '7day': 3}, )], [107, 'deadzone_temperature', tuya.valueConverter.divideBy10], // 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 // Last 2 periods are ignored if schedule_mode is 7day. When schedule_mode is disabled, // scheduling can't be configured at all. // 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 // I wasn't able to find a proper converter or to create one, so i commented it out // [109, 'dp109', tuya.valueConverter.raw],

    // unmapped DPs, still need to figure out what they do
    // [103, 'dp103', tuya.valueConverter.trueFalse1],
    // [105, 'dp105', tuya.valueConverter.trueFalse1],
    // [110, 'backlight_mode', tuya.valueConverter.raw],
    // [111, 'dp111', tuya.valueConverter.trueFalse1]
],

}, };

Liionboy avatar Oct 25 '23 19:10 Liionboy

I have the same device, and could help with the PR. But I'm actually unable to pair it. How do you enter pairing mode?

joaofl avatar Nov 09 '23 18:11 joaofl

I have the same device, and could help with the PR. But I'm actually unable to pair it. How do you enter pairing mode?

You hold down arrow to enter in pair mode until wi fi sign blink. But with device turn on

Liionboy avatar Nov 10 '23 15:11 Liionboy

I have the same device, and could help with the PR. But I'm actually unable to pair it. How do you enter pairing mode?

did you succed to connect?

Liionboy avatar Nov 13 '23 17:11 Liionboy

I have the same device, and could help with the PR. But I'm actually unable to pair it. How do you enter pairing mode?

did you succed to connect?

Yes, thank you. I was amazed that I could not find that info anywhere.

After connecting in have some controls working out of the box. But I noticed that I am loosing the date/time right after I set it in the device. That was the first issue I found.

Now I have to dig a bit deeper in this thread and gather the missing pieces

joaofl avatar Nov 14 '23 17:11 joaofl

I have the same device, and could help with the PR. But I'm actually unable to pair it. How do you enter pairing mode?

did you succed to connect?

Yes, thank you. I was amazed that I could not find that info anywhere.

After connecting in have some controls working out of the box. But I noticed that I am loosing the date/time right after I set it in the device. That was the first issue I found.

Now I have to dig a bit deeper in this thread and gather the missing pieces

yes, same here always when restart z2m data will be lose, and as you can see can't use all function from this thermostat like on instructions, is detected like ONNDO smart thermostat not like AVATTO but for me i saw is work now only for heat and i can calibrate temperature from HASS not from z2m because there are not working

Liionboy avatar Nov 16 '23 08:11 Liionboy

image

Liionboy avatar Nov 16 '23 08:11 Liionboy

But if it is detected as onddo, it probably has the same id? That could make things harder if they behave differently. Does the ONddo works fully? Do you know?

joaofl avatar Nov 16 '23 08:11 joaofl

But if it is detected as onddo, it probably has the same id? That could make things harder if they behave differently. Does the ONddo works fully? Do you know?

i dont have that model, only this from AVATTO

Liionboy avatar Nov 16 '23 09:11 Liionboy

i see this is ONNDO ----> https://www.ebay.com/itm/334559054299

Liionboy avatar Nov 16 '23 09:11 Liionboy

It looks exactly the same, right? Aren't they running the same firmware?

joaofl avatar Nov 16 '23 09:11 joaofl

It looks exactly the same, right? Aren't they running the same firmware?

i dont know because i don't have that from ONNDO this from AVATTO is on battery

At expose i saw there are same if i compare

Liionboy avatar Nov 16 '23 10:11 Liionboy

@Liionboy I'm using you converter but the calibration still can't be set through the z2m. It displays the values which is set on the device, tho. Also do you know what is the reason of the time and day reset? I can help with MR and code but don't know what exactly is needed

andrejsoucek avatar Nov 17 '23 17:11 andrejsoucek

@Koenkk are you able to help here? I tried the hy_set_time_request code from this post https://github.com/Koenkk/zigbee2mqtt/issues/10489#issuecomment-1312817478 and now I'm trying onEvent: tuya.onEventSetTime, but after z2m restart the device always has time set to Thursday 0:00.

Can I somehow debug the device if it is asking for the date & time?

andrejsoucek avatar Nov 18 '23 20:11 andrejsoucek

Can you try with both onEvent: tuya.onEvent({timeStart: '2000'}), and onEvent: tuya.onEvent({timeStart: '1970'}),, also try to re-pair the device after that? (to force it to request a new time)

Koenkk avatar Nov 19 '23 06:11 Koenkk

Can you try with both onEvent: tuya.onEvent({timeStart: '2000'}), and onEvent: tuya.onEvent({timeStart: '1970'}),, also try to re-pair the device after that? (to force it to request a new time)

Thanks! 1970 works and the time is now synced! I have now noticed another issue - the debug log is flooded with Debug 2023-11-19 15:25:24Received Zigbee message from 'Termostat', type 'commandMcuVersionResponse', cluster 'manuSpecificTuya', data '{"seq":8475,"version":255}' from endpoint 1 with groupID 0 Debug 2023-11-19 15:25:24No converter available for 'ZWT198' with cluster 'manuSpecificTuya' and type 'commandMcuVersionResponse' and data '{"seq":8475,"version":255}' And it seems I fixed it by adding fz.ignore_tuya_set_time to fromZigbee array. Not sure if it is ok or it conflicts with something?

andrejsoucek avatar Nov 19 '23 14:11 andrejsoucek

The ignore is fine, could you make a pr to add support for this device?

Koenkk avatar Nov 19 '23 17:11 Koenkk

The ignore is fine, could you make a pr to add support for this device?

Sure, I can, but there is a possibility of 2 devices with the same fingerprint.. The current tuya.js is probably mentioning this device. We have this device with the same fingerprint as defined in the tuya.js. So my PR would probably break the owners of ONNDO thermostat...

EDIT: Actually the device description shows the image of our thermostat. https://www.zigbee2mqtt.io/devices/ZWT198.html I will create the PR and we can talk there if needed. EDIT2: https://github.com/Koenkk/zigbee-herdsman-converters/pull/6511

andrejsoucek avatar Nov 19 '23 18:11 andrejsoucek

With battery will be great if we discover how to configure

Liionboy avatar Nov 19 '23 19:11 Liionboy