You’ll have to capture the device instance yourself when subscribing to the event. Here is one way you can do that using the concurrency primitives
OnBegin()<suspends>:void =
for (Device : MyColorChangingTileDevices):
# Spawn a new task for each device. Internally this function is going to suspend until the ActivatedEvent happens.
spawn { WaitForActivation(Device) }
WaitForActivation(Device:color_changing_tiles_device)<suspends>:void =
# Suspend this call
Device.ActivatedEvent.Await()
# Logic that happens when the ActivatedEvent runs
# You still have the device instance in this function, which you can use to run your magic numbers