I’m developing an esp8266-based device that will send data to Cayenne. Using the MQTT connection works well, but sending data once per hour will result in almost 4kB traffic per hour. That’s not much compared to web browsing, but it is a lot when paying for every kilobyte which is the case for many M2M sim cards.
I understand that MQTT isn’t really suitable when targeting very low bandwidth usage. The CayenneLPP library looks great, but I am unable to find out how to use it over a GPRS connection since it seems intended primarily for LPWAN.
Does Cayenne have a non-MQTT API that I haven’t found? Are there any other options for minimizing bandwidth usage?
@eptak may be able to comment here
My suggestion would be to only connect to the server to send the data when you need to and then immediately disconnect, or using the sleep function would achieve the same result. Calling the loop function tells the server you are still there and that uses data. I have a post over here that uses sleep.
Thanks @adam. Doing that got bandwidth usage down to 2.5kB per message. An improvement of about 35% when sending once per hour. Not close to what can be done with the LPP library, but I guess we now know the lower limit when using MQTT.
As a comparison, doing a HTTPS request needs 3kB (can be more if certificates and revocation lists are checked) and a HTTP request needs 1kB. This was measured with wget to localhost on a linux machine and counting the bytes that hit the lo interface.
So if there was a way to push data to Cayenne using HTTP GET or POST, I would be able to shave off another ~60% of the bandwidth. But there is no such option, right?
There is the REST API now, but documentation is not great yet. Here is a post that does a good job explaining the basics
The post you linked is good, but it is unfortunately about creating an end-user app that shows data fetched from the API. I want to push data into Cayenne. This seems to be possible with cayenne-api-http-api-reference-api-things-sending-a-command-to-a-mqtt-channel-through-http-api
I wholeheartedly agree that the documentation isn’t great yet.
However, many of the bugs are covered in this thread: Integration of JSON data from HTTP/S API
I am currently working through the bugs one by one to try to get something working.
Hopefully this can save others some time.