I have recently put online a new Photon that is continuously sending three variables to the server. I can retrieve the device information, and even the most recent value using the /v1/devices/:deviceID/:variable
method; however when I try to listen to events, it comes up blank?
For example, if I try hitting the endpoint:
/v1/devices/events
This gets me a blank terminal that does look like it’s supplying a blank line every second or so?
Any thoughts on why this might be happening?
Are you respecting the 1p/s publish limit?
I believe so. It’s pushing 3 variables every 10 seconds at the moment. Regardless though, if I’m seeing them show up under the last known device variable, shouldn’t it also show up under events?
Variables and events are different things, and should be treated separately as such.
Could you check the dashboard to make sure you're hitting the right endpoint?
If possible, also share your code, or at least the relevant parts, so we could take a look?
Particle.variable doesn’t actually send anything to the cloud. You should call it once in setup() and pass it a global variable to store the data. You can update that variable as often as you want, and when the variable is queried, the most recent value will be read and returned without your code doing anything.
https://docs.particle.io/reference/firmware/photon/#particle-variable-
Particle.publish works the opposite way. It does send the data up to the cloud, and there are limits on how fast you can do it, approximately once per second, though the rules are actually a little more complicated than that. You keep calling that every time you want to have the listeners know the value. This is what shows up in the event log at dashboard.particle.io and when you monitor the event stream.
https://docs.particle.io/reference/firmware/photon/#particle-publish-
Ahhh. Okay. I had variables and events mixed up I suppose. It looks like events are only stored for a limited amount of time though…? So it’s probably a good idea to setup a webhook to forward the ‘events’/data to my own database…?
Correct. Persistent events are a planned thing, but since they don’t exist yet, an event plus a web hook should work well for storing data in a database.