Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GSM - Fail to connect to modem (device visible and permissions are set) #500

Open
rockyhopper opened this issue Sep 16, 2024 · 7 comments · May be fixed by #501
Open

GSM - Fail to connect to modem (device visible and permissions are set) #500

rockyhopper opened this issue Sep 16, 2024 · 7 comments · May be fixed by #501

Comments

@rockyhopper
Copy link

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.

@yozik04
Copy link
Collaborator

yozik04 commented Sep 16, 2024

You have too new Python, they have removed loop= argument in recent versions on Python. If you can install some older one it should work.
I can blindly try to remove all these loop= arguments but I am unable to validate the change.

@rockyhopper
Copy link
Author

I have tried version 1.4.0 which is using an older python version.

But I got another error (then I retried with successfully with minicom the AT command):

024-09-17 08:54:02,945 - INFO - PAI.paradox.interfaces - Starting GSMTextInterface Interface 2024-09-17 08:54:02,946 - INFO - PAI.paradox.interfaces.text.gsm - Using /dev/ttyUSB3 at 115200 baud 2024-09-17 08:54:02,948 - INFO - PAI.paradox.interfaces.text.gsm - Connecting to serial port /dev/ttyUSB3 2024-09-17 08:54:02,969 - INFO - PAI.paradox.interfaces.text.gsm - Serial port open 2024-09-17 08:54:02,972 - 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.9/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.9/site-packages/paradox/interfaces/text/gsm.py", line 34, in connection_made self.handler.on_connection() File "/usr/local/lib/python3.9/site-packages/paradox/interfaces/text/gsm.py", line 95, in on_connection self.connected_future.set_result(True) asyncio.exceptions.InvalidStateError: invalid state Exception in callback SerialTransport._read_ready() handle: <Handle SerialTransport._read_ready()> Traceback (most recent call last): File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run self._context.run(self._callback, *self._args) File "/usr/local/lib/python3.9/site-packages/serial_asyncio/__init__.py", line 120, in _read_ready self._protocol.data_received(data) File "/usr/local/lib/python3.9/site-packages/paradox/interfaces/text/gsm.py", line 64, in data_received self.loop.create_task(self.handler.on_message(frame)) # Callback File "/usr/local/lib/python3.9/asyncio/base_events.py", line 438, in create_task task = tasks.Task(coro, loop=self, name=name) TypeError: a coroutine was expected, got None 2024-09-17 08:54:03,012 - INFO - PAI.paradox.interfaces - Starting BasicMQTTInterface Interface

If you can commit a fix in 'dev' branch then I guess I can deploy from the dev HassIO repo to test.

@yozik04 yozik04 transferred this issue from ParadoxAlarmInterface/hassio-repository Sep 17, 2024
@yozik04
Copy link
Collaborator

yozik04 commented Sep 17, 2024

It came out to be a much larger change. See #501. No idea how much I broke.

@rockyhopper
Copy link
Author

I tried with python 3.9.20 and #501: PAI can now connect to the modem and is able to receive SMS.

I will try later with exact version of python used by 'PAI Hassio Add-on'. And do more testing like ensure I can issue a command from my phone and receive SMS notifications from PAI.

@yozik04
Copy link
Collaborator

yozik04 commented Sep 20, 2024

Great news. I did not had a chance to test it yet.

@rockyhopper
Copy link
Author

Just tested Python 3.11 (and with pull/501): it's working too :)

BUT I have sent "partition MAISON disarm" (while my EVO192 was in "arm home" state with MAISON being one partition name as double-checked in the log) and nothing happens. No error, I see incoming BUFFER in the log but alarm was not disarmed.

Also I receive no notification on my phone: I'm interested in a first time receiving notification each time alarm is armed or disarmed.

It's likely a problem of misconfiguration (even if I have set my phone number in contacts list).

Whatever regarding SMS connectivity the pull request looks good.

@yozik04
Copy link
Collaborator

yozik04 commented Sep 20, 2024

There should be something in logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants