How to use the pymyq.device.STATE_CLOSED function in pymyq

To help you get started, we’ve selected a few pymyq examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github arraylabs / pymyq / example.py View on Github external
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: