Skip to content

Commit

Permalink
Merge pull request #288 from dvdcut/master
Browse files Browse the repository at this point in the history
Circulation Pump Overrun #263 settings from gui
  • Loading branch information
pihome-shc committed Jun 23, 2020
2 parents cefd85a + 6b50cef commit c609e19
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 11 deletions.
2 changes: 1 addition & 1 deletion MySQL_Database/MySQL_View.sql
Expand Up @@ -60,7 +60,7 @@ where zone.`purge` = '0';
-- Boiler View
Drop View if exists boiler_view;
CREATE VIEW boiler_view AS
select boiler.status, boiler.sync, boiler.`purge`, boiler.fired_status, boiler.name, ctype.`type` AS controller_type, nodes.node_id, boiler.node_child_id, boiler.hysteresis_time, boiler.max_operation_time
select boiler.status, boiler.sync, boiler.`purge`, boiler.fired_status, boiler.name, ctype.`type` AS controller_type, nodes.node_id, boiler.node_child_id, boiler.hysteresis_time, boiler.max_operation_time, boiler.overrun
from boiler
join nodes on boiler.node_id = nodes.id
join nodes ctype on boiler.node_id = ctype.id
Expand Down
1 change: 1 addition & 0 deletions MySQL_Database/pihome_mysql_database.sql
Expand Up @@ -94,6 +94,7 @@ CREATE TABLE IF NOT EXISTS `boiler` (
`node_child_id` int(11),
`hysteresis_time` tinyint(4),
`max_operation_time` tinyint(4),
`overrun` SMALLINT(6) NULL DEFAULT NULL,
`datetime` timestamp NULL ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
KEY `FK_boiler_zone` (`node_id`),
Expand Down
2 changes: 1 addition & 1 deletion cron/boiler.php
Expand Up @@ -119,7 +119,7 @@ function scanArrayRecursively($arr, $index) {
$boiler_node_child_id = $row['node_child_id'];
$boiler_hysteresis_time = $row['hysteresis_time'];
$boiler_max_operation_time = $row['max_operation_time'];
$boiler_overrun_time = 1;
$boiler_overrun_time = $row['overrun'];

//Get data from nodes table
$query = "SELECT * FROM nodes WHERE node_id ='$boiler_node_id' AND status IS NOT NULL LIMIT 1;";
Expand Down
5 changes: 3 additions & 2 deletions db.php
Expand Up @@ -470,6 +470,7 @@
$node_child_id = $_GET['node_child_id'];
$hysteresis_time = $_GET['hysteresis_time'];
$max_operation_time = $_GET['max_operation_time'];
$overrun = $_GET['overrun'];
if ($status=='true'){$status = '1';} else {$status = '0';}

//Get id from nodes table
Expand All @@ -490,10 +491,10 @@
$result = $conn->query($query);
if (mysqli_num_rows($result)==0){
//No record in boiler table, so add
$query = "INSERT INTO `boiler` VALUES (1,0,0,1,1,'".$name."','".$row['id']."','".$node_child_id."','".$hysteresis_time."','".$max_operation_time."',now());";
$query = "INSERT INTO `boiler` VALUES (1,0,0,1,1,'".$name."','".$row['id']."','".$node_child_id."','".$hysteresis_time."','".$max_operation_time."','".$overrun."',now());";
} else {
//Update Boiler Setting
$query = "UPDATE boiler SET status = '".$status."', name = '".$name."', node_id = '".$row['id']."', node_child_id = '".$node_child_id."', hysteresis_time = '".$hysteresis_time."', max_operation_time = '".$max_operation_time."' where ID = 1;";
$query = "UPDATE boiler SET status = '".$status."', name = '".$name."', node_id = '".$row['id']."', node_child_id = '".$node_child_id."', hysteresis_time = '".$hysteresis_time."', max_operation_time = '".$max_operation_time."', overrun = '".$overrun."' where ID = 1;";
}
if($conn->query($query)){
header('Content-type: application/json');
Expand Down
1 change: 1 addition & 0 deletions js/request.js
Expand Up @@ -162,6 +162,7 @@ var idata="w=boiler_settings&o=update&status="+document.getElementById("checkbox
idata+="&node_child_id="+document.getElementById("node_child_id").value;
idata+="&hysteresis_time="+document.getElementById("hysteresis_time").value;
idata+="&max_operation_time="+document.getElementById("max_operation_time").value;
idata+="&overrun="+document.getElementById("overrun").value;
idata+="&wid=0";
$.get('db.php',idata)
.done(function(odata){
Expand Down
3 changes: 2 additions & 1 deletion languages/en.php
Expand Up @@ -90,7 +90,8 @@
$lang['boiler_info_text'] = "Boiler Settings and how Boiler interact with PiHome i.e Wirelss Controller or Connected to your Raspberry Pi GPIO Pin.";
$lang['notice_interval'] = "Notice Interval";
$lang['notice_interval_info'] = "Timeout for Boiler Controller in minutes Before Controller Marked Faulty.";

$lang['boiler_overrun'] = "Overrun";
$lang['boiler_overrun_info'] = "Time for boiler to circulate the water to dissipate residual heat.";

$lang['override'] = "Override";
$lang['boost'] = "Boost";
Expand Down
2 changes: 2 additions & 0 deletions languages/fr.php
Expand Up @@ -110,6 +110,8 @@
$lang['boiler_info_text'] = "Boiler/Heat Shource Settings and how Boiler/Heat shource is intract with PiHome i.e Wirelss Controller or Connected to GPIO Pin";
$lang['notice_interval'] = "Notice Interval";
$lang['notice_interval_info'] = "Timeout for Boiler Controller in minutes Before Controller Marked Faulty";
$lang['boiler_overrun'] = "Overrun";
$lang['boiler_overrun_info'] = "Temps pour que la chaudière fasse circuler l'eau pour dissiper la chaleur résiduelle.";

$lang['add_boost'] = "Add Boost";
$lang['boost_time_info'] = "Maximum Boost Time in Minutes";
Expand Down
3 changes: 2 additions & 1 deletion languages/it.php
Expand Up @@ -108,7 +108,8 @@
$lang['boiler_info_text'] = "Impostazioni caldaia e come la caldaia comunica con PiHome es. Controller Wirelss o connessa ai Pin Raspberry Pi GPIO.";
$lang['notice_interval'] = "Intervallo notifica";
$lang['notice_interval_info'] = "Timeout per controller caldaia, in minuti, prima di essere segnalato malfunzionamento.";

$lang['boiler_overrun'] = "Overrun";
$lang['boiler_overrun_info'] = "Tempo impiegato dalla caldaia per far circolare l'acqua per dissipare il calore residuo.";

$lang['override'] = "Override";
$lang['boost'] = "Boost";
Expand Down
3 changes: 2 additions & 1 deletion languages/lv.php
Expand Up @@ -91,7 +91,8 @@
$lang['boiler_info_text'] = "Katla iestatījumi un tas, kā katls mijiedarbojas ar PiHome, piem., vai bezvadu kontrolieris savienots ar jūsu Raspberry Pi GPIO Pin.";
$lang['notice_interval'] = "Paziņojuma intervāls";
$lang['notice_interval_info'] = "Apkures katla regulatora noilgums minūtēs pirms kontrolieris atzīmēs kļūdu.";

$lang['boiler_overrun'] = "Overrun";
$lang['boiler_overrun_info'] = "Laiks katlam cirkulēt ūdenī, lai izkliedētu atlikušo siltumu.";

$lang['override'] = "Ignorēt";
$lang['boost'] = "Uzsildīšana";
Expand Down
2 changes: 2 additions & 0 deletions languages/pt.php
Expand Up @@ -90,6 +90,8 @@
$lang['boiler_info_text'] = "Boiler/Heat Shource Settings and how Boiler/Heat shource is intract with PiHome i.e Wirelss Controller or Connected to GPIO Pin";
$lang['notice_interval'] = "Notice Interval";
$lang['notice_interval_info'] = "Timeout for Boiler Controller in minutes Before Controller Marked Faulty";
$lang['boiler_overrun'] = "Overrun";
$lang['boiler_overrun_info'] = "Hora da caldeira circular a água para dissipar o calor residual.";

$lang['override'] = "Modo Manual";
$lang['boost'] = "Boost";
Expand Down
3 changes: 2 additions & 1 deletion languages/ro.php
Expand Up @@ -90,7 +90,8 @@
$lang['boiler_info_text'] = "Setări ale centralei și modul în care centrala interacționează cu PiHome Ex: Controlerul Wireless sau conectat la Raspberry Pi GPIO.";
$lang['notice_interval'] = "Interval de notificare";
$lang['notice_interval_info'] = "Perioada inactivă (în minute) pentru controlerul centralei înainte ca acesta să fie marcat ca defect.";

$lang['boiler_overrun'] = "Overrun";
$lang['boiler_overrun_info'] = "Timpul cazanului să circule cu apa pentru a disipa căldura reziduală.";

$lang['override'] = "Suprascriere";
$lang['boost'] = "Stimulare";
Expand Down
25 changes: 23 additions & 2 deletions model.php
Expand Up @@ -209,8 +209,8 @@
if ($ncount > 0){
$query = "SELECT * FROM boiler;";
$bresult = $conn->query($query);
$bcount = $bresult->num_rows;
if ($bcount > 0) { $brow = mysqli_fetch_array($bresult); }
$bcount = $bresult->num_rows;
if ($bcount > 0) { $brow = mysqli_fetch_array($bresult); }
echo '<p class="text-muted">'.$lang['boiler_info_text'].'</p>';

echo '
Expand Down Expand Up @@ -337,6 +337,27 @@
<div class="help-block with-errors">
</div>
</div>
<div class="form-group" class="control-label"><label>'.$lang['boiler_overrun'].'</label> <small class="text-muted">'.$lang['boiler_overrun_info'].'</small>
<select class="form-control input-sm" type="text" id="overrun" name="overrun">
<option selected>'.$brow['overrun'].'</option>
<option value="-1">Keep valve open until next boiler start</option>
<option value="0">Disable</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
</select>
<div class="help-block with-errors">
</div>
</div>
<!-- /.form-group -->
';
} else {
Expand Down
2 changes: 1 addition & 1 deletion st_inc/db_config.ini
Expand Up @@ -6,4 +6,4 @@ dbname = pihome
connect_error = Sorry We are Experiencing MySQL Database Connection Problem...

version = 1.75
build = 180620
build = 220620

0 comments on commit c609e19

Please sign in to comment.