Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
12.15k stars 1.68k forks source link

TS0601_soil_2 (_TZE284_sgabhwa6) soil sensor battery is linked to its temperature #23729

Open shift-del1 opened 2 months ago

shift-del1 commented 2 months ago

What happened?

The battery level is wrong, changing its value together with the temperature. In the official Tuya app it is working fine.

Screenshot_2024-08-21-23-31-37-038_com android chrome

What did you expect to happen?

I expect to see the real battery level values. See the one from the official Tuya app:

Screenshot_2024-08-21-23-57-47-237_com tuya smart

How to reproduce it (minimal and precise)

Just check the actual values + history.

Zigbee2MQTT version

1.39.1

Adapter firmware version

0x26780700

Adapter

ConBee2/RaspBee2

Setup

Add-on on Home Assistant OS on virtualized x86-64 PC (Proxmox 8.2.4))

Debug log

No response

nprez83 commented 1 month ago

Hi @shift-del1, we've been trying to work through this problem in #23260, with no luck. Since you have the device added to your Tuya account, could you please check in the Tuya developer site what the correct data points are? Not sure if you've done it before, but here are the instructions just in case. I don't have a Tuya hub, so I can't add the device through the SmartLife app to confirm the DPs myself. DP 15 is what the converter is currently using for battery, but that's clearly not working. This may help point us in the right direction.

shift-del1 commented 1 month ago

Hi @nprez83,

First of all, thank you for helping to fix the issue. Please find attached the DPs, 18 all together.

eu.platform.tuya.com-1727715800513.log

nprez83 commented 1 month ago

Thanks @shift-del1. Looks like DP14 and 15 are both labeled Battery level, so still unclear to me which of them is supposed to be used for battery. Could you try to get the DPs a slightly different way please? God to API Explorer -> Device Control -> Query Properties, and plug in your device ID. See an example below for one of my devices. I like that way as it lists the DP number, but also the type of variable and the current state, which may be useful in sorting this out.

image

shift-del1 commented 1 month ago

I'd love to, but my trial period expired and my only choice is to pay 25k or 50k for a license:

"msg": "No permissions. Your subscription to cloud development plan has expired.",

By the way this was the method I was familiar with. Any other option to try?

update: applied for an extension of the trial period based on this description: https://support.tuya.com/en/help/_detail/Kc3n6kr7kllhc

nprez83 commented 1 month ago

That's interesting, I was under the impression that it's free indefinitely, but perhaps only if you registered before 2021 (see here). Hopefully they'll renew it so we can get to the bottom of this.

shift-del1 commented 1 month ago

Hello @nprez83,

Tuya platform was really fast, my trial is extended. Here is the log:

{
  "result": {
    "properties": [
      {
        "code": "humidity",
        "custom_name": "",
        "dp_id": 3,
        "time": 1727729758665,
        "type": "value",
        "value": 14
      },
      {
        "code": "temp_current",
        "custom_name": "",
        "dp_id": 5,
        "time": 1727729758665,
        "type": "value",
        "value": 233
      },
      {
        "code": "temp_unit_convert",
        "custom_name": "",
        "dp_id": 9,
        "time": 1727714405935,
        "type": "enum",
        "value": "f"
      },
      {
        "code": "battery_state",
        "custom_name": "",
        "dp_id": 14,
        "time": 1727714505306,
        "type": "enum",
        "value": "high"
      },
      {
        "code": "battery_percentage",
        "custom_name": "",
        "dp_id": 15,
        "time": 1727714505444,
        "type": "value",
        "value": 100
      },
      {
        "code": "temp_alarm",
        "custom_name": "",
        "dp_id": 101,
        "time": 1727714406436,
        "type": "enum",
        "value": "cancel"
      },
      {
        "code": "hum_alarm",
        "custom_name": "",
        "dp_id": 102,
        "time": 1727714406560,
        "type": "enum",
        "value": "loweralarm"
      },
      {
        "code": "maxtemp_set",
        "custom_name": "",
        "dp_id": 103,
        "time": 1727714406683,
        "type": "value",
        "value": 400
      },
      {
        "code": "minitemp_set",
        "custom_name": "",
        "dp_id": 104,
        "time": 1727714505956,
        "type": "value",
        "value": 100
      },
      {
        "code": "maxhum_set",
        "custom_name": "",
        "dp_id": 105,
        "time": 1727714406813,
        "type": "value",
        "value": 70
      },
      {
        "code": "minihum_set",
        "custom_name": "",
        "dp_id": 106,
        "time": 1727714406813,
        "type": "value",
        "value": 20
      },
      {
        "code": "temp_sensitivity",
        "custom_name": "",
        "dp_id": 107,
        "time": 1727714506226,
        "type": "value",
        "value": 5
      },
      {
        "code": "hum_sensitivity",
        "custom_name": "",
        "dp_id": 108,
        "time": 1727714406945,
        "type": "value",
        "value": 2
      },
      {
        "code": "report_sensitivity",
        "custom_name": "",
        "dp_id": 109,
        "time": 1727714407080,
        "type": "value",
        "value": 5
      },
      {
        "code": "temp_current_f",
        "custom_name": "",
        "dp_id": 110,
        "time": 1727729758665,
        "type": "value",
        "value": 739
      },
      {
        "code": "temp_sensitivity_f",
        "custom_name": "",
        "dp_id": 111,
        "time": 1727714506226,
        "type": "value",
        "value": 329
      },
      {
        "code": "maxtemp_set_f",
        "custom_name": "",
        "dp_id": 112,
        "time": 1727714506614,
        "type": "value",
        "value": 1040
      },
      {
        "code": "minitemp_set_f",
        "custom_name": "",
        "dp_id": 113,
        "time": 1727714506614,
        "type": "value",
        "value": 500
      }
    ]
  },
  "success": true,
  "t": 1727732712111,
  "tid": "452c2a3f7f7511efb77736033862a1ba"
}

Let me know if you need anything else.

shift-del1 commented 1 month ago

I attached 2 screenshots which could help to understand the values from my previous log. The screenshots were taken a couple minutes later, so maybe they are not representing the datapoints' values.

Screenshot_20241001-002817

Screenshot_20241001-002859

nprez83 commented 1 month ago

Ok, I think I'm realizing what's going on. The device just does not seem to ever publish the battery status. I've had the device set up for several days, so it's not fixed by waiting. Here is the state as published by the device:

z2m: Received Zigbee message from 'Front yard soil sensor', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,0],"type":"Buffer"},"datatype":2,"dp":3},{"data":{"data":[0,0,0,212],"type":"Buffer"},"datatype":2,"dp":5},{"data":{"data":[0,0,2,189],"type":"Buffer"},"datatype":2,"dp":110}],"seq":62465}' from endpoint 1 with groupID 0

As you can see, the device reports DP3 (humidity), DP 5 (temperature), and DP 110 (temperature_f). DP 15 is never reported. The other DPs are reported after you've set them (sensitivities, etc), but for the purposes of this test I left them unset.

@baggiowu, any idea why the device never publishes DP 15?