Zigbee2mqtt: Added Tuya ME201WZ level sensor

Module purchased, connected to zigbee2mqtt easily, and I did a measurement test in a pot of water, it seems quite accurate (to the nearest cm, which will be sufficient for my tank).

In Gladys, the device is visible in the Zigbee integration, but only the linkquality value is handled.

In the expose in z2m, I have this :

{
    "installation_height": 1.6,
    "last_seen": "2025-05-04T07:09:01.854Z",
    "linkquality": 144,
    "liquid_depth": 0.94,
    "liquid_depth_max": 1.6,
    "liquid_level_percent": 58,
    "liquid_state": "normal",
    "max_set": 80,
    "mini_set": 20
}

Gladys should also retrieve ‹ liquid_depth › (expressed in meters), ‹ liquid_level_percent › (expressed in %), ‹ liquid_state › (which can take the values « low », « normal », « high »).

@pierre-gilles, @cicoub13, or others, is it possible to add them in a future version of Gladys? Thanks in advance :+1:

If you need more info, let me know…

4 Likes

@StephaneB Great, I’ll take a look, I’ll let you know if I have any questions :slight_smile:

Here’s the link to the device on Zigbee2mqtt:

1 Like

Hi @StephaneB :slight_smile:

I integrated this device in this PR:

Everything is handled, including the level state (low/normal/high), which you can use on the dashboard and in scenes! :smiley:

I built a Docker image:

gladysassistant/gladys:zigbee2mqtt-tuya-me201wz

Could you test it and tell me if it works for you?

2 Likes

I just ordered it, so I should be able to test the build this week with two tests lined up: my pellet stove and my water collectors :slight_smile:

1 Like

Thanks for your quick reply @pierre-gilles. I just need to check if I still have my old Zigbee USB dongle to install it on the old PC I recently used to test specific versions of Gladys (when you developed the if…then…else)…

Because I assume it’s not possible to install a Gladys ‹ specific version › alongside my production Gladys on my mini-PC since both rely on the same Zigbee USB dongle and the same zigbee2mqtt. Or you can guide me if it’s actually possible :wink:

:warning:I’m assuming you’re using Zigbee2mqtt automatically launched by Gladys.

I think it’s possible — start Gladys on your old PC (or even locally on your PC/Mac with Docker), and configure the Zigbee2mqtt integration so it talks to the mosquitto broker « IP_OF_YOUR_MINI_PC:1884 »

(I should point out I’ve never tested this, but I don’t see why it wouldn’t work :stuck_out_tongue: )

Of course I’m using zigbee2mqtt on my mini-pc, launched automatically by Gladys. So I’ll test your suggestion.

Ah, you’ll still need authentication :stuck_out_tongue:

On your mini-PC, open the file /var/lib/gladysassistant/zigbee2mqtt/z2m/configuration.yaml, by running:

cat /var/lib/gladysassistant/zigbee2mqtt/z2m/configuration.yaml

You should see at the top of the file:

mqtt:
  base_topic: zigbee2mqtt
  server: mqtt://localhost:1884
  user: gladys
  password: TON_MOT_DE_PASSE

Use the username and password :slight_smile:

I was struggling with that, I

1 Like

So the connection to the zigbee2mqtt of my production Gladys works perfectly. I added the sensor which appears correctly, with 6 indicators, and I used it in the dashboard.

Two minor issues noticed (screenshot of what I see in the dashboard below):

  • 4 indicators have exactly the same name ‹ level sensor ›
  • I don’t know what the 2 indicators displayed as sliders represent

Screenshot of my dashboard:
![image|355x499](upload://7ujCOuRI68I

And compared to your screenshot, I don’t have the unit (‹ m ›) displayed…

I tried looking in the « Devices » of the zigbee2mqtt integration to edit the different functions, but the device isn’t listed there. I don’t know if it’s a side effect of being connected to the remote MQTT broker…
I can find it in « Zigbee discovery », but even when I click « save » again, it doesn’t appear in « Devices »…

Thanks for the reply, I’ll check it right away :slight_smile:

It’s strange that you see sliders, if that’s the case it means Zigbee2mqtt reports that those attributes are in « read_only »: false… :thinking:

How does this device appear in Zigbee2mqtt?

Edit: About the meters, I found it — I was the one who got the unit wrong.

@StephaneB I made a new build with:

  • Fix for the unit (meter)
  • Creation of a custom feature type for this device to have personalized names

You need to pull/delete/recreate the container, then delete the device in Gladys / then re-create it from the discovery tab to get the changes :slight_smile:

Strange, I don’t see any change.

I updated by chaining the following commands: docker container stop … / docker container rm … / docker pull … (which did download a new copy) / docker run …

And then in Gladys I couldn’t delete the Zigbee device since it doesn’t appear in Devices in the Zigbee2mqtt integration (as indicated above), so I added it again from Device Discovery…

Am I missing a step on my side?

That’s very strange, you must be

Yes, I am indeed doing the steps in my test instance (which is, however, connected to the broker of my prod instance…)

To be more precise: on the computer where I ran the docker run of your devt version, I connect to localhost in the browser.

Otherwise, check your browser’s logs when you’re on the « Devices » view just to be sure there’s no crash, but I think there’s an installation issue.

No error in the browser console when I open the Devices view…

And I spot another bug: in the house settings, I can’t add rooms correctly. If I add P1 and P2 then click « add » and « save house », it looks ok. But if I leave the page and come back, the rooms are no longer listed. And if I add P1 again, I get an error saying « the room already exists ».

And as a consequence, in the zigbee2mqtt integration I was adding the device without selecting a room, which might explain why the device was added incorrectly?

But I can redo an installation if needed. What else should I do besides the docker rm and docker run that I’ve already done several times?

One possible cause: I had installed on this PC another version of devt (the « if…then…else » one), and today I only did docker rm + docker run with your new version. Is that insufficient to remove all traces of the previous installation, particularly the database