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.