Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
await device.open()
print(' 0 Current State: {0}'.format(device.state))
for waited in range(1, 30):
if device.state == STATE_OPEN:
break
await asyncio.sleep(1)
await device.update()
print(' {} Current State: {}'.format(
waited, device.state))
await asyncio.sleep(10)
await device.update()
print()
print('Current State: {0}'.format(device.state))
if device.state != STATE_CLOSED:
print('Closing the device...')
await device.close()
print(' 0 Current State: {0}'.format(device.state))
for waited in range(1, 30):
if device.state == STATE_CLOSED:
break
await asyncio.sleep(1)
await device.update()
print(' {} Current State: {}'.format(
waited, device.state))
await asyncio.sleep(10)
await device.update()
print()
print('Current State: {0}'.format(device.state))
except MyQError as err: