Can't see private events

This is so fundamental, I have to be missing something. I have two Photons, both registered to me. One publishes an event once every six seconds with:

Particle.publish(“Inside_Temp”, String::format("%f",humidityF),TTL);

The other subscribes to the event with:

Particle.subscribe(“Inside_Temp”, insideTempHandler);

This works fine. The subscriber sees the events and the online log sees them as well.

If I change the publish to:
Particle.publish(“Inside_Temp”, String::format("%f",humidityF),TTL,PRIVATE);

the events show up in the online log, but the subscriber does not see them.

As suggested in one thread, I tried changing the subscribe to:

Particle.subscribe(“Inside_Temp”, insideTempHandler,MY_DEVICES);

but that doesn’t help. Suggestions welcome.
Thanks,
Doug

You should not use TTL for the time to live parameter but a number literal that states the seconds the event should live (default 60).

And using MY_DEVICES is not only a suggestion but a demand in order to subscribe to private events :wink:

I left out a line:

#define TTL 60”

But I guess I don’t understand your response. I used MY_DEVICES, but am still not seeing PRIVATE events.
Thanks,
Doug

That part of my response was mainly aimed at this sentence

But if I check with my devices it does what it should - at least since 0.4.9
Could you double check your subscribe filter for typos?

That Particle.subscribe is a cut and paste from my code. I just tried it again with the same results:

PRIVATE on the publish and MY_DEVICES on the subscribe has the events showing up on the log, but not the subscribing Photon.

If I remove the PRIVATE parameter from the publish and the MY_DEVICES from the subscribe, the events show in both the log and the subscribing Photon.

Thanks,
Doug

Silly question, but are both devices claimed to the same account?
If your (not)receiving Photon publishes some test data, does it appear in the same dashboard?

Not a silly question at all, but yes. They are both on the same account.

I changed the receiving Photon (called Display) to publish a public event “Echo_Temp” when it receives an event “Inside_Temp”. The Echo_Temp event was seen in the log and on the other Photon (called Sensors).

– Doug

Hi,

I’m having a similar problem. My receiving unit happens to be a Core but in essence it’s the same setup:
Photon publishes the temperature, the Core subscribes to receive.

The Core receives nothing if I add the MY_DEVICES option to the subscribe command. So frustrating.

Did you get yours sorted? I wonder, is it possible to just Subscribe to the stream from my Photon, did you try that as a workaround?

Thanks,

What system version have you got on your Core (and the other devices)?
Pre 0.4.9 there were some inconsitencies in the PUBLIC/PRIVATE and ALL_DEVICES/MY_DEVICES handling.

Hello, I’m running 0.5.2 on both devices, they’ve both auto updated as I’ve compiled new code to them… Hold on a minute… They do update automatically when using the web IDE don’t they?

I ran into this problem, and with the suggestions here and some experimentation realized that BOTH the publisher and subscriber MUST use the same setting. So for example, publishing privately and receiving publicly will not work.

It seemed like “private” should be a subset of “public”, but it does not appear to work that way. So to get things working, make sure both the publish and subscribe are using the same public/private setting.

I have open sourced my Alexa, iOS, and Photon code to make it easy for others to control their Photon projects with Alexa or an iOS app without having to write any Alexa or iOS code. I released this under the name “Patriot” and have had several other folks playing with it, and everything appeared to be working great.

However, then I started noticing in my console logs events from devices that I hadn’t created/defined. At that point I realized that publishes and subscribes in all of the code was defaulting to public. Since the default publish event name is “patriot”, anyone else using the open source library would be seeing everyone else’s publishes.

So I’m in the process of changing the Alexa skill, iOS app, and Photon code to all use PRIVATE and MY_DEVICES. But this isn’t working, and I’m seeing the same behavior described by DougJohnson: I see all the events in the console log, but I don’t get the events on the Photon sent by the iOS app or the Alexa skill. I’ve compared the log entries, and Event Name and Data are exactly the same. The publishes from iOS and Alexa say “api” in the Device column.

All the code is on Github.

Should publishes from “api” be received by Photons subscribing to MY_DEVICES?
Is it possible to see the public/private setting in the Console log or somewhere else?

Ok, I’ve tracked down and fixed the issues.

On the iOS app, the problem was a case sensitivity issue.

On the Alexa app, the problem was that the alexa-sdk-js private property is named “isPrivate”, and I was using “private”.

Changing these allows the Photons, iOS apps, and Alexa to all work together again, but privately.

2 Likes