ParadoxAlarmInterface / pai

Paradox Magellan, Spectra and EVO, with MQTT, Signal, Pushbullet, Pushover and others
https://gitter.im/paradox-alarm-interface
Eclipse Public License 2.0
358 stars 94 forks source link

RuntimeWarning: coroutine 'GSMTextInterface.data_received' : SMS is received but not processed #503

Closed rockyhopper closed 2 months ago

rockyhopper commented 2 months ago

On 'dev' branch commit 1717c9258bc0f95e25fa284e5184c6a78b6a1dde (containing pull#501).

When SMS is received I got following log containing a RuntimeWarnings:

` 2024-09-22 19:11:51,646 - DEBUG - MainThread - PAI.paradox.interfaces.text.gsm - BUFFER: b'\r\n+CMT: "+336xxxxxxxx","","24/09/22,19:11:49+08"\r\npartition MAISON disarm\r\n\r\n\r\n'

2024-09-22 19:11:51,647 - DEBUG - MainThread - PAI.paradox.interfaces.text.gsm - M->I: b'+CMT: "+336xxxxxxxx","","24/09/22,19:11:49+08"'

2024-09-22 19:11:51,648 - DEBUG - MainThread - PAI.paradox.interfaces.text.gsm - M->I: b'partition MAISON disarm'

/home/xxxx/dvp/__Sandboxes/pai/paradox/interfaces/text/gsm.py:89: RuntimeWarning: coroutine 'GSMTextInterface.data_received' was never awaited self.recv_callback(message) # Callback

RuntimeWarning: Enable tracemalloc to get the object allocation traceback `

As a consequence content of the SMS is not truly processed (for example we are not reaching code checking phone number against GSM_CONTACTS.

yozik04 commented 2 months ago

I've pushed a fix to dev. Please try.

rockyhopper commented 2 months ago

It works better, the SMS is processed then I'm now able to arm/disarm the partition 'MAISON'.

While testing I sent an "invalid" SMS like 'partition MAISON test' and it results in a strange error:

' 2024-09-23 08:46:50,158 - DEBUG - MainThread - PAI.paradox.interfaces.text.gsm - BUFFER: b'\r\n+CMT: "+336xxxxxxxx","","24/09/23,08:46:48+08"\r\npartition MAISON test\r\n' 2024-09-23 08:46:50,158 - DEBUG - MainThread - PAI.paradox.interfaces.text.gsm - M->I: b'+CMT: "+336xxxxxxxx","","24/09/23,08:46:48+08"' 2024-09-23 08:46:50,159 - DEBUG - MainThread - PAI.paradox.interfaces.text.gsm - Data Received: b'+CMT: "+336xxxxxxxx","","24/09/23,08:46:48+08"' 2024-09-23 08:46:50,159 - DEBUG - MainThread - PAI.paradox.interfaces.text.gsm - M->I: b'partition MAISON test' 2024-09-23 08:46:50,159 - DEBUG - MainThread - PAI.paradox.interfaces.text.gsm - Data Received: b'partition MAISON test' 2024-09-23 08:46:50,159 - DEBUG - MainThread - PAI.paradox.interfaces.text.gsm - On 24/09/23,08:46:48+08, +336xxxxxxxx sent partition MAISON test 2024-09-23 08:46:50,160 - DEBUG - MainThread - PAI.paradox.interfaces.text.gsm - Received: 24/09/23,08:46:48+08 +336xxxxxxxx partition MAISON test 2024-09-23 08:46:50,160 - ERROR - MainThread - PAI.paradox.exceptions - Unhandled exception in async loop(<_UnixSelectorEventLoop running=True closed=False debug=False>): 'NoneType' object has no attribute 'lower' Traceback (most recent call last): File "/home/xxx/dvp/Sandboxes/pai/paradox/interfaces/text/gsm.py", line 244, in handle_message ret = await self.handle_command(message) File "/home/xxx/dvp/Sandboxes/pai/paradox/interfaces/text/core.py", line 75, in handle_command if not await self.alarm.control_partition(element, command): File "/home/xxx/dvp/__Sandboxes/pai/paradox/paradox.py", line 459, in control_partition command = command.lower() AttributeError: 'NoneType' object has no attribute 'lower'

'

yozik04 commented 2 months ago

Yeah. Some better validation on the input was required =)