importasynciofrommiraie_acimportMirAIeHub, MirAIeBrokerasyncdefsetup():
# Instantiate a MirAIeHub objectbroker=MirAIeBroker()
# Instantiate a MirAIeHub objecthub=MirAIeHub()
# Intialize the hub (+91xxxxxxxxxx, password, broker)awaithub.init("<mobile>", "<password>", broker)
# Display list of available devicesprint( hub.home.devices )
# Wait till connection has been established with the brokerasyncdefwaitForClient():
whilenothasattr(broker, 'client') orgetattr(broker, 'client') isNone:
awaitasyncio.sleep(1)
awaitwaitForClient()
# Now you can run any operation on the device(s)hub.home.devices[0].turn_off()
asyncio.run(setup())