Webpage Update

A project log for Home automation on the cheap

Using an esp8266, arduino nano, a salvaged usb power supply, and a couple relays you can automate anything

thjubeckthjubeck 03/15/2018 at 04:590 Comments

So after a long break from writing, this series of logs will once again get an update. After reviewing the webpage code which was hard to follow, I decided to clean it up a bit and leave only what is necessary to run. As seen below the code is much more manageable and should run much smoother if you only have one light. There is still some code that can be cleaned up or removed but some will be used in my next update on the topic of adding the streaming webcam to the page. Stay tuned as more updates will follow. 


if (isset($_POST["ON1"])) {
  $fp = fsockopen("", 23, $errno, $errstr);  // Replace the  IP address with your own
if (!$fp) {
    echo "$errstr ($errno)<br />\n";
} else {
    fwrite($fp, "2");

$f_pointer2 =fsockopen("", 23, $errno, $errstr); // Replace the  IP address with your own
$lampstat=fread($f_pointer2, 1); //1 is the character length to be read. arduino sends a char length data

if ($lampstat=='0') {
    $stat2 = "Off";
} else {
     $stat2 = "On";




<center><h1>MY LIGHTS</h1><b>Version <?php echo $verz; ?></b></center><br/>

<center><b>Lamp <?php echo $stat2?>  <img src="<?php echo $Source3; ?>"  alt="Light On" height="42" width="42" </a> </b></center>

<form method="post" action="temp.php" >

<input type="submit" value="Lamp" name="ON1"  action="temp.php" width=20% height=10%  ><br/><br/>



<!--<b><img src=temp_graphShort.png></a></b><br/>

<b><img src=temp_graphtoday.png></a></b><br/>

<b><img src=temp_graph.png></a></b><br/>

<b><img src=temp_graphmonth.png></a></b><br/>

<b><img src=temp_graphyear.png></a></b><br/>

<center><b><img src="stream.php"></b><br/></center> -->