New Event - MQTT Publish

Started by kni, April 11, 2022, 11:25:59 AM

Felix

And require('mqtt') requires ... the mqtt package to be installed during install then?

kni

Yes, this code requires the node mqtt package.

There are a ton of client options the mqtt library supports such as username, password, tls, self signed cert support, reconnect time, qos, the list goes on.
https://github.com/mqttjs/MQTT.js#client


Personally I don't mind configuring the options directly in the .js file, but if Felix is going to officially support mqtt publishing, then it would make sense to add some of these to the settings menu, so the masses can more easily enable this feature. If Felix is willing and we can all agree on what options to support, I can do the work and submit a pr to the github repo. Thoughts?



Lukapple

Or you can add instructions how to manually install the mqtt dependency package of user wants to use the mqtt event. I personally think that mqtt odd a must in IoT world.

Felix

I prefer not to fill the settings page with anything that is specific to a package required in a metrics file, at least at the moment.
Also, any require() in metrics file would break the application if that package is not already installed when the app starts up.
This is the only time MQTT has come up, and I can see how it can be useful. If there is a way to keep it as an add-on and not baked into the main app core, then I would be very open to include it.