Distributed Presence Data

Hi all,

I wanted to keep track of who’s home and I wanted to store the information across the 5 Photons I have running in my home. They occasionally reboot due to bugs or been switched off accidentally so I thought using pub/sub to store the data across multiple devices would be the safest method.

I made a simple library that is easy to add to all of my existing projects. Once the PreferenceManager is subscribed to presence events it publishes a request for the status from all other devices. Doing this also synchronizes all devices with each other.

Any feedback is welcome. Currently the biggest bug I can see is if there are more then 4 users been tracked then they will fail to publish when requested. Maybe a delay of 300ms between publish events will stop 4 been published within a second.

Hopefully someone finds it useful.

Kev

2 Likes

I think that's not a bug but by design. It may well be in connection with this
https://docs.particle.io/reference/firmware/photon/#particle-publish-

2 Likes

Thanks @ScruffR

I knew it was a limit but I thought it was four per second. I’ll add a timer so it only pushes out 1 per second leaving room for users to publish events using the burst of 4.