Skip to content

Problem during initialization #21

@geroratto

Description

@geroratto

Hi,
I'm using version 0.0.18 of the library and I encountered an exception when calling the initialize() method of the Device class.

Here’s the relevant snippet:

self.__connection = SerialPortConnection(com_port)
self.__connection.open()
self.__connection.clear_buffer()
self.__logger.info('Serial connection opened')

self.__device = DeviceP24(self.__connection)
try:
    await self.__device.initialize()
    self.__logger.info('Device initialized')
    self.__device_initialized = True
except Exception as e:
    self.__logger.critical(f'Exception initializing the device: {e}')

The first time I connect the device, initialize() raises the following error: Error during reconnection or initialization: 16 is not a valid Commands

Wrapping it in a try/except block avoids crashing, but it would be great to know if this is expected behavior (e.g., the device isn't ready immediately after opening), or if there's something I can do to prevent the exception in the first place.
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions