I am trying to subscribe my photons to their mac address so I can talk to each one of them univocally (Same code for all of them, that’s the idea).
I have tried the following library: https://github.com/hirotakaster/MQTT And it works. But I just can subscribe to strings (“frame/register”) but any time I tried to put mac address, I can’t (Or I don’t know) how to make the publish on other client.
Have you ever tried this?
This is how I create the subscription:
mac is byte array with mac address inside.
char client_c[6];
client_c[0] = mac[0];
client_c[1] = mac[1];
client_c[2] = mac[2];
client_c[3] = mac[3];
client_c[4] = mac[4];
client_c[5] = mac[5];
client->subscribe(client_c);
What should I use on the other side as topic? I tried printing client_c as string in console but I get weird characters.
Thank you but I have the same problem. I am not able to send a frame to this device. Now I see the mac when I use serial.print. But if I copy&paste that string on mqtt.fx client or my node.js client, the packet is not received on my photon.
I got it working. It seems my node server didn’t restart with the new mac address string. Now it is working and I receive the frame each time I ask for it.
BTW, this is the code I have to make subscription and ask for the frame. I wasn’t sure what happens if I make the subscription each loop so before anything, I unsubscribe to the topic and create a new subscription: