dresden-elektronik / deconz-rest-plugin

deCONZ REST-API plugin to control ZigBee devices
BSD 3-Clause "New" or "Revised" License
1.89k stars 490 forks source link

Tuya Thermostat (HY368 Zigbee Radiator Actuator) #4401

Closed poiuztr123 closed 3 years ago

poiuztr123 commented 3 years ago

Screenshots

image

image

image

I saw in other issues that people have been able to pair the HY368 TS0601 with deconz and phoscon. However, I can't pair it in phoscon and there is no Thermostat cluster in Deconz. I am wondering if this is because the Manufacturer identifier is slightly different (different letters behind TZE200_...) compared to the other posts.

Am I doing something wrong? Can anybody help?

h3llh0und commented 3 years ago

Ok, now some Attributes are gone. Now i see a lot of these in Log for the first Minutes after i reconnected: 15:35:57:486 Tuya debug 1 : Time sync request 15:35:57:488 Send Tuya command 0x24, data: 0000604e2d5d604e2d5d

I tried to change temperature but nothin happens on Thermostat: 15:36:06:282 Send Tuya request: Dp_type: 0x02, Dp_identifier 0x10, data: 00000190 15:36:07:981 Tuya debug 1 : Time sync request 15:36:07:982 Send Tuya command 0x24, data: 0000604e2d67604e2d67 15:36:07:984 delay sending request 204 dt 1 ms to 0x847127FFFE9642E3, ep: 0x01 cluster: 0xEF00 onAir: 1 15:36:08:002 delay sending request 204 dt 1 ms to 0x847127FFFE9642E3, ep: 0x01 cluster: 0xEF00 onAir: 1 15:36:08:098 delay sending request 204 dt 2 ms to 0x847127FFFE9642E3, ep: 0x01 cluster: 0xEF00 onAir: 1 15:36:08:198 delay sending request 204 dt 2 ms to 0x847127FFFE9642E3, ep: 0x01 cluster: 0xEF00 onAir: 1 15:36:13:263 Tuya debug 1 : Time sync request 15:36:13:264 Send Tuya command 0x24, data: 0015604e2d6d604e2d6d 15:36:18:519 Tuya debug 4 : Address 0x847127FFFE9642E3 Payload 00222202000400000092 15:36:18:520 Tuya debug 5 : Status: 0 Transid: 34 Dp: 546 (0x02,0x22) Fn: 0 Data 146

And when i change temperature on Thermostat nothing happens to level.temperature value. I changed on Thermostat from 20° to 21° and i saw some entries in Log: 15:49:41:986 Tuya debug 4 : Address 0x847127FFFE9642E3 Payload 00222202000400000095 15:49:41:986 Tuya debug 5 : Status: 0 Transid: 34 Dp: 546 (0x02,0x22) Fn: 0 Data 149 15:49:52:470 Tuya debug 4 : Address 0x847127FFFE9642E3 Payload 0069690200040000002a 15:49:52:471 Tuya debug 5 : Status: 0 Transid: 105 Dp: 617 (0x02,0x69) Fn: 0 Data 42 15:50:02:990 Tuya debug 4 : Address 0x847127FFFE9642E3 Payload 00222202000400000096 15:50:02:991 Tuya debug 5 : Status: 0 Transid: 34 Dp: 546 (0x02,0x22) Fn: 0 Data 150 But i am not 100% sure if these are all Messages for that change.

I changed mode to manual on thermostat than i had a heat in the status field. When i changed it back to auto in iobroker thermostat showed auto. So this is working :)

I changed to heat in iobroker this happens in log: 15:52:01:783 Send Tuya request: Dp_type: 0x04, Dp_identifier 0x02, data: 01 15:52:05:001 Tuya debug 4 : Address 0x847127FFFE9642E3 Payload 00020204000101 15:52:05:002 Tuya debug 5 : Status: 0 Transid: 2 Dp: 1026 (0x04,0x02) Fn: 0 Data 1 And Thermostat switched to manual Mode.

And this is the log for switching back to auto 15:53:25:293 Send Tuya request: Dp_type: 0x04, Dp_identifier 0x02, data: 00 15:53:26:438 Tuya debug 4 : Address 0x847127FFFE9642E3 Payload 00020204000100 15:53:26:439 Tuya debug 5 : Status: 0 Transid: 2 Dp: 1026 (0x04,0x02) Fn: 0 Data 0

Smanar commented 3 years ago

15:35:57:486 Tuya debug 1 : Time sync request 15:35:57:488 Send Tuya command 0x24, data: 0000604e2d5d604e2d5d

This is used if your device have time displayed

15:49:41:986 Tuya debug 5 : Status: 0 Transid: 34 Dp: 546 (0x02,0x22) Fn: 0 Data 149

No information about this command, but not used on Z2M

15:49:52:471 Tuya debug 5 : Status: 0 Transid: 105 Dp: 617 (0x02,0x69) Fn: 0 Data 42 changed on Thermostat from 20° to 21°

I think I have reversed the 2 mode, from that I m reading the device use

So have reversed both , and make the code compatible with both command, if I m still wrong you can reverse it in file rest_sensor.cpp around line 1280

New code online

h3llh0und commented 3 years ago

So i just played a bit around and had a look in the code. (What a loooong function :D)

You had a little error in line 1280, you used sensorNode instead of sensor.

There is something wrong with the calculation of the temperature i think. When i change it to 20° the display shows me 72°, 21° is 82°. Log for 20: 18:20:34:980 Send Tuya request: Dp_type: 0x02, Dp_identifier 0x69, data: 00000190 18:20:36:044 Tuya debug 4 : Address 0x847127FFFE9642E3 Payload 00181802000400000104 18:20:36:045 Tuya debug 5 : Status: 0 Transid: 24 Dp: 536 (0x02,0x18) Fn: 0 Data 260 21: 18:21:20:300 Send Tuya request: Dp_type: 0x02, Dp_identifier 0x69, data: 000001a4 18:21:23:281 Tuya debug 4 : Address 0x847127FFFE9642E3 Payload 006969020004000000a4 18:21:23:282 Tuya debug 5 : Status: 0 Transid: 105 Dp: 617 (0x02,0x69) Fn: 0 Data 164

I saw that you divide by 10 in other Thermostats so i tried this out but then i get for 20° ~5°. It is normal that heatsetpoint for 20° is a value of 200? My last programming in c++ was a long time ago, so i hope you have an idea.

Smanar commented 3 years ago

Yep, probably a convertion error between all tuya mode.

Have corrected the code (I hope)

h3llh0und commented 3 years ago

Nice :) Now it looks good :) Okay * 2 / 10 :D

Now its in sync. And if i change temperature at thermostat its synced back and i see the right Value. Then i can start playing around tomorrow with my window and temperature sensor :)

Smanar commented 3 years ago

@h3llh0und nothing special ? can make the PR ?

h3llh0und commented 3 years ago

@Smanar No, everything working fine :) So you can do a PR. 👍

KMDobrev commented 3 years ago

Hello, I have HY 368 Radiator Actuators from Moes brand. I use them on Home Assistant with Conbee 2. But there are no "Valve Settings" and "Keylock" options. Is there any way to add them?

Smanar commented 3 years ago

Hello, not all device are same, even they are same model. Do you have the manufacture name of your device ? Or better direclty the JSON.

KMDobrev commented 3 years ago

Hello, not all device are same, even they are same model. Do you have the manufacture name of your device ? Or better direclty the JSON.

Hello,

IMG_20210730_180230__01

Screenshot_20210730-180520 Screenshot_20210730-180846__01

Smanar commented 3 years ago

Ok so you are right, for the model _TZE200_ywdxldoj you need to have

Can you take a look in the device JSON, you can find it here http://phoscon.de/pwabeta on help / Api information / sensors

KMDobrev commented 3 years ago

Ok so you are right, for the model _TZE200_ywdxldoj you need to have

  • mode
  • statevalve
  • config lock
  • preset too ????
  • windows open

Can you take a look in the device JSON, you can find it here http://phoscon.de/pwabeta on help / Api information / sensors

{ "config": { "heatsetpoint": 1950, "locked": false, "mode": "off", "offset": -100, "on": true, "preset": "manual", "reachable": false, "schedule": {}, "schedule_on": false, "setvalve": false, "windowopen_set": false }, "ep": 1, "etag": "fbde75e0f94b9f8f68850c5d747d42a5", "lastseen": null, "manufacturername": "_TZE200_ywdxldoj", "modelid": "TS0601", "name": "Thermostat 41", "state": { "lastupdated": "2021-07-29T17:39:55.147", "lowbattery": false, "on": false, "temperature": 2350, "valve": 0 }, "type": "ZHAThermostat", "uniqueid": "84:71:27:ff:fe:1f:2e:f0-01-0201" }

Smanar commented 3 years ago

The problem is perhaps from HA

"setvalve": false,
"locked": false,

When they are not working the value is more "null", and BTW I have someone else that have not all "setting", there is perhaps something else to configure ? https://github.com/dresden-elektronik/deconz-rest-plugin/issues/5153#issuecomment-887720635

KMDobrev commented 3 years ago

The problem is perhaps from HA

"setvalve": false,
"locked": false,

When they are not working the value is more "null", and BTW I have someone else that have not all "setting", there is perhaps something else to configure ? #5153 (comment)

I'm sorry for the late reply. There is nothing else to configure. Does anyone else have these?

boldiebold commented 2 years ago

I have the same device just with a slightly other manucfactor Bildschirmfoto 2021-09-30 um 17 19 10

IMG_1932

It´s not recognized by phoscom. Can you please add Thanks

PastCoder commented 1 year ago

Hi @Smanar I saw that you added support for a MOES TRV. I just bought as well one but it seems to be different from the above. Maybe it is we well just another name for the same device. Which info would you need to check if it could be added easily? I can see the device in the deconz GUI but not in Conbee Web App and not in the API Info for REST API.

Smanar commented 1 year ago

Hello, not possible adding new tuya TRV ATM. We need to use DDF for new device, and not enabled yet for Tuya trv.