Upload the /HomeAutomation/ folder structure into the root directory.
Set permissions for the script files located here:
Select all of them -> F9 Properties -> set the execution rights (X) for everyone (Owner, Group, Others)
Close WinSCP, restart router (e.g. recycle power).
Now the web server is ready. Try it out:
Open up a web browser, type in: http://192.168.1.1:81
You should see your custom web page.
If you press a button on the included web page, the router will send out serial commands through the previously attached serial cable.
We need to intercept these commands and process them. For that purpose we need to build a microcontroller board (like Arduino).
The included web site is very basic. If you make good CGI/AJAX based web sites please share it with us.
How does the web site work
When you click on a button, the browser loads a script file, the router executes the shell commands (serial outputs) located in each cgi file. The script file then redirects the browser back to the index page (takes about ~1sec).
If you want to output custom serial commands, modify the .cgi files.
Serial commands are sent out like this:
echo -e "\x9B\x11\x08\x22\xC5\x0D" > /dev/ttyS0
(the \x modifier is used to output data in HEX instead of ASCII)
I made this simple as possible. One package contains:
1. Synchronization (0x9B)
2. Message type, use 0x00 or 0x01 for now (check firmware for details)
5. Checksum (calculated from Byte#2-4)
6. End character (, 0x0D)