Getting updates from Cayenne 'devices'

I am very familiar with using ‘Bring your own thing’ to create a dashboard, publishing data to the dashboard using MQTT. I can also subscribe to each object on the dashboard to be informed, and keep my own record of, each value published.

My latest project is running nicely using a Raspberry Pi ‘device’ running Cayenne code to update the dashboard. Is there any way to retrieve the updates in real time, in a similar way to subscribing to MQTT traffic? This would work better for this project than the researchers I’m working with having to remember to manually download and archive data from the dashboard.

Yep! I have written and documented over a thousand lines of Python on that topic! Home · SteveCossy/IOT Wiki · GitHub

The current project has very modest requirements! One Raspberry Pi (RPi) sitting on the ground in the middle of a breeding population of endangered New Zealand native skinks. The Pi has four DS18B20 sensors attached to it. So far so good - go to the Cayenne dashboard and set up a RPi as a device. Temperatures magically appear on the dashboard! :slight_smile:
Problem is that my clients for this project want all of the stats from their sensors, indefinitely. Quite understandably, over time the Cayenne platform accumulates data, dropping detail, for our free account. The code you linked to, and my extensive infrastructure linked above, avoids this being a problem by subscribing to the project and keeping a copy offline.
What I’m asking is whether there is any way to keep the excellent sensor solution provided by Cayenne, while also being able to subscribe to that data stream to enable my computers to keep an offline copy.
There wasn’t a way to do this when I started using your great platform about four years ago. That was before you changed to native MQTT for your libraries.
Thanks! Steve

that’s what I shared above, you will need to run the python script on your computer or another pi and subscribe to the data, and then you can store it on the file or CSV.

Thank you.
I understand from your reply that I can download data that was uploaded using my code, but can’t download data that was uploaded using Cayenne-supplied code. That was my question.


which code are you referring to?

When I go to add a new Device & Widget, then select ‘Raspberry Pi’, I am offered a link such as: from where I can download code to install and run on my Pi to create and populate a Project Dashboard. I refer to that as ‘Cayenne-supplied code’.
When I choose to a a new ‘Bring Your Own Thing’ project, I then run my own code on the Pi. That I refer to as ‘my code’, which uses the same principles as the code you shared above.

Cayenne-supplied code is called Cayenne Agent. So now if you want to get the data from cayenne agent then also you need to use the above code I shared where

Client_id_B is the subscribing device. (you need to be either on pc or another pi)
Client_id_A is the publishing device. (Cayenne Agent or Cayenne Supplied code)