Heating and Ventilation Control
/HV_RollerShutter
Keine Erläuterungen gefunden.
<?php $RSfile = "./HVC/ConfDir/RSstate.json"; function HV_RollerShutter_showSwitches(){ global $RSfile; $stObj = readJSON($RSfile); $RSstate =dict2param($stObj); $RSnames = array_keys($RSstate); $html = "<div>\n"; $html.= "<form method='POST' action='?what2do=writeRS'>\n"; $html.= "<table class='color'>\n"; for($rs=0;$rs<count($RSnames);$rs++){ $html.= switchPanel($RSnames[$rs], $RSstate[$RSnames[$rs]]); } $html.= "</table>\n"; $html.= "</form>\n</div>\n"; return $html; } function switchPanel($name, $state){ $html = "<tr><td>".$name."</td>"; if($state=="close"){$extraStyle="style='color:black; background-color:yellow;'";}else{$extraStyle = "";} $html.= "<td><button class='formField'".$extraStyle."type='submit' name='".$name."' value='close'>close</button></td>"; if($state=="stop"){$extraStyle="style='color:black; background-color:yellow;'";}else{$extraStyle = "";} $html.= "<td><button class='formField'".$extraStyle."type='submit' name='".$name."' value='stop'>stop</button></td>"; if($state=="open"){$extraStyle="style='color:black; background-color:yellow;'";}else{$extraStyle = "";} $html.= "<td><button class='formField'".$extraStyle."type='submit' name='".$name."' value='open'>open</button></td>"; if($state=="auto"){$extraStyle="style='color:black; background-color:yellow;'";}else{$extraStyle = "";} $html.= "<td><button class='formField'".$extraStyle."type='submit' name='".$name."' value='auto'>auto</button></td>"; $html.= "</tr>"; return $html; } function HV_RollerShutter_POST(){ global $RSfile; $stObj = readJSON($RSfile); $RSstate =dict2param($stObj); $RSnames = array_keys($RSstate); for($rs=0;$rs<count($RSnames);$rs++){ if(isset($_POST[$RSnames[$rs]])){ $RSstate[$RSnames[$rs]] = $_POST[$RSnames[$rs]]; } } #rs #print_r($RSstate); return $RSstate; } function HV_RollerShutter_writeRS($RSstates){ global $RSfile; writeJSON($RSstates,$RSfile); $html = "<p style='width:100%; text-align:center;'>Rollläden Stati geschrieben.</p>"; return $html; } ?>
python
php
Der gesamte Sourcecode darf gemäß GNU General Public License weiterverbreitet werden.