# Zigbee2mqtt: Added Tuya ME201WZ level sensor

**URL:** <https://community.gladysassistant.com/t/zigbee2mqtt-ajout-du-capteur-de-niveau-tuya-me201wz/9495>\
**Category:** Demandes livrées\
**Tags:** zigbee2mqtt, feature-integration\
**Created:** [May 4, 2025, 8:57am UTC](https://community.gladysassistant.com/t/zigbee2mqtt-ajout-du-capteur-de-niveau-tuya-me201wz/9495 "2025-05-04T08:57:17Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![StephaneB](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/stephaneb/32/15443_2.png) [@StephaneB](https://community.gladysassistant.com/u/StephaneB)\
**Post date:** [May 4, 2025, 8:57am UTC](https://community.gladysassistant.com/t/zigbee2mqtt-ajout-du-capteur-de-niveau-tuya-me201wz/9495/1 "2025-05-04T08:57:17Z")

</div>

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 :

```auto
{
    "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 ‹&nbsp;liquid\_depth&nbsp;› (expressed in meters), ‹&nbsp;liquid\_level\_percent&nbsp;› (expressed in %), ‹&nbsp;liquid\_state&nbsp;› (which can take the values «&nbsp;low&nbsp;», «&nbsp;normal&nbsp;», «&nbsp;high&nbsp;»).

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

If you need more info, let me know…

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [May 5, 2025, 6:54am UTC](https://community.gladysassistant.com/t/zigbee2mqtt-ajout-du-capteur-de-niveau-tuya-me201wz/9495/2 "2025-05-05T06:54:13Z")

</div>

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

Here’s the link to the device on Zigbee2mqtt:

> **[Tuya ME201WZ control via MQTT | Zigbee2MQTT](https://www.zigbee2mqtt.io/devices/ME201WZ.html)**
>
> Integrate your Tuya ME201WZ via Zigbee2MQTT with whatever smart home infrastructure you are using without the vendor's bridge or gateway.

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [May 5, 2025, 8:34am UTC](https://community.gladysassistant.com/t/zigbee2mqtt-ajout-du-capteur-de-niveau-tuya-me201wz/9495/3 "2025-05-05T08:34:29Z")

</div>

Hi @StephaneB 🙂

I integrated this device in this PR:

> <https://github.com/GladysAssistant/Gladys/pull/2286>
>
> \### Pull Request check-list
> 
> To ensure your Pull Request can be accepted as fa…st as possible, make sure to review and check all of these items:
> 
> \- \[x\] If your changes affects code, did your write the tests?
> \- \[x\] Are tests passing? (\`npm test\` on both front/server)
> \- \[x\] Is the linter passing? (\`npm run eslint\` on both front/server)
> \- \[x\] Did you run prettier? (\`npm run prettier\` on both front/server)
> \- \[x\] If you are adding a new features/services, did you run integration comparator? (\`npm run compare-translations\` on front)
> \- \[\] Did you test this pull request in real life? With real devices? If this development is a big feature or a new service, we recommend that you provide a Docker image to the community (\[french forum\](https://community.gladysassistant.com/)/\[english forum\](https://en-community.gladysassistant.com/)) for testing before merging.
> 
> \### Description of change
> 
> Add https://community.gladysassistant.com/t/zigbee2mqtt-ajout-du-capteur-de-niveau-tuya-me201wz/9495

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

 ![Screenshot 2025-05-05 at 09.55.58](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/d/9/d9dc2a3cc6aaff45ddff7be70abcde496a744e22.png)

 ![Screenshot 2025-05-05 at 10.04.25](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/1/0/108cc5f7717d7c4e6485a1a4a78ae5e9358d8dc0.png)  
 ![Screenshot 2025-05-05 at 10.04.51](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/9/7/97883483c3c09b8723b15de4a1dfc24a0709a494.png)

I built a Docker image:

```auto
gladysassistant/gladys:zigbee2mqtt-tuya-me201wz

```

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

---

<div class="post-metadata">

**Author:** ![mutmut](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/mutmut/32/14064_2.png) [@mutmut](https://community.gladysassistant.com/u/mutmut)\
**Post date:** [May 5, 2025, 8:49am UTC](https://community.gladysassistant.com/t/zigbee2mqtt-ajout-du-capteur-de-niveau-tuya-me201wz/9495/4 "2025-05-05T08:49:09Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![StephaneB](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/stephaneb/32/15443_2.png) [@StephaneB](https://community.gladysassistant.com/u/StephaneB)\
**Post date:** [May 5, 2025, 1:02pm UTC](https://community.gladysassistant.com/t/zigbee2mqtt-ajout-du-capteur-de-niveau-tuya-me201wz/9495/5 "2025-05-05T13:02:13Z")

</div>

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 ‹&nbsp;specific version&nbsp;› 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 😉

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [May 5, 2025, 1:06pm UTC](https://community.gladysassistant.com/t/zigbee2mqtt-ajout-du-capteur-de-niveau-tuya-me201wz/9495/6 "2025-05-05T13:06:52Z")

</div>

⚠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 «&nbsp;IP\_OF\_YOUR\_MINI\_PC:1884&nbsp;»

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

---

<div class="post-metadata">

**Author:** ![StephaneB](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/stephaneb/32/15443_2.png) [@StephaneB](https://community.gladysassistant.com/u/StephaneB)\
**Post date:** [May 5, 2025, 1:09pm UTC](https://community.gladysassistant.com/t/zigbee2mqtt-ajout-du-capteur-de-niveau-tuya-me201wz/9495/7 "2025-05-05T13:09:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [May 5, 2025, 1:12pm UTC](https://community.gladysassistant.com/t/zigbee2mqtt-ajout-du-capteur-de-niveau-tuya-me201wz/9495/8 "2025-05-05T13:12:54Z")

</div>

Ah, you’ll still need authentication 😛

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

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

```

You should see at the top of the file:

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

```

Use the username and password 🙂

---

<div class="post-metadata">

**Author:** ![StephaneB](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/stephaneb/32/15443_2.png) [@StephaneB](https://community.gladysassistant.com/u/StephaneB)\
**Post date:** [May 5, 2025, 1:24pm UTC](https://community.gladysassistant.com/t/zigbee2mqtt-ajout-du-capteur-de-niveau-tuya-me201wz/9495/9 "2025-05-05T13:24:08Z")

</div>

I was struggling with that, I

---

<div class="post-metadata">

**Author:** ![StephaneB](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/stephaneb/32/15443_2.png) [@StephaneB](https://community.gladysassistant.com/u/StephaneB)\
**Post date:** [May 5, 2025, 1:43pm UTC](https://community.gladysassistant.com/t/zigbee2mqtt-ajout-du-capteur-de-niveau-tuya-me201wz/9495/10 "2025-05-05T13:43:53Z")

</div>

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 ‹&nbsp;level sensor&nbsp;›
- I don’t know what the 2 indicators displayed as sliders represent

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

---

<div class="post-metadata">

**Author:** ![StephaneB](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/stephaneb/32/15443_2.png) [@StephaneB](https://community.gladysassistant.com/u/StephaneB)\
**Post date:** [May 5, 2025, 1:49pm UTC](https://community.gladysassistant.com/t/zigbee2mqtt-ajout-du-capteur-de-niveau-tuya-me201wz/9495/11 "2025-05-05T13:49:40Z")

</div>

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

I tried looking in the «&nbsp;Devices&nbsp;» 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 «&nbsp;Zigbee discovery&nbsp;», but even when I click «&nbsp;save&nbsp;» again, it doesn’t appear in «&nbsp;Devices&nbsp;»…

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [May 5, 2025, 1:50pm UTC](https://community.gladysassistant.com/t/zigbee2mqtt-ajout-du-capteur-de-niveau-tuya-me201wz/9495/12 "2025-05-05T13:50:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [May 5, 2025, 1:55pm UTC](https://community.gladysassistant.com/t/zigbee2mqtt-ajout-du-capteur-de-niveau-tuya-me201wz/9495/13 "2025-05-05T13:55:32Z")

</div>

It’s strange that you see sliders, if that’s the case it means Zigbee2mqtt reports that those attributes are in «&nbsp;read\_only&nbsp;»: false… 🤔

How does this device appear in Zigbee2mqtt?

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

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [May 5, 2025, 2:39pm UTC](https://community.gladysassistant.com/t/zigbee2mqtt-ajout-du-capteur-de-niveau-tuya-me201wz/9495/14 "2025-05-05T14:39:36Z")

</div>

@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 🙂

---

<div class="post-metadata">

**Author:** ![StephaneB](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/stephaneb/32/15443_2.png) [@StephaneB](https://community.gladysassistant.com/u/StephaneB)\
**Post date:** [May 5, 2025, 3:10pm UTC](https://community.gladysassistant.com/t/zigbee2mqtt-ajout-du-capteur-de-niveau-tuya-me201wz/9495/15 "2025-05-05T15:10:53Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [May 5, 2025, 3:31pm UTC](https://community.gladysassistant.com/t/zigbee2mqtt-ajout-du-capteur-de-niveau-tuya-me201wz/9495/16 "2025-05-05T15:31:32Z")

</div>

> [@StephaneB](#):
>
> 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),

That’s very strange, you must be

---

<div class="post-metadata">

**Author:** ![StephaneB](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/stephaneb/32/15443_2.png) [@StephaneB](https://community.gladysassistant.com/u/StephaneB)\
**Post date:** [May 5, 2025, 3:34pm UTC](https://community.gladysassistant.com/t/zigbee2mqtt-ajout-du-capteur-de-niveau-tuya-me201wz/9495/17 "2025-05-05T15:34:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [May 5, 2025, 3:36pm UTC](https://community.gladysassistant.com/t/zigbee2mqtt-ajout-du-capteur-de-niveau-tuya-me201wz/9495/18 "2025-05-05T15:36:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![StephaneB](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/stephaneb/32/15443_2.png) [@StephaneB](https://community.gladysassistant.com/u/StephaneB)\
**Post date:** [May 5, 2025, 4:02pm UTC](https://community.gladysassistant.com/t/zigbee2mqtt-ajout-du-capteur-de-niveau-tuya-me201wz/9495/19 "2025-05-05T16:02:45Z")

</div>

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 «&nbsp;add&nbsp;» and «&nbsp;save house&nbsp;», 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 «&nbsp;the room already exists&nbsp;».

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?

---

<div class="post-metadata">

**Author:** ![StephaneB](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/stephaneb/32/15443_2.png) [@StephaneB](https://community.gladysassistant.com/u/StephaneB)\
**Post date:** [May 5, 2025, 5:53pm UTC](https://community.gladysassistant.com/t/zigbee2mqtt-ajout-du-capteur-de-niveau-tuya-me201wz/9495/20 "2025-05-05T17:53:44Z")

</div>

One possible cause: I had installed on this PC another version of devt (the «&nbsp;if…then…else&nbsp;» 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

[Next page](https://community.gladysassistant.com/t/zigbee2mqtt-ajout-du-capteur-de-niveau-tuya-me201wz/9495.md?page=2)
