Closed gytisgreitai closed 4 years ago
@gytisgreitai Did you verified the fix?
@yozik04 let me check, how do I run this now when run.py is gone?
run.sh
is there
Nope, does not seem to work. (python 3.8) Modem seems to be working, tested with simple python script. master branch
2020-01-03 17:49:33,440 - INFO - PAI.paradox.paradox - Connection OK
Task exception was never retrieved
future: <Task finished name='Task-120' coro=<SerialCommunication.on_data_received() done, defined at pai/paradox/interfaces/text/gsm.py:87> exception=IndexError('list index out of range')>
Traceback (most recent call last):
File "pai/paradox/interfaces/text/gsm.py", line 96, in on_data_received
return await self.recv_callback(message)
File "pai/paradox/interfaces/text/gsm.py", line 248, in data_received
ps.sendNotification(Notification(sender=self.name, message=tokens[1], level=EventLevel.INFO))
IndexError: list index out of range
Task exception was never retrieved
future: <Task finished name='Task-121' coro=<GSMTextInterface.data_received() done, defined at pai/paradox/interfaces/text/gsm.py:212> exception=IndexError('list index out of range')>
Traceback (most recent call last):
File "pai/paradox/interfaces/text/gsm.py", line 248, in data_received
ps.sendNotification(Notification(sender=self.name, message=tokens[1], level=EventLevel.INFO))
IndexError: list index out of range
I will look at it. My modem failed and I could not test some changes. What modem are you using?
I'm using cheap Chinese sim800l
Initial problem seems to be caused by this line https://github.com/ParadoxAlarmInterface/pai/blob/a30dc8316fbb9293e77bc693f0e8a000dcab6936/paradox/interfaces/text/gsm.py#L234
because the string that arrives is +CUSD: 2
so split by "
does not work, and then on this line it expects tokens length to be 2, but it's actually 1 because no split was performed
https://github.com/ParadoxAlarmInterface/pai/blob/a30dc8316fbb9293e77bc693f0e8a000dcab6936/paradox/interfaces/text/gsm.py#L248
Commenting that out seems to start the modem. How do I test if I can receive messages without triggering the alarm ?:) Tried setting
GSM_MIN_EVENT_LEVEL = 'DEBUG'
GSM_EVENT_FILTERS = [ 'zone,alarm,trigger,partition,arm,disarm,trouble,restore,cancel' ]
and arming/disarm/starting entry delay but nothing in the logs related to gsm
I've tried to send a command via sms disarm
, this also fails though it seems that sms is read successfully
2020-01-03 22:53:13,156 - DEBUG - gsm - PAI.paradox.interfaces.text.gsm - M->I: b'+CMT: "+XXXXXXXXX","","20/01/04,00:53:09+08"'
2020-01-03 22:53:13,157 - DEBUG - gsm - PAI.paradox.interfaces.text.gsm - Data received: b'+CMT: "+XXXXXXXXX","","20/01/04,00:53:09+08"'
2020-01-03 22:53:13,179 - DEBUG - gsm - PAI.paradox.interfaces.text.gsm - Received message: 2020-01-04 00:53:09 +XXXXXXXXX
2020-01-03 22:53:13,180 - WARNING - gsm - PAI.paradox.interfaces.text.core - Invalid:
2020-01-03 22:53:13,181 - INFO - gsm - PAI.paradox.interfaces.text.gsm - FROM +XXXXXXXXX: Invalid:
Task exception was never retrieved
future: <Task finished name='Task-726' coro=<SerialCommunication.on_data_received() done, defined at pai/paradox/interfaces/text/gsm.py:87> exception=ValueError('Bad message: must be 0-1024 characters, was 0')>
Traceback (most recent call last):
File "pai/paradox/interfaces/text/gsm.py", line 96, in on_data_received
return await self.recv_callback(message)
File "pai/paradox/interfaces/text/gsm.py", line 245, in data_received
self.handle_message(timestamp, source, message)
File "pai/paradox/interfaces/text/gsm.py", line 266, in handle_message
ps.sendNotification(Notification(sender=self.name, message=message, level=EventLevel.INFO))
File "pai/paradox/lib/ps.py", line 25, in sendNotification
pub.sendMessage(PREFIX + "notifications", notification=notification)
File "/usr/local/lib/python3.8/site-packages/pubsub/core/publisher.py", line 216, in sendMessage
topicObj.publish(**msgData)
File "/usr/local/lib/python3.8/site-packages/pubsub/core/topicobj.py", line 452, in publish
self.__sendMessage(msgData, topicObj, msgDataSubset)
File "/usr/local/lib/python3.8/site-packages/pubsub/core/topicobj.py", line 482, in __sendMessage
listener(data, self, allData)
File "/usr/local/lib/python3.8/site-packages/pubsub/core/listener.py", line 237, in __call__
cb(**kwargs)
File "pai/paradox/interfaces/text/core.py", line 60, in handle_notify
self.send_message(notification.message, notification.level)
File "pai/paradox/interfaces/text/pushover.py", line 53, in send_message
user.send_message(message, title='Alarm', priority=_level_2_priority.get(level, chump.NORMAL))
File "/usr/local/lib/python3.8/site-packages/chump/__init__.py", line 563, in send_message
message = self.create_message(
File "/usr/local/lib/python3.8/site-packages/chump/__init__.py", line 549, in create_message
return message_class(self, **kwargs)
File "/usr/local/lib/python3.8/site-packages/chump/__init__.py", line 590, in __init__
self.message = message
File "/usr/local/lib/python3.8/site-packages/chump/__init__.py", line 645, in __setattr__
raise ValueError('Bad message: must be 0-1024 characters, was {length}'.format(length=len(value)))
ValueError: Bad message: must be 0-1024 characters, was 0
2020-01-03 22:53:13,198 - DEBUG - gsm - PAI.paradox.interfaces.text.gsm - M->I: b'disarm'
2020-01-03 22:53:13,200 - DEBUG - gsm - PAI.paradox.interfaces.text.gsm - Data received: b'disarm'
2020-01-03 22:53:13,201 - DEBUG - gsm - PAI.paradox.interfaces.text.gsm - Data received: b'+CMT: "+XXXXXXXXX","","20/01/04,00:53:09+08"'
2020-01-03 22:53:13,202 - DEBUG - gsm - PAI.paradox.interfaces.text.gsm - Received message: 2020-01-04 00:53:09 +XXXXXXXXX
2020-01-03 22:53:13,203 - WARNING - gsm - PAI.paradox.interfaces.text.core - Invalid:
2020-01-03 22:53:13,204 - INFO - gsm - PAI.paradox.interfaces.text.gsm - FROM +XXXXXXXXX: Invalid:
Task exception was never retrieved
future: <Task finished name='Task-728' coro=<GSMTextInterface.data_received() done, defined at pai/paradox/interfaces/text/gsm.py:212> exception=ValueError('Bad message: must be 0-1024 characters, was 0')>
Traceback (most recent call last):
File "pai/paradox/interfaces/text/gsm.py", line 245, in data_received
self.handle_message(timestamp, source, message)
File "pai/paradox/interfaces/text/gsm.py", line 266, in handle_message
ps.sendNotification(Notification(sender=self.name, message=message, level=EventLevel.INFO))
File "pai/paradox/lib/ps.py", line 25, in sendNotification
pub.sendMessage(PREFIX + "notifications", notification=notification)
File "/usr/local/lib/python3.8/site-packages/pubsub/core/publisher.py", line 216, in sendMessage
topicObj.publish(**msgData)
File "/usr/local/lib/python3.8/site-packages/pubsub/core/topicobj.py", line 452, in publish
self.__sendMessage(msgData, topicObj, msgDataSubset)
File "/usr/local/lib/python3.8/site-packages/pubsub/core/topicobj.py", line 482, in __sendMessage
listener(data, self, allData)
File "/usr/local/lib/python3.8/site-packages/pubsub/core/listener.py", line 237, in __call__
cb(**kwargs)
File "pai/paradox/interfaces/text/core.py", line 60, in handle_notify
self.send_message(notification.message, notification.level)
File "pai/paradox/interfaces/text/pushover.py", line 53, in send_message
user.send_message(message, title='Alarm', priority=_level_2_priority.get(level, chump.NORMAL))
File "/usr/local/lib/python3.8/site-packages/chump/__init__.py", line 563, in send_message
message = self.create_message(
File "/usr/local/lib/python3.8/site-packages/chump/__init__.py", line 549, in create_message
return message_class(self, **kwargs)
File "/usr/local/lib/python3.8/site-packages/chump/__init__.py", line 590, in __init__
self.message = message
File "/usr/local/lib/python3.8/site-packages/chump/__init__.py", line 645, in __setattr__
raise ValueError('Bad message: must be 0-1024 characters, was {length}'.format(length=len(value)))
ValueError: Bad message: must be 0-1024 characters, was 0
2020-01-03 22:53:13,209 - DEBUG - gsm - PAI.paradox.interfaces.text.gsm - Data received: b'disarm'
Thanks for the debug. There may be other issues. I will look at it this weekend. To test the interface you can adjust the tags/regexp so that some messages are sent, or you can send an SMS to the modem. It helps if you also setup pushbullet/signal/pushover as additional messages related to the GSM interface will be issued.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
It seems that
Connection
class is different from what is implemented in GSM interfacedef __init__(self, on_message: typing.Callable[[bytes], None]):