Open Havelock-Vetinari opened 4 years ago
Any plans to merge the PR?
Sorry for delay. We don't use MQTT by our self, so had to get through new topic for us. We'd like but there are some caveats.
Why memory impact is so important? Right now NAMF has 24-26 kB of free RAM. While it looks a lot, it is not :) For example config page can have 16 kB (depending on number of enabled sensors) and it is being build in memory. Add memory fragmentation and some required overhead for temporary variables and then each 200-500 bytes are important :)
So, we can merge MQTT support, but after two changes:
With this changes I can merge PR and move code under new scheduler. With change to use dynamic memory for PubSubClient I think memory impact will be acceptable.
Is this possible @Havelock-Vetinari ?
@Havelock-Vetinari BTW - do missing ifdef in language .h files have been a issue? In build process they are included only once, and don't see need for use ifdefs?
Hi! I will try to find some time this or maybe next. Removing units should not be a problem. @netmaniac can you provide me with some kind of documentation or hint for using scheduler? I can also try to add conditional compiling of MQTT support, so it may be an opt-in feature.
While working on this change, one thing catched my attention. Json structure is serialised to string after being gathered from sensor and then parsed back to json structure in sending functions. Is there any particular reason for this aproach?
@netmaniac can you provide me with some kind of documentation or hint for using scheduler? This will be described more with SDS moved to new scheduler, work is in progress.
While working on this change, one thing catched my attention. Json structure is serialised to string after being gathered from sensor and then parsed back to json structure in sending functions. Is there any particular reason for this aproach?
This is legacy from Lufdtaten firmware. Will look later for some more robust solution
Hi @Havelock-Vetinari @netmaniac I would love to see MQTT support in NAMF. Actually I've just been browsing the repo to see if it would be easy to add it myself. So, just some words of encouragement :)
This PR adds support for MQTT broker: Supports
Each sensor is exported to separate topic. Example:
Messages are not retained. If auth error occures, reconnecting while executing mqtt::loop is postponed for 1024 loops or until sending data is required.