-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MQTT suport for sending data #19
base: beta
Are you sure you want to change the base?
Conversation
* 'beta' of https://github.com/nettigo/namf: Fix for platformio 5 compatibility NAMF-2020-34rc4 missing return - enable NetworkWatchdog and code will be run for NW and SHT3x
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. 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 |
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.