Hi folks,
I would have been interested in Cayenne from MyDevices.com.
It provides a configurable dashboard from MQTT data and is at the same time MQTT broker.
But I have made following unpleasant experience:
The examples given run this during setup()
Cayenne.begin(username, password, clientID, ssid, wifiPassword);
I don't appreciate at all to let a commercial third party open my own WiFi session receiving my credentials.
What are they doing with this info?
After some testing I found out, that you can manage the WiFi session with your own code and invoke
Cayenne.begin(..)
without WiFi credentials. I would strongly recommend to do so!
But the hammer is that the
Cayenne.loop()
system call, must be in loop and takes a whopping 1200mS to run, blocking everything else!
Without even any data processed!
That would have been fully inacceptable for me.
What is your experience about that?
Regards.
What are they doing during that time?
I don't appreciate at all to let a commercial third party open my own WiFi session receiving my credentials. What are they doing with this info?
Have you reviewed the library code?
If not use Ctrl+K to show sketch folder (or menu item Sketch>>Show Sketch Folder).
Here you will see that the use of Cayenne.begin(username, password, clientID, ssid, wifiPassword); is merely a wrapper that incorporates what you would do with using your own wifi library connection routine and then using Cayenne.begin();
Then if you do a code search for loop() it will reveal the following:
/**
* Main Cayenne loop
*
* @param yieldTime Time in milliseconds to yield to allow processing of incoming MQTT messages and keep alive packets.
* NOTE: Decreasing the yieldTime while calling write functions (e.g. virtualWrite) in your main loop could cause a
* large number of messages to be sent to the Cayenne server. Use caution when adjusting this because sending too many
* messages could cause your IP to be rate limited or even blocked. If you would like to reduce the yieldTime to cause your
* main loop to run faster, make sure you use a timer for your write functions to prevent them from running too often.
*/
void loop(int yieldTime = 1000)
Hope that helps.
Thank you.
I finally found it in Arduino\libraries\CayenneMQTT\src.
So Cayenne.loop() is mainly a 1sec yield() + call for pollVirtualChannels().
I don't currently need any of these functions: I have provided more than enough yields distributed all over my code and am pushing the MQTT messages at my own pace.
So in your case, just use a timer for any write functions to prevent them from running too often and reduce their yield by using something like loop(10) { ... }
I have an extended scheduler runnning tasks at precise paces + giving yields every 125mS.
I will send one MQTT message every second + some other messages every hour.