Strange Core/Photon Publish/Subscribe Issue

This weekend while I upgraded a Core (0.3.4) to a Photon (0.4.6), I noticed a strange behavior with the Publish/Subscribe system that I figured is worth mentioning.

I had a Core which was listening to my HVAC’s thermostats. Whenever a thermostat called for heat/cool/fan, my Core would Publish a message like this:

Spark.publish("hvac_z1", "off", PRIVATE);

Then I had 2 Photons that listened for this event using the following code:

Spark.subscribe(“hvac_z1”, hvacHandler);

This all worked great until I upgraded the Core. Once I upgraded to Core to a Photon (with the exact same code) my Photons that Subscribed to the events failed to receive them.

Following this I pulled up http://dashboard.particle.io to check if the events are being fired. And sure enough, the events showed up.

After digging around, I set my Subscribe code like this:

Particle.subscribe("hvac_z1", hvacHnd, MY_DEVICES);

And the events started firing again.

Again my issue is resolved, but I found it odd that changing the hardware would cause an issue like this.

There is an open issue about inconsistent publish/subscribe behaviour in connection with public/private events

2 Likes

Thanks. Didn’t realize it was already known.