From: Russ Handorf Date: Tue, 12 Apr 2016 02:34:39 +0000 (-0400) Subject: new cleanup and updates X-Git-Url: http://russells-world.com/code/?a=commitdiff_plain;h=2302283047d4580aa4b97bc8987dd1525480c3ba;p=home-automation.git new cleanup and updates --- diff --git a/alert_status.php b/alert_status.php index 0b3edee..38186b8 100644 --- a/alert_status.php +++ b/alert_status.php @@ -1,11 +1,10 @@ =1) { - echo "Russ- You're being summoned!
"; -} -if (summon_status("beth")>=1) { - echo "Beth- You're being summoned!
"; -} +foreach ($summon as $person) { + if (summon_status($person) >= 1) { + echo "$person- You're being summoned!
"; + } +} ?> diff --git a/cache/weather.Name=19046.cache b/cache/weather.Name=19046.cache new file mode 100644 index 0000000..3ad10ac --- /dev/null +++ b/cache/weather.Name=19046.cache @@ -0,0 +1 @@ +a:1:{s:7:"forexml";a:2:{s:1:"@";a:1:{s:4:"site";s:0:"";}s:1:"#";a:2:{s:11:"observation";a:1:{i:0;a:2:{s:1:"#";s:0:"";s:1:"@";a:19:{s:4:"city";s:8:"WXPRAW, ";s:8:"longname";s:8:"WXPRAW, ";s:5:"ident";s:0:"";s:8:"latitude";s:0:"";s:9:"longitude";s:0:"";s:8:"timezone";s:0:"";s:15:"daylight_saving";s:1:"1";s:5:"night";s:1:"1";s:12:"weather_code";s:0:"";s:16:"observation_name";s:11:" (WXPRAW, )";s:4:"time";s:13:"00Z 22 MAY 12";s:11:"wind.string";s:4:"calm";s:11:"wind_direct";s:1:"N";s:14:"wind_speed.knt";s:1:"-";s:15:"pressure.string";s:20:"1000.6 mb (29.56 in)";s:11:"pressure.mb";s:6:"1000.6";s:11:"pressure.in";s:5:"29.56";s:5:"skies";s:0:"";s:12:"text_weather";s:0:"";}}}s:7:"almanac";a:1:{i:0;a:2:{s:1:"#";s:0:"";s:1:"@";a:2:{s:7:"sunrise";s:0:"";s:6:"sunset";s:0:"";}}}}}} \ No newline at end of file diff --git a/cameras.php b/cameras.php new file mode 100644 index 0000000..51a80e7 --- /dev/null +++ b/cameras.php @@ -0,0 +1,28 @@ +$camera) { + if ($_GET['cam'] == $id) { + echo ""; + #echo ""; + } + } +} else { + $camera=$cameras[0]; + echo ""; +} +?> + + +$camera) { + echo " +
"; + ?> + , 'contentarea');" style="font-family: 'Times New Roman';font-size:16pt; color:#ffffff; filter:Glow(color=#ff0000, strength=12);"> + "; +} +?> +
diff --git a/config.php b/config.php new file mode 100644 index 0000000..c29126d --- /dev/null +++ b/config.php @@ -0,0 +1,28 @@ + diff --git a/images/loading.gif b/images/loading.gif new file mode 100644 index 0000000..f864d5f Binary files /dev/null and b/images/loading.gif differ diff --git a/includes.php b/includes.php index f55dd8b..a4ef0cc 100644 --- a/includes.php +++ b/includes.php @@ -13,32 +13,37 @@ function get_data($item) { } function summon($person,$status) { - if ($person == "russ") { - $myFile = "russ.txt"; - $fh = fopen($myFile, 'w') or die("can't open file"); - fwrite($fh, $status); + $myFile = "summon.txt"; + $list = file("summon.txt"); + $fh = fopen($myFile, 'w') or die("can't open file"); + $matched=0; + foreach ($list as $summoned) { + list($item,$flag) = split("=",trim($summoned)); + if ($person == $item) { + fwrite($fh, "$person=$status\n"); + $matched=1; + } else { + if (strlen($item) > 0) { + fwrite($fh, "$item=$flag\n"); + } + } + } + fclose($fh); + if ($matched==0) { + $fh = fopen($myFile, 'a') or die("can't open file"); + fwrite($fh, "$person=$status\n"); fclose($fh); } - if ($person == "beth") { - $myFile = "beth.txt"; - $fh = fopen($myFile, 'w') or die("can't open file"); - fwrite($fh, $status); - fclose($fh); - } } function summon_status($person) { - if ($person == "russ") { - $myFile = "russ.txt"; - $fh = fopen($myFile, 'r') or die("can't open file"); - $status = fread($fh, 5); - fclose($fh); - } - if ($person == "beth") { - $myFile = "beth.txt"; - $fh = fopen($myFile, 'r') or die("can't open file"); - $status = fread($fh, 5); - fclose($fh); + $myFile = "summon.txt"; + $list = file("summon.txt"); + foreach ($list as $summoned) { + list($item,$flag) = split("=",$summoned); + if ($person == $item) { + return($flag); + } } return($status); } diff --git a/index.php b/index.php index f47bbef..e5a765a 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,6 @@ - @@ -228,18 +230,11 @@ function stopchanges(t) { function changeIcon(icon) { var icons=new Array(); - icons[0]="home"; - icons[1]="weather"; - icons[2]="lighting"; - icons[3]="music"; - icons[4]="cameras"; - icons[5]="security"; - icons[6]="climate"; - icons[7]="news"; - icons[8]="receipes"; - icons[9]="groceries"; - icons[10]="traffic"; - icons[11]="power"; + $icon) { + echo " icons[$key]='$icon';\n"; + } + ?> for ( var i=icons.length-1; i>=0; --i ){ if (icons[i] == icon) { document.getElementById(icon).src = "images/"+icon+"-on.png"; @@ -249,21 +244,8 @@ function changeIcon(icon) { } } -var securitypages=new Array(); - securitypages[0]="security1.html"; - securitypages[1]="security2.html"; - securitypages[2]="security3.html"; - securitypages[3]="security4.html"; - securitypages[4]="security5.html"; - securitypages[5]="security6.html"; - -function securitypageChange() { - ajaxpage(securitypages[i],'contentarea'); - i++; - if (i==securitypages.length) { - i=0; - } - t=setTimeout("securitypageChange()",10000); +function changepage() { + ajaxpage("cameras.php",'contentarea'); } function mediacenterSelect(ip) { @@ -327,8 +309,8 @@ function testDrawText3(canvas) context.shadowOffsetX=5; context.shadowOffsetY=5; context.shadowBlur=10; - context.fillText("HANDORF HOUSE", 10, 35); - context.strokeText("HANDORF HOUSE", 10, 35); + context.fillText("", 10, 35); + context.strokeText("", 10, 35); } testDrawText3(document.getElementById('canvas3')); @@ -362,7 +344,15 @@ title_status();
-Middle +
@@ -377,82 +367,69 @@ Middle - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- diff --git a/scripts/minify b/scripts/minify new file mode 100644 index 0000000..3524429 --- /dev/null +++ b/scripts/minify @@ -0,0 +1,104 @@ +#!/usr/bin/php -q + \ No newline at end of file diff --git a/set_summon_status.php b/set_summon_status.php index 9850723..2050b00 100644 --- a/set_summon_status.php +++ b/set_summon_status.php @@ -2,9 +2,10 @@ $person=$_GET['person']; $state=$_GET['status']; +include("config.php"); include("includes.php"); -echo "$person,$status"; +#echo "$person,$status"; summon($person,$status); ?> diff --git a/sqlite.php b/sqlite.php new file mode 100644 index 0000000..5752d9f --- /dev/null +++ b/sqlite.php @@ -0,0 +1,26 @@ + 0) { + // get each row as an array + // print values + echo ""; + while($row = sqlite_fetch_array($result)) { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + echo "
".$row[0]."".$row[1]."".$row[2]."
"; +} + +// all done +// close database file +sqlite_close($handle); +?> diff --git a/summon.txt b/summon.txt new file mode 100644 index 0000000..e69de29 diff --git a/test/check_isy99i_status-lights.php b/test/check_isy99i_status-lights.php new file mode 100644 index 0000000..f492bcc --- /dev/null +++ b/test/check_isy99i_status-lights.php @@ -0,0 +1,72 @@ +"; + #print_r($array); + foreach($array['nodes']['node'] as $device) { + if ($device['enabled'] == "true") { + switch($device['type']) { + case "1.66.67.0": + echo $device['name']."\n"; + break; + case "1.31.65.0": + echo $device['name']."\n"; + break; + case "2.56.66.0": + echo $device['name']."\n"; + break; + case "2.20.56.0": + echo $device['name']."\n"; + break; + case "2.9.56.0": + echo $device['name']."\n"; + break; + case "2.6.64.15": + echo $device['name']."\n"; + break; + case "2.26.58.0": + echo $device['name']."\n"; + break; + case "2.20.56.30": + echo $device['name']."\n"; + break; + case "2.8.66.0": + echo $device['name']."\n"; + break; + case "1.32.65.0": + echo $device['name']."\n"; + break; + case "2.26.65.0": + echo $device['name']."\n"; + break; + case "1.65.69.0": + echo $device['name']."\n"; + break; + case "2.16.56.0": + echo $device['name']."\n"; + break; + case "2.18.56.0": + echo $device['name']."\n"; + break; + #case "": + # echo $device['name']."\n"; + # break; + } + } + } + #exit; + #echo substr(($array['nodeInfo']['node']['property']['0_attr']['formatted']),0,-1)." F"; +?> diff --git a/weather-php-test.php b/weather-php-test.php new file mode 100644 index 0000000..41fa20a --- /dev/null +++ b/weather-php-test.php @@ -0,0 +1,107 @@ + +load('http://weather/weather/all-output.xml'); + $arrFeeds = array(); + foreach ($doc->getElementsByTagName('weather') as $node) { + $itemRSS = array ( + $item => $node->getElementsByTagName($item)->item(0)->nodeValue, + ); + array_push($arrFeeds, $itemRSS); + } + echo $itemRSS[$item]; +} +?> + + + + + + + + + + + + + + + + + + + + +
TemperatureWind
+
+
[No canvas support]
+
+
+
+
[No canvas support]
+
+ +
+ + diff --git a/weather2.php b/weather2.php index 9df1549..ec07e1b 100644 --- a/weather2.php +++ b/weather2.php @@ -1,4 +1,4 @@ - + diff --git a/weather4.php b/weather4.php index e6cd238..320dae0 100644 --- a/weather4.php +++ b/weather4.php @@ -1,5 +1,5 @@
- +