# Bug v4.17.0 Zigbee2MQTT?

**URL:** <https://community.gladysassistant.com/t/bug-v4-17-0-zigbee2mqtt/7965>\
**Category:** Développement\
**Created:** [February 13, 2023, 5:56am UTC](https://community.gladysassistant.com/t/bug-v4-17-0-zigbee2mqtt/7965 "2023-02-13T05:56:23Z")\
**Posts on this page:** 11\
**Page:** 3

<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:** [April 3, 2023, 9:43am UTC](https://community.gladysassistant.com/t/bug-v4-17-0-zigbee2mqtt/7965/41 "2023-04-03T09:43:03Z")

</div>

One option would be to enable persistence in Mosquitto:

> <https://stackoverflow.com/questions/36126725/how-to-retain-messages-in-mqtt-if-the-mosquitto-broker-goes-down/36126875#36126875>

What do you think?

---

<div class="post-metadata">

**Author:** ![AlexTrovato](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/alextrovato/32/10705_2.png) [@AlexTrovato](https://community.gladysassistant.com/u/AlexTrovato)\
**Post date:** [April 3, 2023, 9:52am UTC](https://community.gladysassistant.com/t/bug-v4-17-0-zigbee2mqtt/7965/42 "2023-04-03T09:52:39Z")

</div>

That seems to make sense to me!  
I just hope we won’t store too much.  
Otherwise we should see if there’s a way to set a maximum storage size…

---

<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:** [April 3, 2023, 9:54am UTC](https://community.gladysassistant.com/t/bug-v4-17-0-zigbee2mqtt/7965/43 "2023-04-03T09:54:25Z")

</div>

Persistence only stores retained messages (to be verified), so it won’t store much, I think 🙂

---

<div class="post-metadata">

**Author:** ![cicoub13](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/cicoub13/32/4482_2.png) [@cicoub13](https://community.gladysassistant.com/u/cicoub13)\
**Post date:** [April 4, 2023, 10:00am UTC](https://community.gladysassistant.com/t/bug-v4-17-0-zigbee2mqtt/7965/44 "2023-04-04T10:00:46Z")

</div>

I may be looking at the problem the wrong way, but wouldn’t it be up to Gladys to store that information?

---

<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:** [April 4, 2023, 10:48am UTC](https://community.gladysassistant.com/t/bug-v4-17-0-zigbee2mqtt/7965/45 "2023-04-04T10:48:15Z")

</div>

Indeed, that’s an option. That said, wouldn’t it be a shame to re-implement this behavior, which is probably used by Zigbee2mqtt in several places, where Mosquitto handles it natively?

I’d be more in favor of enabling persistence, which would avoid other bugs in the future if Zigbee2mqtt starts using that feature elsewhere.

---

<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:** [April 6, 2023, 5:23am UTC](https://community.gladysassistant.com/t/bug-v4-17-0-zigbee2mqtt/7965/46 "2023-04-06T05:23:20Z")

</div>

So I started a PR on the topic:

> <https://github.com/GladysAssistant/Gladys/pull/1731>
>
> \### 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:
> 
> \- \[\] If your changes affects code, did your write the tests?
> \- \[\] Are tests passing? (\`npm test\` on both front/server)
> \- \[\] Is the linter passing? (\`npm run eslint\` on both front/server)
> \- \[\] Did you run prettier? (\`npm run prettier\` on both front/server)
> \- \[\] 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\](https://community.gladysassistant.com/) for testing before merging.
> \- \[\] If your changes modify the API (REST or Node.js), did you modify the API documentation? (Documentation is based on comments in code)
> \- \[\] If you are adding a new features/services which needs explanation, did you modify the user documentation? See \[the GitHub repo\](https://github.com/GladysAssistant/v4-website) and the \[website\](https://gladysassistant.com).
> \- \[\] Did you add fake requests data for the demo mode (\`front/src/config/demo.js\`) so that the demo website is working without a backend? (if needed) See \[https://demo.gladysassistant.com\](https://demo.gladysassistant.com).
> 
> NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open.
> 
> \### Description of change
> 
> Activate persistence in MQTT to fix https://github.com/GladysAssistant/Gladys/issues/1730

I took the opportunity to remove the shell script that launched the container and switch to Node code. At least it’s tested now, and more reliable.

I also took the opportunity to address this issue:

> <https://github.com/GladysAssistant/Gladys/issues/1659>
>
> As we are trying to improve CI speed, some single tests are taking 10 seconds an…d could maybe be improved?
> 
> \*\*Example:\*\*
> 
> ✓ should saveConfiguration: init docker container no present (no user) (10008ms)

It greatly speeds up tests!

---

<div class="post-metadata">

**Author:** ![AlexTrovato](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/alextrovato/32/10705_2.png) [@AlexTrovato](https://community.gladysassistant.com/u/AlexTrovato)\
**Post date:** [April 6, 2023, 7:34am UTC](https://community.gladysassistant.com/t/bug-v4-17-0-zigbee2mqtt/7965/47 "2023-04-06T07:34:36Z")

</div>

Did you generate a test image?

---

<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:** [April 6, 2023, 7:38am UTC](https://community.gladysassistant.com/t/bug-v4-17-0-zigbee2mqtt/7965/48 "2023-04-06T07:38:04Z")

</div>

Yes, I’ve partially tested it for now but it seems to work!

Docker image:

```auto
gladysassistant/gladys:fix-zigbee2mqtt-disconnect-bug

```

---

<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:** [April 7, 2023, 2:25am UTC](https://community.gladysassistant.com/t/bug-v4-17-0-zigbee2mqtt/7965/49 "2023-04-07T02:25:03Z")

</div>

Tested in real conditions, the migration worked successfully!

```auto
2023-04-07T04:20:42+0200 \u003cinfo\u003e init.js:38 (Zigbee2mqttManager.init) Zigbee2mqtt USB dongle attached to /dev/ttyUSB0
2023-04-07T04:20:42+0200 \u003cinfo\u003e checkForContainerUpdates.js:14 (Zigbee2mqttManager.checkForContainerUpdates) Checking for current installed versions and required updates...
2023-04-07T04:20:42+0200 \u003cinfo\u003e checkForContainerUpdates.js:18 (Zigbee2mqttManager.checkForContainerUpdates) MQTT container: update #3 of the container required...
2023-04-07T04:20:42+0200 \u003cinfo\u003e checkForContainerUpdates.js:35 (Zigbee2mqttManager.checkForContainerUpdates) MQTT container: update #3 of the container done
2023-04-07T04:20:42+0200 \u003cinfo\u003e checkForContainerUpdates.js:40 (Zigbee2mqttManager.checkForContainerUpdates) Z2M container: update #3 of the container required...
2023-04-07T04:20:43+0200 \u003cinfo\u003e checkForContainerUpdates.js:57 (Zigbee2mqttManager.checkForContainerUpdates) Z2M container: update #3 of the container done
2023-04-07T04:20:43+0200 \u003cinfo\u003e installMqttContainer.js:29 (Zigbee2mqttManager.installMqttContainer) MQTT broker is being installed as Docker container...
2023-04-07T04:20:43+0200 \u003cinfo\u003e installMqttContainer.js:30 (Zigbee2mqttManager.installMqttContainer) Pulling eclipse-mosquitto:2 image...
2023-04-07T04:20:46+0200 \u003cinfo\u003e installMqttContainer.js:34 (Zigbee2mqttManager.installMqttContainer) Preparing broker environment...
2023-04-07T04:20:46+0200 \u003cinfo\u003e installMqttContainer.js:41 (Zigbee2mqttManager.installMqttContainer) Writing Mosquitto config file in /var/lib/gladysassistant/zigbee2mqtt/mqtt/mosquitto.conf
2023-04-07T04:20:46+0200 \u003cinfo\u003e installMqttContainer.js:50 (Zigbee2mqttManager.installMqttContainer) Creating container with data in "/var/lib/gladysassistant" on host...
2023-04-07T04:20:47+0200 \u003cinfo\u003e installMqttContainer.js:64 (Zigbee2mqttManager.installMqttContainer) MQTT broker is restarting...
2023-04-07T04:20:52+0200 \u003cinfo\u003e installMqttContainer.js:72 (Zigbee2mqttManager.installMqttContainer) Creating user/pass...
2023-04-07T04:20:53+0200 \u003cinfo\u003e installMqttContainer.js:81 (Zigbee2mqttManager.installMqttContainer) MQTT broker is restarting...
2023-04-07T04:20:59+0200 \u003cinfo\u003e installMqttContainer.js:86 (Zigbee2mqttManager.installMqttContainer) MQTT broker container successfully started and configured
2023-04-07T04:20:59+0200 \u003cinfo\u003e installZ2mContainer.js:34 (Zigbee2mqttManager.installZ2mContainer) Zigbee2mqtt is being installed as Docker container...
2023-04-07T04:20:59+0200 \u003cinfo\u003e installZ2mContainer.js:35 (Zigbee2mqttManager.installZ2mContainer) Pulling koenkk/zigbee2mqtt:latest image...
2023-04-07T04:21:02+0200 \u003cinfo\u003e installZ2mContainer.js:38 (Zigbee2mqttManager.installZ2mContainer) Configuration of Device /dev/ttyUSB0
2023-04-07T04:21:02+0200 \u003cinfo\u003e installZ2mContainer.js:43 (Zigbee2mqttManager.installZ2mContainer) Creation of container...
2023-04-07T04:21:03+0200 \u003cinfo\u003e installZ2mContainer.js:46 (Zigbee2mqttManager.installZ2mContainer) Zigbee2mqtt successfully installed and configured as Docker container
2023-04-07T04:21:03+0200 \u003cinfo\u003e installZ2mContainer.js:59 (Zigbee2mqttManager.installZ2mContainer) Preparing Zigbee2mqtt environment...
2023-04-07T04:21:03+0200 \u003cinfo\u003e installZ2mContainer.js:72 (Zigbee2mqttManager.installZ2mContainer) Zigbee2mqtt container is starting...
2023-04-07T04:21:08+0200 \u003cinfo\u003e installZ2mContainer.js:78 (Zigbee2mqttManager.installZ2mContainer) Zigbee2mqtt container successfully started
2023-04-07T04:21:08+0200 \u003cinfo\u003e connect.js:14 (Zigbee2mqttManager.connect) Connecting Gladys to mqtt://localhost:1884 MQTT broker...
2023-04-07T04:21:09+0200 \u003cinfo\u003e connect.js:24 (MqttClient.\u003canonymous\u003e) Connected to MQTT container mqtt://localhost:1884
2023-04-07T04:21:09+0200 \u003cinfo\u003e subscribe.js:12 (Zigbee2mqttManager.subscribe) Subscribing to MQTT topic zigbee2mqtt/#

```

Directory `/var/lib/gladysassistant/zigbee2mqtt/mqtt`:

 ![Screenshot 2023-04-07 at 10.26.07](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/6/654cc3b4f46d7a29c5e45809aa81cb40c6d91ada.jpeg)

Restarting Mosquitto no longer seems to bother Gladys! 🙂

---

<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:** [April 7, 2023, 2:29am UTC](https://community.gladysassistant.com/t/bug-v4-17-0-zigbee2mqtt/7965/50 "2023-04-07T02:29:52Z")

</div>

@AlexTrovato In principle there’s no risk of the disk growing noticeably:

 ![Screenshot 2023-04-07 at 10.28.13](https://gladys-assistant-community.b-cdn.net/uploads/default/original/2X/a/a1cb732a1875add727584351d5bbc08d77f017fe.png)

We’ll also gain reliability since if Mosquitto restarts while Gladys is offline and there are messages in the broker, we won’t lose them 🙂

---

<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:** [April 10, 2023, 5:09am UTC](https://community.gladysassistant.com/t/bug-v4-17-0-zigbee2mqtt/7965/51 "2023-04-10T05:09:00Z")

</div>

Bug fixed in Gladys Assistant v4.20:

> [@Gladys Assistant 4.20 & Redesign du site Gladys Assistant nail\_polish](https://community.gladysassistant.com/t/gladys-assistant-4-20-redesign-du-site-gladys-assistant/8080):
>
> Salut à tous ! J’ai plein de nouvelles pour vous aujourd’hui smile Redesign de la page d’accueil du site Je n’étais pas satisfait de la page d’accueil actuelle du site, et cela fait un bout de temps que je travaillais à sa refonte complète. C’est chose faite ! partying_face La page est plus complète : j’explique les fonctionnalités clés de Gladys ( avec des petites vidéos ), la philosophie du projet, les intégrations compatibles. La page est à jour : j…

[Previous page](https://community.gladysassistant.com/t/bug-v4-17-0-zigbee2mqtt/7965.md?page=2)
