Hello, I wrote a script that control a lamp color based on the decibel levels measured by a microphone. I'm using it to help customers of a winery out of my windows to control the loudness of their voices. The script runs automatically every night in a raspberry pi. To deal disconnections and reconnections I added to the script a function that goes like this
connection=False
def connect_lamp():
try:
global l530sec
l530sec = PyL530.L530("xxx.xxx.xxx", "me@mymail", "mypassowrd")
l530sec.handshake() #Creates the cookies required for further methods
l530sec.login() #Sends credentials to the plug and creates AES Key and IV for further methods
global connection
connection=True
except Exception as e:
#print(e)
connection=False
return
while connection==False:
connect_lamp()
This function work perfectly if the lamp is offline when the script is started, but if the connection is lost afterwards it give the 403 Client Error: Forbidden for etc..
I can share the entire script here or on my github, any suggestion will be greatly appreciated, having this script running properly is of vital importance!!
Hello, I wrote a script that control a lamp color based on the decibel levels measured by a microphone. I'm using it to help customers of a winery out of my windows to control the loudness of their voices. The script runs automatically every night in a raspberry pi. To deal disconnections and reconnections I added to the script a function that goes like this
This function work perfectly if the lamp is offline when the script is started, but if the connection is lost afterwards it give the 403 Client Error: Forbidden for etc.. I can share the entire script here or on my github, any suggestion will be greatly appreciated, having this script running properly is of vital importance!!
Thank you very much
Federico