\n\4"; fwrite($fp, $in); $ret = ''; $cnt = 0; while ($cnt < 4 && $fp && !feof($fp)) { $ret .= fgets($fp, 128); $c = fgetc($fp); if ($c == "\4") { if (ereg ("([^<]+)", $ret,$regs)) $ret = $regs[1]; break; } $ret .= $c; $cnt++; } return $ret; } function knxwrite($fp, $name, $value) { $in = "\n\4"; fwrite($fp, $in); $ret = ''; $cnt = 0; while ($cnt < 4 && $fp && !feof($fp)) { $ret .= fgets($fp, 128); $c = fgetc($fp); if ($c == "\4") { if (ereg ("$name"); if (knxread($fp, $gad) != 0) print("OnTurn Off"); else print("OffTurn On"); print("\n"); } function switching_status($fp, $name, $gad) { if (knxread($fp, $gad) != 0) print("$nameOn\n"); else print("$nameOff\n"); } function heating($fp, $name, $id) { print("$name"); $val = knxread($fp, 'heating_'.$id); print(knxread($fp, 'temp_'.$id).''.$val.' ('.knxread($fp, 'setpoint_'.$id).")\n"); print ("C S N F\n"); } $address = "127.0.0.1"; $port = 1028; $fp = fsockopen($address, $port, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)
\n"; } else { if (isset($_REQUEST['action'])) { $action = $_REQUEST['action']; $gad = $_REQUEST['gad']; if ($action == 'On') { knxwrite($fp, $gad, 1); } elseif ($action == 'Off') { knxwrite($fp, $gad, 0); } elseif ($action == 'comfort') { knxwrite($fp, $gad, $action); } elseif ($action == 'standby') { knxwrite($fp, $gad, $action); } elseif ($action == 'night') { knxwrite($fp, $gad, $action); } elseif ($action == 'frost') { knxwrite($fp, $gad, $action); } } print("

Lighting

\n\n"); switching($fp, "Living room", "light_living"); switching($fp, "Dining room", "light_dining"); switching($fp, "Bedroom 2", "light_room2"); switching($fp, "Floor", "light_floor"); switching($fp, "Stair", "light_stair"); switching($fp, "Office", "light_office"); switching($fp, "Bedroom 1", "light_room1"); switching($fp, "Toilet 1", "light_toilet1"); switching($fp, "Kitchen", "light_kitchen"); switching($fp, "Toilet 0", "light_toilet0"); print("
\n

Heating

\n\n"); heating($fp, "Office", "office"); heating($fp, "Living room", "living"); heating($fp, "Bedroom 1", "room1"); heating($fp, "Bedroom 2", "room2"); heating($fp, "Kitchen", "kitchen"); switching($fp, "Bathroom", "heating_bath"); switching_status($fp, "Burner status", "burner"); print("
\n

Other

\n\n"); switching($fp, "Warm water circulator ", "circulator"); switching($fp, "Auto heating mode", "heating_auto"); switching($fp, "Alarm clock", "wakeup_active"); switching($fp, "Alarm active", "alarm_active"); switching($fp, "Intrusion", "intrusion"); print("
\n"); fclose($fp); } ?>