Page 1 of 1

Notifications taking 20 minutes

PostPosted: Fri Jun 01, 2018 9:56 am
by Rene
I loaded the 5/29 beta and everything works except email and pushover notifications. It seems they timeout the UI with a gateway timeout error and eventually send about 18 minutes later. However, all my IFTT web hooks work perfectly. Could this be a TLS issue? Any tips on how to troubleshoot this? Thanks

Re: Notifications taking 20 minutes

PostPosted: Sun Jun 03, 2018 1:22 pm
by Rene
I downloaded to the current stable release and no difference so I reverted to the latest beta. I setup smtp mail on the pi and attempted command line smtp mail calls. I can ping the servers but the mail command times out. So, I discovered that there appears to be a problem with anything that uses TLS/port 587 - email, pushover, etc. I was able to revert to another mail account that still used SSL/port 465 and that works fine. I don't know how to troubleshoot TLS further but at least I got it to run. I think the major email vendors must have made a modification to TLS which the PI is not negotiating properly. Pushover must default to TLS as there are not settings for me to adjust.

Re: Notifications taking 20 minutes

PostPosted: Sun Jun 10, 2018 4:29 pm
by Rene
I used the following sample code on the raspberry pi to see if the PI itself is having issues connecting to PushOver. Sure enough, it does. Eventually it runs but it takes a long time. So, I profiles the code using "python -m cProfile testPushOver.py" and it indicates that the socket connection was taking all the time in a call to "{method 'connect' of '_socket.socket' objects}". I adjusted the code (as shown below) with a timeout parameter on the connection. Now the script runs without lag! I compared the results on another computer (no a PI) to see if there was lag and the first script was fine. I think I can conclude that the call to establish the SSL connection is timing out but I don't know why and the web app does not provide a connection timeout parameter. So, still stuck but a step closer to figuring out the issue.

import httplib, urllib
conn = httplib.HTTPSConnection("api.pushover.net:443")
conn.request("POST", "/1/messages.json",
urllib.urlencode({
"token": "{app token}",
"user": "{user token}",
"message": "hello world",
}), { "Content-type": "application/x-www-form-urlencoded" })
conn.getresponse()

Made this change on the second line.
conn = httplib.HTTPSConnection('api.pushover.net',443, timeout=1)