I don’t really care about the address, I just wants to know, which BluzDK to send a command to and which BluzDk to expect a reply from. For instance - the gateway wants to instruct the green-house-device to turn on the heater or water plants, which channel should the gateway use? Or the gateway receives a request to do something and report back – who should the gateway send the reply to ?
I think both your examples could work for me. But something like: "I know my light system is at address 2, when I receive data I know it came from address X and if the address’ change, I will know it” would be perfect. All I really need is an address for each device and a way to know if it change.
This way it would be easy to implement a simple protocol, and have the clients tell the gateway-Photon what/who they are and at what channel they can be reached. Using the poll function I could broadcast a request to all clients or just “new” clients.
At the moment my setup “kind of works” by having the gateway code making a poll, send the “index” to the bluzDK’s, which returns the same index, a device type and an id/name. Now the gateway knows the outdoor sensor is index 0, mail-box is index 1, fish tank is index 2 and so on. In each sendData from BluzDK I include the index, so the gateway knows which bluzDk to send the reply to.
This leaves me with at least to problems. All communication must be initiated by the gateway after a poll , so the BluzDK gets the index. And if the list of devices change, the index’s can change, an I have a problem. I believe I can work around most of the issues, but my code gets filled with house-keeping code and trafik, so it would be nice if the gateway could help a little more