GSM - Fail to connect to modem (device visible and permissions are set)
Hello all,

I´m using Addon version 3.5.0 with a "T-SIM7600" SIM adaptor.

With following configuration:

`
GSM_ENABLE: true
GSM_MODEM_BAUDRATE: 115200
GSM_MODEM_PORT: /dev/ttyUSB3
GSM_MIN_EVENT_LEVEL: CRITICAL
`

At startup in the log, I can see:

`
2024-09-16 08:50:10,600 - INFO     - PAI - Console Log level set to 20
2024-09-16 08:50:10,606 - INFO     - PAI.paradox.interfaces - Starting GSMTextInterface Interface
2024-09-16 08:50:10,608 - INFO     - PAI.paradox.interfaces.text.gsm - Using /dev/ttyUSB3 at 115200 baud
2024-09-16 08:50:10,609 - INFO     - PAI.paradox.interfaces.text.gsm - Connecting to serial port /dev/ttyUSB3
2024-09-16 08:50:10,631 - INFO     - PAI.paradox.interfaces.text.gsm - Serial port open
2024-09-16 08:50:10,632 - INFO     - PAI.paradox.interfaces.text.gsm - Serial port open
Exception in callback SerialConnectionProtocol.connection_made(SerialTranspo...dsrdtr=False)))
handle: <Handle SerialConnectionProtocol.connection_made(SerialTranspo...dsrdtr=False)))>
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/events.py", line 84, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.11/site-packages/paradox/interfaces/text/gsm.py", line 34, in connection_made
    self.handler.on_connection()
  File "/usr/local/lib/python3.11/site-packages/paradox/interfaces/text/gsm.py", line 95, in on_connection
    self.connected_future.set_result(True)
asyncio.exceptions.InvalidStateError: invalid state
/usr/local/lib/python3.11/site-packages/paradox/interfaces/text/gsm.py:126: RuntimeWarning: coroutine 'Queue.get' was never awaited
  return await asyncio.wait_for(self.queue.get(), timeout=5, loop=self.loop)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
2024-09-16 08:50:10,647 - ERROR    - PAI.paradox.interfaces.text.gsm - Modem connect error
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/paradox/interfaces/text/gsm.py", line 211, in connect
    self.write(b"AT", b"OK")  # Init
    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/paradox/interfaces/text/gsm.py", line 174, in write
    r = self.loop.run_until_complete(self.port.write(message))
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/paradox/interfaces/text/gsm.py", line 126, in write
    return await asyncio.wait_for(self.queue.get(), timeout=5, loop=self.loop)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: wait_for() got an unexpected keyword argument 'loop'
2024-09-16 08:50:10,653 - WARNING  - PAI.paradox.interfaces.text.gsm - Could not connect to modem
2024-09-16 08:50:10,662 - INFO     - PAI.paradox.interfaces - Starting BasicMQTTInterface Interface
`

It seems not to be a an issue with the device or the permissions at I can connect to the PAI container, then install 'minicom' (with apk add minicom), and I can issue the AT command (and receive 'OK') on same port with same rate.

Also I tried an alternative to use SMS integration from Home Assistant and it works well too.

Any idea what could be wrong?


Regards.

