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

RE: DDF for Tuya trv: Essentials, Revolt, Siterwell, Nedis... #8046

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mattreim
Copy link
Contributor

Reopened #7640 and #8015

My test device:
Essentials 12011
Essentials 12011

The information is from the following page zha-device-handlers.

Tuya-thermostat

Phoscon:
Thermostat

@mattreim
Copy link
Contributor Author

I hope it's the last time, thank you @Smanar.

@mattreim
Copy link
Contributor Author

mattreim commented Dec 21, 2024

Hello @Smanar, I noticed that Home Assistant doesn't really get along with config/preset and these devices only have three modes. Wouldn't it be better to use config/mode?

{
  "name": "config/mode",
  "parse": {
      "fn": "tuya",
      "dpid": 4,
      "eval": "if (Attr.val == 0) { Item.val = 'off' } else if (Attr.val == 1) { Item.val = 'auto' } else if (Attr.val == 2) { Item.val = 'heat' }"
   },
   "write": {
       "fn": "tuya",
       "dpid": 4,
       "dt": "0x30",
       "eval": "if (Item.val == 'off') { 0 } else if (Item.val == 'auto') { 1 } else if (Item.val == 'heat') { 2 }"
    },
    "read": {
         "fn": "none"
    }
},

@Smanar
Copy link
Collaborator

Smanar commented Dec 22, 2024

Right, on the orignal DDF they are using it, need to keep it (on dpid = 106).

And thoses device support both, mode and preset, mode is Heat/off/auto, preset have lot of more setting even all are not present on all device.

@mattreim
Copy link
Contributor Author

I just wanted to set config/mode to "dpid = 4" because "dpid = 106" didn't work on my device. There is also nothing here or here that says that the devices use both modes.

@Smanar
Copy link
Collaborator

Smanar commented Dec 22, 2024

So it mean you don't have the same device, becuse on native code all of thoses use the dpid 106

#define DP_IDENTIFIER_THERMOSTAT_MODE_1 0x6A // mode used with DP_TYPE_ENUM

                    else if (R_GetProductId(sensor) == QLatin1String("Tuya_THD HY369 TRV") ||
                             R_GetProductId(sensor) == QLatin1String("Tuya_THD HY368 TRV") ||
                             R_GetProductId(sensor) == QLatin1String("Tuya_THD GS361A-H04 TRV") ||
                             R_GetProductId(sensor) == QLatin1String("Tuya_THD Essentials TRV") ||
                             R_GetProductId(sensor) == QLatin1String("Tuya_THD NX-4911-675 TRV") ||
                             R_GetProductId(sensor) == QLatin1String("Tuya_THD MOES TRV"))
                    {
                        const auto match = matchKeyValue(data.string, RConfigModeValuesTuya1);

                        if (isValid(match))
                        {
                            QByteArray tuyaData = QByteArray::fromRawData(match.value, 1);
                            quint8 dpIdentifier = DP_IDENTIFIER_THERMOSTAT_MODE_1;

@mattreim
Copy link
Contributor Author

What should dpid 106 do?

@Smanar
Copy link
Collaborator

Smanar commented Dec 22, 2024

From that I m reading it's the "forced mode" 0x04 is the "classic mode"

// force mode 0 - normal, 1 - open, 2 - close

But idk why we are using this one. You can change the mode manualy on your device and look for return on deconz logs, you will see if your device use 0x04 or 0x6A.

@mattreim
Copy link
Contributor Author

After some testing I changed dpid 4 from config/preset to config/mode and it works exactly as expected. Of course config/preset also worked but the thermostat was always shown as off in Home Assistant.

Thermostat

@Smanar
Copy link
Collaborator

Smanar commented Dec 22, 2024

And it don't work with dpid = 106 ?
IDK how work HA, but preset have no impact on mode, values can be

switch (Attr.val) {
    case 0:
        Item.val = 'holiday';
        break;
    case 1:
        Item.val = 'auto';
        break;
    case 2:
        Item.val = 'manual';
        break;
    case 3:
        Item.val = 'comfort';
        break;
    case 4:
        Item.val = 'eco';
        break;
    case 5:
        Item.val = 'boost';
        break;
    case 6:
        Item.val = 'complex';
        break;
}

So yes can be same Holiday/auto/manual can be off/auto/heat.
I can see the code for some device, but I don't remember wich one TRV support it or not.

@mattreim
Copy link
Contributor Author

mattreim commented Dec 22, 2024

I tried it again with dpid 106 but it doesn't work. The device just turns on and nothing happens.

Thermostat

@Smanar
Copy link
Collaborator

Smanar commented Dec 22, 2024

The device just turns on and nothing happens.

It turn on ? so it works no ?

@mattreim
Copy link
Contributor Author

It is only optical in HA. It does not switch the device.

@mattreim
Copy link
Contributor Author

The device just turns on and nothing happens.

It turn on ? so it works no ?

Sorry, the display turns on and not the device.

@Smanar
Copy link
Collaborator

Smanar commented Dec 22, 2024

Ha yes, it's because the API is updated, if the device understand the request or not.

@mattreim
Copy link
Contributor Author

I also made this observation during testing and sometimes the devices can crash.

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

Successfully merging this pull request may close these issues.

2 participants