Page 1 of 2

MQTT plugin gets its settings lost on restart

Posted: 24 May 2021 02:22
by harre
Not sure where to report issues, I have added some previously on the github repo and haven't gotten any response.

https://github.com/Z-Wave-Me/zwave-smarthome/issues/286

Steps to reproduce:
1. Add MQTT so it shows up at
http://pi:8083/smarthome/#/apps/local
2. Configure app and save.
It shows now on active tab too
3. restart z-way server in terminal
sudo systemctl restart z-way-server.service

The active app is now gone and MQTT reporting have stopped and I need to readd it again

Re: MQTT plugin gets its settings lost on restart

Posted: 25 May 2021 02:55
by PoltoS
We are making a native MQTT support. Will be ready soon. So may be not worth to bother the author of the old app

Re: MQTT plugin gets its settings lost on restart

Posted: 25 May 2021 23:58
by harre
That's great news! Is there any beta version I can try out? :)

Re: MQTT plugin gets its settings lost on restart

Posted: 26 May 2021 11:24
by PoltoS
There is one, but with JS API only. Very soon (within two weeks) we will have the new easy configurable MQTT app made on top of this JS API.

https://storage.z-wave.me/z-way-server/ ... _armhf.deb

Re: MQTT plugin gets its settings lost on restart

Posted: 26 May 2021 20:50
by harre
Thanks for quick response, What can I do with the API and how do I use it?

I'm still quite the noob with js-development, but I have been coding .net for almost 15 years, but this project is so big so it's hard for me to grasp.

Is there any commit for the MQTT-api so I easier trace how to use it?

Re: MQTT plugin gets its settings lost on restart

Posted: 27 May 2021 02:03
by PoltoS
This is as simple as:

// constructor
var m = new mqtt(server, port);

// handlers
m.onconnect = function() {};
m.onmessage = function(topic, msg) {};
m.onsubscribe = function(topic) {};
m.onclose = function() {};

// methods
m.tlsset(ca_file, ca_path, cert_file, key_file);
m.connect();
m.publish(topic, message);
m.subscribe(topic);
m.unsubscribe(topic);
m.disconnect();

inside handlers (onXXXX use `this` instead of m)

Re: MQTT plugin gets its settings lost on restart

Posted: 27 May 2021 18:39
by PoltoS

Re: MQTT plugin gets its settings lost on restart

Posted: 28 May 2021 00:47
by harre
Thanks for the follow up, but I feel like before I even figure out how to put these pieces together you have already built the working MQTT solution :)

Thanks for the manual link, I'll try to get some time to get antiquated more with the system and try to write my own module

Re: MQTT plugin gets its settings lost on restart

Posted: 30 May 2021 20:05
by piet66
I like the fact that you now provide a MQTT api.
Unfortunately it comes too late for me. I am almost finished with my own MQTT module. :(

Re: MQTT plugin gets its settings lost on restart

Posted: 01 Jun 2021 02:19
by harre
Share the code and hopefully some parts can be incorporated :)