Updating the tile status on refresh *noob


(Tmp R) #1

Sorry, I’m sure this is the most noob question ever but I’ve spent a lot of time reading the docs and searching but I just can’t find a simple answer to a simple question…

I’ve created a device handler for an RGB dimmer based on a particle photon. Setting the dimmer works fine. Return the current state to ST is also working and I can echo this to the log when you press the refresh button in app.

But how do I get it to update the tiles on ST app? I think I’m just missing something really obvious here. If someone can just point me in the direction of an example just for on/off switch that asks a device for it’s status then updates the tile, I’m sure I can work the rest out from there.


(Tmp R) #2

OK, so I’ve realised that because I’m controlling the Photon via HTTP I’ve not been using the parse function as there are no incoming events. I’ve also not been firing events, which hasn’t helped things.

So now I’m firing the appropriate events, which is helping keep the tiles updated.

However, this doesn’t account for if 1 user turns on, then another turns off. I still need the refresh functionality, but how do I implement this without firing a load of events on refresh, just to update the tiles for 1 user?


#3

Care to share your code? I’m trying to read the events published to the particle cloud, but have no clue how to even being to read a stream. I’ve spent a lot of time reading and can’t really understand what’s the best way of writing a device handler for the particle cloud.