Something is wrong with Tuya tank level sensors with the new official integration

I have connected my Tuya account with the Tuya integration of Home Asistant following the directions. Everything is fine. I see the 2 Tuya devices in my house: a light bulb and an ultrasonic water tank level sensor.
But the problem is that it doesn’t “see” any entity of the water tank level sensor device and moreover, in the device view of the Tuya integration the sensor appears with its name and the label “(unsupported)”

I have downloaded the device diagnostic file from the device information page, and surprisingly, in the downloaded json if appears information of the entities and even values of the last readings that correspond to real and reliable data, identical to the values that I observe in the Tuya Smart app. Look at “status” section at the end of the json.

I attach a piece of the diagnostic json below:

{
  "home_assistant": {
    "installation_type": "home_assistant_OS",
    "version": "2024.2.1",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.12.1",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/Madrid",
    "os_name": "Linux",
    "os_version": "6.1.74-haos",
    "supervisor": "2024.01.1",
    "host_os": "home_assistant_os 11.5",
    "docker_version": "24.0.7",
    "chassis": "embedded",
    "run_as_root": true.
  },
"integration_manifest": {
    "domain": "tuya",
    "name": "Tuya",
    "codeowners": [
      "@Tuya",
      "@zlinoliver",
      "@frenck"
    ],
    "config_flow": true,
    "dependencies": [
      "ffmpeg"
    ],
    "dhcp": [
      {
        "macaddress": "105A17*"
      },
      {
        "macaddress": "10D561*"
      },
      {
        "macaddress": "1869D8*"
      },
      {
        "macaddress": "381F8D*"
      },
      {
        "macaddress": "508A06*"
      },
      {
        "macaddress": "68572D*"
      },
      {
        "macaddress": "708976*"
      },
      {
        "macaddress": "7CF666*"
      },
      {
        "macaddress": "84E342*"
      },
      {
        "macaddress": "D4A651*"
      },
      {
        "macaddress": "D81F12*"
      }
    ],
    "documentation": "https://www.home-assistant.io/integrations/tuya",
    "integration_type": "hub",
    "iot_class": "cloud_push",
    "loggers": [
      "tuya_iot"
    ],
    "requirements": [
      "tuya-device-sharing-sdk==0.1.9"
    ],
    "is_built_in": true
  },
  "data": {
    "endpoint": "https://apigw.tuyaeu.com",
    "terminal_id": "17078*******7fVh5WF",
    "mqtt_connected": true,
    "disabled_by": null,
    "disabled_polling": false,
    "id": "bf27a4********368f4w",
    "name": "Nivel del tanque A",
    "category": "ywcgq",
    "product_id": "wtzwyhkev3b4ubns",
    "product_name": "Tank A Level",
    "online": true,
    "sub": false,
    "time_zone": "+01:00",
    "active_time": "2024-01-05T10:22:24+00:00",
    "create_time": "2024-01-05T10:22:24+00:00",
    "update_time": "2024-01-05T10:22:24+00:00",
    "function": {
      "max_set": {
        "type": "Integer",
        "value": {
          "unit": "%",
          "min": 0,
          "max": 100,
          "scale": 0,
          "step": 1
        }
      },
      "mini_set": {
        "type": "Integer",
        "value": {
          "unit": "%",
          "min": 0,
          "max": 100,
          "scale": 0,
          "step": 1
        }
      },
      "installation_height": {
        "type": "Integer",
        "value": {
          "unit": "m",
          "min": 200,
          "max": 2500,
          "scale": 3,
          "step": 1
        }
      },
      "liquid_depth_max": {
        "type": "Integer",
        "value": {
          "unit": "m",
          "min": 100,
          "max": 2400,
          "scale": 3,
          "step": 1
        }
      }
    },
    "status_range": {
      "liquid_state": {
        "type": "Enum",
        "value": {
          "range": [
            "normal",
            "lower_alarm",
            "upper_alarm"
          ]
        }
      },
      "liquid_depth": {
        "type": "Integer",
        "value": {
          "unit": "m",
          "min": 0,
          "max": 10000,
          "scale": 2,
          "step": 1
        }
      },
      "max_set": {
        "type": "Integer",
        "value": {
          "unit": "%",
          "min": 0,
          "max": 100,
          "scale": 0,
          "step": 1
        }
      },
      "mini_set": {
        "type": "Integer",
        "value": {
          "unit": "%",
          "min": 0,
          "max": 100,
          "scale": 0,
          "step": 1
        }
      },
      "installation_height": {
        "type": "Integer",
        "value": {
          "unit": "m",
          "min": 200,
          "max": 2500,
          "scale": 3,
          "step": 1
        }
      },
      "liquid_depth_max": {
        "type": "Integer",
        "value": {
          "unit": "m",
          "min": 100,
          "max": 2400,
          "scale": 3,
          "step": 1
        }
      },
      "liquid_level_percent": {
        "type": "Integer",
        "value": {
          "unit": "%",
          "min": 0,
          "max": 100,
          "scale": 0,
          "step": 1
        }
      }
    },
    "status": {
      "liquid_state": "normal",
      "liquid_depth": 77,
      "max_set": 100,
      "mini_set": 10,
      "installation_height": 980,
      "liquid_depth_max": 140,
      "liquid_level_percent": 97
    },
    "home_assistant": {
      "name": "Nivel del tanque A",
      "name_by_user": null,
      "disabled": false,
      "disabled_by": null,
      "entities": []
    },
    "set_up": false,
    "support_local": true
  }
}

