// // G2 Solar Controller Web Reporting Function // String readString = ""; // Used to store Form value /* Read web command strings This function checks if any of the web buttons have been selected and sets the Pump state variables appropriately (PumpControl function uses these states to actually control the pumps) */ void doreadStringAction() { if (readString.indexOf("?panelleadon") >0) { state_panel_lead = PUMP_ON; } else { if (readString.indexOf("?panelleadoff") >0) { state_panel_lead = PUMP_OFF; } else { if (readString.indexOf("?panelleadauto") >0) { state_panel_lead = PUMP_AUTO; } else { if (readString.indexOf("?panellagon") >0) { state_panel_lag = PUMP_ON; } else { if (readString.indexOf("?panellagoff") >0) { state_panel_lag = PUMP_OFF; } else { if (readString.indexOf("?panellagauto") >0) { state_panel_lag = PUMP_AUTO; } else { if (readString.indexOf("?dhwon") >0) { state_dhw = PUMP_ON; } else { if (readString.indexOf("?dhwoff") >0) { state_dhw = PUMP_OFF; } else { if (readString.indexOf("?dhwauto") >0) { state_dhw = PUMP_AUTO; } else { if (readString.indexOf("?heaton") >0) { state_heat = PUMP_ON; } else { if (readString.indexOf("?heatoff") >0) { state_heat = PUMP_OFF; } else { if (readString.indexOf("?heatauto") >0) { state_heat = PUMP_AUTO; } else { if (readString.indexOf("?auto") >0) { state_panel_lead = PUMP_AUTO; state_panel_lag = PUMP_AUTO; state_dhw = PUMP_AUTO; state_heat = PUMP_AUTO; } else { if (readString.indexOf("?alloff") >0) { state_panel_lead = PUMP_OFF; state_panel_lag = PUMP_OFF; state_dhw = PUMP_OFF; state_heat = PUMP_OFF; } } } }}}}}}}}}}} } /* Web reporting Provides html to draw the web page and buttons and reports the temps and pump states Updates form values when buttons are pressed to be acted on by doreadStringAction above */ void WebReporting() { // listen for incoming clients EthernetClient client = server.available(); if ( client ) // then send html to web page { while (client.connected()) { if (client.available()) { // start up the server and get string char c = client.read(); if (readString.length() < 100) { readString += c; } if (c == '\n') { client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println(""); client.println(); // send head client.print(""); client.print(""); client.print("RHR Solar Control System"); client.println(""); // This is used to refresh the page client.print(""); // send body client.print(""); client.println(); client.print(""); client.print(""); client.print(""); client.print(""); client.print(""); client.print(""); client.print(""); client.print(""); client.print(""); client.print("

Solar Collection, Hot Water and Heat Control System

"); client.print("

Main Temperatures

"); client.print("Panel Temperature         = "); client.println(panelT); client.print("
"); client.print("sUpply Temperature       = "); client.println(supplyT); client.print("
"); client.print("Outside Temperature      = "); client.println(outsideT); client.print("
"); client.print("Storage Temperature      = "); client.println(storageT); client.print("
"); client.print("Hot Water Temperature   = "); client.println(dhwT); client.print("
"); client.print("
"); client.print("

Pump Control & Status

