Telldus Live! python headless server
Posted: Fri Mar 17, 2023 9:45 am
Hi chaps,
Have got the python server scripts up and running, daemonised and crontab'ed to start on my raspberry pi boot. Works well, all be it a little slow in time terms to go from... iPhone App->pi->device
The problem I am seeing is the process ending. I thought it might be falling out of the 'connect' function, found in Client.py due to an empty response or timeout waiting for a pong response (the two break outs from the while(1) loop). So I changed the connect function to essentially loop forever with a sleep per loop iteration...something like this:
This, however, did not fix the problem.
Any and all help greatly appreciated! (I am a c/c++ coder by trade, not done a lot of python so every chance I just have something silly wrong!)
Cheers,
Ste
Have got the python server scripts up and running, daemonised and crontab'ed to start on my raspberry pi boot. Works well, all be it a little slow in time terms to go from... iPhone App->pi->device
The problem I am seeing is the process ending. I thought it might be falling out of the 'connect' function, found in Client.py due to an empty response or timeout waiting for a pong response (the two break outs from the while(1) loop). So I changed the connect function to essentially loop forever with a sleep per loop iteration...something like this:
Code: Select all
def connect(self, server):
while( 1 ):
self.connectme( server )
sleep( 60.0 )
def connectme(self, server):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.socket = ssl.wrap_socket(s, ssl_version=ssl.PROTOCOL_TLSv1, ca_certs="/etc/ssl/certs/ca-certificates.cr$
self.socket.settimeout(5)
self.socket.connect((server['address'], int(server['port'])))
rest of the original connect function...etc, etc, etc...
Any and all help greatly appreciated! (I am a c/c++ coder by trade, not done a lot of python so every chance I just have something silly wrong!)
Cheers,
Ste