I currently have a couple of test devices setup in a standard unicast OTAA configuration sending uplinks periodically. However, I also want the ability to send downlinks to all my devices in the application (currently only 2 but this number will increase). This is where my desire to use multicast comes in.
Is it possible for a device to have both unicast and multicast properties? Is this just a matter of setting the same DevID, NwkSKey, and AppsKey for all devices, but setting a different AppKey for OTAA? Or am I looking for a solution to my problem in the wrong place. Cheers!
Briefly put: Yes, it is possible, but it may be more difficult than you imagine.
For details: See the LoRa Alliance website, and in particular, the LoRaWAN specifications (document TS001) and the Remote Multicast Set-up specification (document TS005). As implied by its name, the latter document makes it possible to set up a multicast session over-the-air (OTA), in a manner similar/analogous to OTAA. It is also “legal” to set up the multi-cast session “statically,” in a manner similar to ABP, but this is not particularly well documented anywhere. (What you suggested is “crudely” correct. In other words, “static” approach would involve your precomputing the McDevAddr and corresponding session keys and storing them on the end-devices before deployment.)
That’s the “theoretical” background. You would also need to look into whether the firmware for your end-device (i.e., the LoRaMAC software layer, an example of which is the Semtech LoRaMac-node on GitHub) supports multicast, etc.
I am using your -OTA like “dynamic” approach for setting the MC group on OTAA end devices. But there is a problem here. Whenever device Rejoins the network, MCKEY and MCADDR disappear. I think that Rejoin event should not effect the MCKEY and MCADDR but its not like that.
Can I write MCKEY and MCADDR to a persistant storage on the device to re-initiate the multicast setup after the REJOIN event ?
It helps if you tell us where the keys disappear. On the device (likely given your message) or at TTN?
Also, what stack (name, version and link to website very much appreciated, makes it easier to comment) are you using? Being able to simple store and restore those values will likely depend on the stack and what else (frame counters?) needs to be saved.