No entities on device. No logs. No nothing. Only the tag (unsupported) next to the name of the device.

As you can see on this screenshot of my phone, the values of “status” section on the diagnostic json are the same as in my iOS Tuya Smart app.

Hey Victor, it looks like it’s not currently supported in the built-in integration. I had limited success getting it to work with tuya-local, but it was super flaky. I’m working on a PR to get it officially supported: Comparing home-assistant:dev...randvoorhies:tuya-ywcgq-tank-level-sensor · home-assistant/core · GitHub

1 Like

Sounds great! Do you have any idea when it could be included in the main branch?

I’m also facing the same problem with the tank level sensor not supported, thanks @randvoorhies for working on a PR

I created a new Pull Request with the suggested changes from @randvoorhies.

See:

2 Likes

Thanks for getting this pushed through @sprofanter - I didn’t get any notifications from this thread for some reason.

I’m super interested to know how this works for others, as it’s been pretty flaky on my setup. The code delta is very straightforward so I’m pretty confident in it, but I’m not sure if the hardware is crappy or maybe something is weird with my networking setup.

Hey! Just asking here because I´m seeing you have been working on the integration through Tuya.
I have the zigbee version, currently trying to add it with zigbee2mqtt, any ideas on that or should I just ask on the zigbee2mqtt specific forum better?
thanks you in advance for anything n_n

Hello sprofanter,
I have exactly that problem with my tank level. How can I get these update / changes to my home assistant?
can you give me a “how to”, please

1 Like

Hello, I still have the problem. Can anybody help me?

Having same issue here, however the one I’m using is based on ME202W sensor. It’s category in diagnostics is “ywcgq”, same as for TLC2206, but ME202W probe is hanging at the end of wire and it is supposed to be located at the bottom of tank, measuring pressure, probe sends information using RS485 bus to main unit containing ESP with Tuya firmware.

Do you have any updates? Did you get it working in home assistant?

1 Like

Hooray, it works!

The manual and the forum have all the information - and yet, it took me a while to get it running. Here is my summary:

  1. Install the Tuya Smart app. (I am on Android)
  2. Power on the sensor. Press button twice to “switch bluetooth on” (pairing)
  3. Go to Bluetooth, so it is in discovery mode
  4. Phone and Sensor paired
  5. Open Tuya Smart app and “+” (add device). It found “TY”
  6. Tuya Smart asks for wifi password
  7. Configure the device on the smartphone (tank height, etc.)
  8. Tuya Smart should show measured values. Celebrate with a drink.
  9. In HA, install the Tuya Integration (not sure if this is needed) using the code from the Tuya Smart app (Me-Settings-Account and Security-User Code)
  10. In HA, install the Xtend Tuya Integration with the code
  11. Xtend Tuya found the device
  12. I deleted the Tuya Integration

Thank you Greek!
Perfect, it seems to work, now!
Great Job!

After some days of playing with Tuya ‘Tank A Level’ sensor - EPT Tech Smart TLC2206, here are 3 impressions, 4 questions, and 1 feature request:

  1. The device needs 9V power supply. Being lazy (avoiding to pull a cable) and smart, I thought a 9V block battery will do the trick. It does - for less than 12h when it is drained. Good enough for testing, but not more.
  2. Measured values appear pretty real time on the smartphone app. I watched the tank being drained for 1+ hours (because I had to stand next to the pump anyway). Pumping started at 1.40m and ended at 0.64 m.
  • Question #1: But I do not see these values transferred to HA. I have no explanation for this, other than as long as the sensor is somehow directly connected with my smartphone, the smartphone app is correctly updated, but the transfer to HA is not working. Could this be, @randvoorhies?
  1. HA recorded some funny spikes / obviously wrong measurements. 0,64 m (sometimes toggling to 0,65 m and back) is the correct value. The spikes seem totally irregular.

Pumping has ended before 5 PM. So the measurements with the spikes have reached HA after I walked away from the scene, and the sensor probably connected with the nearby wifi repeater rather than my smartphone (see Question #1). Question #2: Does that make sense?

The sensor is not perfectly flat (180°) to the water surface, but mounted a little bit “upwards” in the plastic lid of the tank. The manual says “don’t do it”, but the plastic is just not stiff. I couldn’t do better. Question #3: Does anyone have experience with this effect?

I believe the sensor is far enough from the tank wall. Just to answer a question that nobody has asked yet. :slight_smile:

And, no, it has not been raining, so the water level did not change. While I am writing this: Wife could have taken some water, with pump jumping on briefly - sending a little (really!) shock wave back into the tank. But there are far more spikes than water takings. Question #4: Does anyone have experience with this effect?

@randvoorhies, if the sensors sends outliers (spikes), could the integration deal with it and suppress these values? Of course, this can be done in a HA script, which is probably more painful for more people. Especially triggering alarms becomes a challenge if funny spikes come with the measured values. Some cases might be tricky to catch, e.g., between 7:00 PM and 7:15 PM, or 7:30 and 7:50. I can file a feature request if it makes sense.

Collecting 4.000+ L of water in 3h hours, if it really rains here… Sensors are better than Netflix.

Adding to my impression #1 above: No wonder, the 9V battery died soon.

image

https://www.eptsensor.com/Content/upload/pdf/202321312/Smart-TLC-2206.pdf?rnd=186 says “Normal State<100mA”.

400 mAh = 100 mA * 4h

@randvoorhies, I have a new theory from the following observation:

I disconnected the battery between measurements to avoid draining it too fast.
The above chart shows 4 measurements at around 1:30 PM, 2:00 PM, before 2:15 PM, and before 2:30 PM. Each has the spike mentioned in my previous post.

Zooming into the first of these 4:

0,65 m is the old value from the previous measurement, before disconnecting the battery.
1,80 m spike is my tank height
0,84 m is the first measurement
I conclude that the spike is a “calibration value”, which the sensor sends (wrongly, in my opinion)

Just to confirm, here is the second from the 4:

And the 3rd confirms the observation

Maybe, the funny spikes in the first part of the graph (12:00 PM - 1:00 PM) result from some power issue or re-calibration of the sensor. These spikes seem not to be “tank height 1,80 m” for some reason.

Feels like I hunted the bug.

Oh, one more thing regarding “impression #2, question #1”: All values nicely arrived in HA and on the smartphone at the same time (more or less). Not sure what was causing the issue in my previous post. @randvoorhies pls ignore this issue.

Tuya Smart app has energy saving-toggle, it changes real time measurement to something like every 5min. That should save lot of energy compared to realtime. Of course it won’t help if you really need real time, but for most user cases every 5 min is likely to be adequate sampling.