MQTT peristence - General questions

Hello!

Now that I got a Mosquitto server up and running a few general questions occured regarding the persistence feature. On my previous system i was using a MySQL db to save the items states after a reboot. I want to use Mosquitto now to provide a easy solution for my arduinos to communicate with OH.

  1. Do I need two items now? - one that sends a value to the broker (pub) for instance 10 °C set value for a thermostat and a second item (sub) that displays the value in my habpanel?

  2. After a reboot: will the clients automatically trigger a request to the server to get the data? I configured my broker to permanently store if i remember right.

  3. If I do need 2 items - is it worth transferring my old mysql persistence or should i run another server? I like to keep things clean.

No, you can publish and subscribe on the same item (HABpanel has nothing to do with mqtt and will display whatever value your item has)

MQTT persistence doesn’t work like that. After a reconnect to the broker, the broker will send the last payload received for that topic. I do not recommend that you use mqtt persistence for restoreonstartup. Use mapdb instead.

1 Like

thanks a lot for your answer! :slight_smile:
This helps