diff --git a/www/index.php b/www/index.php new file mode 100755 index 0000000..2742d53 --- /dev/null +++ b/www/index.php @@ -0,0 +1,55 @@ +&1', $output); +preg_match('/Temperature: (?P\d+)/',$output[0],$matches); +$data['temp']=$matches['value']; +preg_match('/Set Point: (?P\d+)/',$output[1],$matches); +$data['setpoint']=$matches['value']; +preg_match('/Mode: (?P\w+)/',$output[2],$matches); +$data['mode']=$matches['value']; +preg_match('/Fan Mode: (?P\w+)/',$output[3],$matches); +$data['fanmode']=$matches['value']; +preg_match('/Schedule Mode: (?P\w+)/',$output[4],$matches); +$data['schedmode']=$matches['value']; +?> + + +Thermostat Information + + +

Temperature:

+

Set Point:

+

Mode:

+

Fan Mode:

+

Schedule Mode:

+
+New Set Point:
+New System Mode: Off Heat Cool
+New Fan Mode: On Auto
+New Schedule Mode: Run Hold
+
+
+ + diff --git a/www/jquery.serialize-object.min.js b/www/jquery.serialize-object.min.js new file mode 100644 index 0000000..2587502 --- /dev/null +++ b/www/jquery.serialize-object.min.js @@ -0,0 +1,34 @@ +/** + * jQuery serializeObject + * @copyright 2014, macek + * @link https://github.com/macek/jquery-serialize-object + * @license BSD + * @version 2.4.3 +Copyright (c) 2014, Paul Macek +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +* The names of its contributors will not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE + */ +!function(e,r){if("function"==typeof define&&define.amd)define(["exports","jquery"],function(e,i){return r(e,i)});else if("undefined"!=typeof exports){var i=require("jquery");r(exports,i)}else r(e,e.jQuery||e.Zepto||e.ender||e.$)}(this,function(e,r){function i(e,i){function n(e,r,i){return e[r]=i,e}function a(e,r){for(var i,a=e.match(t.key);void 0!==(i=a.pop());)if(t.push.test(i)){var o=s(e.replace(/\[\]$/,""));r=n([],o,r)}else t.fixed.test(i)?r=n([],i,r):t.named.test(i)&&(r=n({},i,r));return r}function s(e){return void 0===h[e]&&(h[e]=0),h[e]++}function o(e){switch(r('[name="'+e.name+'"]',i).attr("type")){case"checkbox":return"on"===e.value?!0:e.value;default:return e.value}}function u(r){if(!t.validate.test(r.name))return this;var i=a(r.name,o(r));return c=e.extend(!0,c,i),this}function f(r){if(!e.isArray(r))throw new Error("formSerializer.addPairs expects an Array");for(var i=0,t=r.length;t>i;i++)this.addPair(r[i]);return this}function d(){return c}function l(){return JSON.stringify(d())}var c={},h={};this.addPair=u,this.addPairs=f,this.serialize=d,this.serializeJSON=l}var t={validate:/^[a-z_][a-z0-9_]*(?:\[(?:\d*|[a-z0-9_]+)\])*$/i,key:/[a-z0-9_]+|(?=\[\])/gi,push:/^$/,fixed:/^\d+$/,named:/^[a-z0-9_]+$/i};return i.patterns=t,i.serializeObject=function(){return this.length>1?new Error("jquery-serialize-object can only serialize one form at a time"):new i(r,this).addPairs(this.serializeArray()).serialize()},i.serializeJSON=function(){return this.length>1?new Error("jquery-serialize-object can only serialize one form at a time"):new i(r,this).addPairs(this.serializeArray()).serializeJSON()},"undefined"!=typeof r.fn&&(r.fn.serializeObject=i.serializeObject,r.fn.serializeJSON=i.serializeJSON),e.FormSerializer=i,i}); diff --git a/www/sched.html b/www/sched.html new file mode 100755 index 0000000..e79de78 --- /dev/null +++ b/www/sched.html @@ -0,0 +1,261 @@ + + +Thermostat Schedule + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Day
MorningDayEveningNight
Sunday:Time:
AMPM
Heat:Time:
AMPM
Heat:Time:
AMPM
Heat:Time:
AMPM
Heat:
Cool:Cool:Cool:Cool:
Monday:Time:
AMPM
Heat:Time:
AMPM
Heat:Time:
AMPM
Heat:Time:
AMPM
Heat:
Cool:Cool:Cool:Cool:
Tuesday:Time:
AMPM
Heat:Time:
AMPM
Heat:Time:
AMPM
Heat:Time:
AMPM
Heat:
Cool:Cool:Cool:Cool:
Wednesday:Time:
AMPM
Heat:Time:
AMPM
Heat:Time:
AMPM
Heat:Time:
AMPM
Heat:
Cool:Cool:Cool:Cool:
Thursday:Time:
AMPM
Heat:Time:
AMPM
Heat:Time:
AMPM
Heat:Time:
AMPM
Heat:
Cool:Cool:Cool:Cool:
Friday:Time:
AMPM
Heat:Time:
AMPM
Heat:Time:
AMPM
Heat:Time:
AMPM
Heat:
Cool:Cool:Cool:Cool:
Saturday:Time:
AMPM
Heat:Time:
AMPM
Heat:Time:
AMPM
Heat:Time:
AMPM
Heat:
Cool:Cool:Cool:Cool:
+ + +
+ + \ No newline at end of file diff --git a/www/sched.php b/www/sched.php new file mode 100755 index 0000000..085414e --- /dev/null +++ b/www/sched.php @@ -0,0 +1,37 @@ + $value) { + if(preg_match('/day([1-7])_period([1-4])_(.*)/', $postkey, $matches)) { + if($matches[3]=="schedTime") { + $sched['day'.$matches[1].'_period'.$matches[2]][$matches[3]]=$value; + } + else { + $sched['day'.$matches[1].'_period'.$matches[2]][$matches[3]]=intval($value); + } + $sched['day'.$matches[1].'_period'.$matches[2]]['rcs_day_number']=intval($matches[1]); + $sched['day'.$matches[1].'_period'.$matches[2]]['rcs_period_number']=intval($matches[2]); + } + } + return json_encode($sched, JSON_PRETTY_PRINT); +} +if(isset($_POST['formaction'])) { + if($_POST['formaction']=="download") { + header('Content-type: application/octet-stream'); + header('Content-Disposition: attachment; filename="Schedule.txt"'); + echo formToJson($_POST); + } + if($_POST['formaction']=="send") { + $process=proc_open('/home/homecontrol/pyStat/schedStat.py -i', array( 0=> array("pipe", "r")), $pipes); + if (is_resource($process)) { + fwrite($pipes[0],formToJson($_POST)); + fclose($pipes[0]); + } + proc_close($process); + } +} +else { + exec('/home/homecontrol/pyStat/schedStat.py -o 2>&1', $output); + echo implode("\n", $output); +} +?> \ No newline at end of file