Wait for the real device to connect

Hello,
I’m using Appium and Ruby to make test on real androi device.
When I plug the real android on USB, it’s ok, I can run my script.
But sometimes I don’t have the device so I’m using Testdroid services. Testdroid is a compagny with real devices and let me to connect to them. But sometimes the devices is not ready and I have to wait 5 minutes before I can start my test. And I only know that after launching my driver/browser with the specific capabilities.
How can I put a wait untill a device is avalable ? Right now I have

Net::ReadTimeout (Net::ReadTimeout)

I’ve tried “@browser.driver.manage.timeouts.implicit_wait = 10000” but timeout still happen after 30 seconds.
Thanks if you’ve got a solution for that !