WemoControl Fix

Forums:

Since the start of the wemocontrol project I had one major problem. Every time I clicked one of the buttons on the web page, I would get an apache error. It was very frustrating but at the time I was working on just getting the main python page working. Once I finished the main python page, it was back to the error. I was somewhat disappointed in myself that I did not figure out the resolution faster. The Probs: Every time you clicked on the wemo button you would receive a generic apache error. Digging a bit further.. sudo nano /var/log/apache2/error.log I saw the following line showing the error: AH02429: Response header name '<!--' contains invalid characters, aborting request, referer: This lead me on a goosely chase to find where it was being thrown within the python code. I put in try/catch blocks but could never get them to trigger. WemoControl has two main py pages. wemo_control2.py and wemo_backend.py which is imported into the control2 script. In a nutshell, on initial load it checks success (valid key) and failure (invalid key) and then loads the html response in return. This is where I fixed the problem The Fix: Instead of loading two separate header sections, which are each built within each of the sections, I pulled the header text out and forced it as the very first thing to load, success or failure. That way no matter what happens, the header has already loaded and the rest of the html will be displayed afterwards, come rain, come shine. The wemo's still do not trigger on click, but no errors and it seems to be doing everything it needs to. Next up is the fix the wemo device trigger which should not be too difficult since I can get it to work directly from the python code. Wemo Trigger FIx As mentioned above, the wemo button onclick was not working. This turned out being a wemo.db access problem, promptly returning an error similar to "cannot write to readonly database". This in turn was fixed by setting the permissions on the database, which in turn spawned a "cannot write to log" error, which in turn was fixed by granting permissions on the wemo log file. Click "on", click "off" is now working and the project is successful. Back to opencv face recognition.... oh wait, backup server image first. ;)