????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.57 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/appsrv.astacus.se/rock_backup/ |
Upload File : |
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
include 'setup.php';
$text = "";
$mysqli = new mysqli("www.astacus.se", "carlhoffstedt", "Astacus2020!", "energicontrol");
$from = date('Y-m-d H:i:s', strtotime('-1 hour'));
$result = $mysqli->query("SELECT AVG(Value) as Value FROM tblEcoguard WHERE SensorType = 'T' and Time >= '$from' ORDER BY Time DESC LIMIT 1");
$VALUE = "";
while($obj = $result->fetch_object()){
$VALUE = $obj->Value;
$tempzone = "AVG -1";
$text .= "<br>".$tempzone."<br>";
}
if($VALUE == ""){
$from = date('Y-m-d H:i:s', strtotime('-2 hours'));
$result = $mysqli->query("SELECT AVG(Value) as Value FROM tblEcoguard WHERE SensorType = 'T' and Time >= '$from' ORDER BY Time DESC LIMIT 1");
$VALUE = "";
while($obj = $result->fetch_object()){
$VALUE = $obj->Value;
$tempzone = "AVG -2";
$text .= "<br>".$tempzone."<br>";
}
}
$text .= "<br>ROOM TEMP IS: ".$VALUE;
$command = escapeshellcmd('/usr/bin/python3 /var/www/html/python_thermia/getCurrentTemp.py');
$VP_TEMP = shell_exec($command);
$text .= "<br>VP TEMP IS: ".$VP_TEMP;
$now = date('Y-m-d\TH:00:00');
$result = $mysqli->query("SELECT * FROM tblPriceControl Where startTime = '".$now ."'");
$OnOff = "1";
while($obj = $result->fetch_object()){
$OnOff = $obj->OnOff;
$OnOffId = $obj->PriceControlId;
}
$now = date('Y-m-d\TH:00:00');
$result = $mysqli->query("SELECT * FROM tblWeatherControl Where startTime = '".$now ."'");
$Sun = "0";
while($obj = $result->fetch_object()){
$Sun = $obj->Sun;
}
$text .= "<br>OnOff:".$OnOff." Sun:".$Sun."<br>";
if(($VALUE <= ($minimum_temp + 0.2)) && ($OnOff == 0 || $OnOff == 2 ) ){
$text .= "<br>WARNING!! INDOOR TEMP TO LOW!! SET OnOff: 1<br>";
$OnOff = "2";
$mysqli->query("UPDATE tblPriceControl SET OnOff = 2 WHERE PriceControlId = '".$OnOffId ."'");
}
if($Sun == 1 && ($VALUE >= $minimum_temp)){
$command = escapeshellcmd('/usr/bin/python3 /var/www/html/python_thermia/setNewTemp.py '.($VP_TEMP -1));
$output = shell_exec($command);
}
echo("<br>".$output."<br>" );
$text .= "<br>".$output."<br>";
if($OnOff == "1" || $OnOff == "2" ){
$command = escapeshellcmd('/usr/bin/python3 /var/www/html/python_thermia/set_operation_mode.py AUTO');
$output = shell_exec($command);
$switch = "on";
exec('curl -X POST https://shelly-50-eu.shelly.cloud/device/relay/control -d "channel=0&turn='.$switch.'&id=4022d882f3dd&auth_key=MTMzODkwdWlk3B13133F889B2326C703DCF687698C8A28CDB509065B8A61DC96E121443714690A4DB9EF3943E321"', $output1, $retval);
}else{
$command = escapeshellcmd('/usr/bin/python3 /var/www/html/python_thermia/set_operation_mode.py OFF');
$output = shell_exec($command);
$switch = "off";
exec('curl -X POST https://shelly-50-eu.shelly.cloud/device/relay/control -d "channel=0&turn='.$switch.'&id=4022d882f3dd&auth_key=MTMzODkwdWlk3B13133F889B2326C703DCF687698C8A28CDB509065B8A61DC96E121443714690A4DB9EF3943E321"', $output1, $retval);
}
echo("<br>".$output."<br>" );
$text .= "<br>".$output."<br>";
if($VALUE < $wanted_temp){
if($VP_TEMP <= $minimum_temp){
$command = escapeshellcmd('/usr/bin/python3 /var/www/html/python_thermia/setNewTemp.py '.($VP_TEMP +1));
$output = shell_exec($command);
echo $output;
$text .= "<br>".$output."<br>";
$VP_TEMP = $VP_TEMP +1;
}
}else {
if($VP_TEMP > 15){
$command = escapeshellcmd('/usr/bin/python3 /var/www/html/python_thermia/setNewTemp.py '.($VP_TEMP -1));
$output = shell_exec($command);
echo $output;
$text .= "<br>".$output."<br>";
$VP_TEMP = $VP_TEMP -1;
}
}
$VALUE = str_replace("\r\n","",$VALUE);
$mysqli->query("INSERT INTO tblControlLog VALUES(null,'".$VP_TEMP."','".$VALUE."','".date('Y-m-d H:i:s')."','".$tempzone."','".$text."')");
?>