"); client.print("
"); client.print("Panel Lead Pump   "); client.print(""); client.print(""); client.print(""); client.print(" "); if (state_panel_lead == PUMP_AUTO) { client.print(" AUTO"); } else { if (state_panel_lead == PUMP_OFF) { client.print(" OFF"); } else { if (state_panel_lead == PUMP_ON) { client.print(" ON "); } else { client.print(" ????"); } } } if (digitalRead(PANEL_LEAD_PUMP_RELAY)) client.print(": STOPPED"); else client.print(": POWERED"); client.print("
"); client.print("
"); client.print("Panel Lag Pump    "); client.print(""); client.print(""); client.print(""); client.print(" "); if (state_panel_lag == PUMP_AUTO) { client.print(" AUTO"); } else { if (state_panel_lag == PUMP_OFF) { client.print(" OFF"); } else { if (state_panel_lag == PUMP_ON) { client.print(" ON "); } else { client.print(" ????"); } } } if (digitalRead(PANEL_LAG_PUMP_RELAY)) client.print(": STOPPED"); else client.print(": POWERED"); client.print("
"); client.print("
"); client.print("Hot Water Pump    "); client.print(""); client.print(""); client.print(""); client.print(" "); if (state_dhw == PUMP_AUTO) { client.print(" AUTO"); } else { if (state_dhw == PUMP_OFF) { client.print(" OFF"); } else { if (state_dhw == PUMP_ON) { client.print(" ON "); } else { client.print(" ????"); } } } if (digitalRead(DHW_PUMP_RELAY)) client.print(": STOPPED"); else client.print(": POWERED"); client.print("
"); client.print("
"); client.print("Heat Exchg Pump  "); client.print(""); client.print(""); client.print(""); client.print(" "); if (state_heat == PUMP_AUTO) { client.print(" AUTO"); } else { if (state_heat == PUMP_OFF) { client.print(" OFF"); } else { if (state_heat == PUMP_ON) { client.print(" ON "); } else { client.print(" ????"); } } } if (digitalRead(STORAGE_HEAT_RELAY)) client.print(": STOPPED"); else client.print(": POWERED"); client.print("
"); client.print("
"); client.print("            "); client.print("       "); client.print("       "); client.print("
"); client.print("
"); client.print("

All Temperatures

"); client.print("10k A Temp = "); client.println(TempA); client.print("
"); client.print("10k B Temp = "); client.println(TempB); client.print("
"); client.print("10k C Temp = "); client.println(TempC); client.print("
"); client.print("10k D Temp = "); client.println(TempD); client.print("
"); client.print("10k E Temp = "); client.println(TempE); client.print("
"); client.print("
"); client.print("pt1000 Temp = "); client.println(pt1000); client.print("
"); client.print("
"); client.print("D 1 Temp = "); client.println(DTemp1); client.print("
"); client.print("D 2 Temp = "); client.println(DTemp2); client.print("
"); client.print("D 3 Temp = "); client.println(DTemp3); client.print("
"); client.print("D 4 Temp = "); client.println(DTemp4); client.print("
"); client.print("
"); client.print("
"); client.print("

Information

"); client.print(""); client.print(timeDate); client.print("
"); client.print("Alarm state = "); if (ALARM != ALARM_OFF) { client.print(""); client.print(alarmMessage1); client.print(" "); client.println(alarmMessage2); } else { client.print(""); client.println ("no Alarms"); } client.print(""); client.print("
"); client.print("
"); client.print("Panel On Differential  = "); client.print( PanelOnDifferential ); // Panels must be this much warmer than sUpply to turn on pumps client.print("
"); client.print("Panel Lead-only Diff   = "); client.print( PanelLowDifferential ); // If Panels are only this much warmer, run slower client.print("
"); client.print("Panel Off Diff              = "); client.print( PanelOffDifferential ); // If Panels are only this much warmer, turn off client.print("
"); client.print("Hot Water On Diff       = "); client.print( HotWaterOnDifferential); // Storage must be this much warmer than dhw to turn on pump client.print("
"); client.print("Hot Water Off Diff      = "); client.print( HotWaterOffDifferential ); // If Storage is only this much warmer than dhw, turn off pump client.print("
"); client.print("
"); client.print("Too Cold for Heat        = "); client.print( StorageTooCold ); // If Storage isn't hot enough, don't run heat exch pump client.print("
"); client.print("Storage High Limit       = "); client.print( HIGHTEMP_LIMIT ); // shut off when this temperature is reached client.print("
"); client.print("Too Cold to use Panels = "); client.print( FREEZE_LIMIT ); // don't operate if outside temp is below this temperature client.print("
"); client.print("
"); client.print("
Arduio Solar Control System - by Tom Goldberg
"); client.println(""); Serial.println(readString); doreadStringAction(); readString = ""; client.stop(); } } } } }