diff --git a/html/highcharts/dark-unica.js b/html/highcharts/dark-unica.js
old mode 100644
new mode 100755
diff --git a/html/highcharts/exporting.js b/html/highcharts/exporting.js
old mode 100644
new mode 100755
diff --git a/html/highcharts/highstock.js b/html/highcharts/highstock.js
old mode 100644
new mode 100755
diff --git a/modules/gpio/control_close b/modules/gpio/control_close
index 9e9231f87..d6f0f48e0 100755
--- a/modules/gpio/control_close
+++ b/modules/gpio/control_close
@@ -6,4 +6,3 @@ date=$(date +%y%m%d-%H%M)
gl="$1"
sudo /bin/kill -9 `pgrep -l -f control_proc |grep $gl | awk '{print $1}'`
-
diff --git a/modules/gpio/html/gpio_add.php b/modules/gpio/html/gpio_add.php
index 359127440..51ccb86cd 100755
--- a/modules/gpio/html/gpio_add.php
+++ b/modules/gpio/html/gpio_add.php
@@ -7,10 +7,10 @@
if ( $add == "ADD") {
$db = new PDO('sqlite:dbf/nettemp.db');
if (!empty($gpioad)) {
- $db->exec("INSERT INTO gpio (gpio, name, status) VALUES ('$gpio','new_$gpio','OFF')") or die ($db->lastErrorMsg());
+ $db->exec("INSERT INTO gpio (gpio, name, status) VALUES ('$gpio','new_$gpio','OFF')") or exit(header("Location: html/errors/db_error.php"));
}
else {
- $db->exec("DELETE FROM gpio WHERE gpio='$gpio'") or die ($db->lastErrorMsg());
+ $db->exec("DELETE FROM gpio WHERE gpio='$gpio'") or exit(header("Location: html/errors/db_error.php"));
}
$db = NULL;
header("location: " . $_SERVER['REQUEST_URI']);
@@ -47,7 +47,7 @@
query("SELECT * FROM gpio WHERE gpio='$value1'");
+ $rows = $db->query("SELECT * FROM gpio WHERE gpio='$value1'") or exit(header("Location: html/errors/db_error.php"));
$row = $rows->fetchAll();
foreach ($row as $result) {
$added[] = $result['gpio'];
diff --git a/modules/gpio/html/gpio_buzzer.php b/modules/gpio/html/gpio_buzzer.php
index d653091de..108e514a9 100755
--- a/modules/gpio/html/gpio_buzzer.php
+++ b/modules/gpio/html/gpio_buzzer.php
@@ -2,7 +2,7 @@
$buzzerexit = isset($_POST['buzzerexit']) ? $_POST['buzzerexit'] : '';
if (($buzzerexit == "buzzerexit") ){
- $db->exec("UPDATE gpio SET mode='' where gpio='$gpio_post' ") or die("simple off db error");
+ $db->exec("UPDATE gpio SET mode='' where gpio='$gpio_post' ") or exit(header("Location: html/errors/db_error.php"));
$db = null;
header("location: " . $_SERVER['REQUEST_URI']);
exit();
diff --git a/modules/gpio/html/gpio_control.php b/modules/gpio/html/gpio_control.php
index 28004666f..74d2064d4 100755
--- a/modules/gpio/html/gpio_control.php
+++ b/modules/gpio/html/gpio_control.php
@@ -2,7 +2,7 @@
$control = isset($_POST['control']) ? $_POST['control'] : '';
$save = isset($_POST['save']) ? $_POST['save'] : '';
if (($save == "save") ){
- $db->exec("UPDATE gpio SET control='$control' where gpio='$gpio_post' ") or die("simple off db error");
+ $db->exec("UPDATE gpio SET control='$control' where gpio='$gpio_post' ") or exit(header("Location: html/errors/db_error.php"));
$db = null;
header("location: " . $_SERVER['REQUEST_URI']);
exit();
@@ -11,7 +11,7 @@
$exit = isset($_POST['exit']) ? $_POST['exit'] : '';
if (($exit == "control_exit") ){
- $db->exec("UPDATE gpio SET mode='' where gpio='$gpio_post' ") or die("simple off db error");
+ $db->exec("UPDATE gpio SET mode='' where gpio='$gpio_post' ") or exit(header("Location: html/errors/db_error.php"));
$db = null;
header("location: " . $_SERVER['REQUEST_URI']);
exit();
@@ -19,7 +19,7 @@
$controlrun = isset($_POST['controlrun']) ? $_POST['controlrun'] : '';
if ($controlrun == "on") {
- $db->exec("UPDATE gpio SET control_run='on', status='Wait' WHERE gpio='$gpio_post'") or die("exec error");
+ $db->exec("UPDATE gpio SET control_run='on', status='Wait' WHERE gpio='$gpio_post'") or exit(header("Location: html/errors/db_error.php"));
$db = null;
$cmd=("nohup modules/gpio/control_proc $gpio_post");
shell_exec( $cmd . "> /dev/null 2>/dev/null &" );
@@ -27,7 +27,7 @@
exit();
}
if ($controlrun == "off") {
- $db->exec("UPDATE gpio SET control_run='', status='OFF' WHERE gpio='$gpio_post'") or die("exec error");
+ $db->exec("UPDATE gpio SET control_run='', status='OFF' WHERE gpio='$gpio_post'") or exit(header("Location: html/errors/db_error.php"));
$db = null;
shell_exec("modules/gpio/control_close $gpio_post");
header("location: " . $_SERVER['REQUEST_URI']);
diff --git a/modules/gpio/html/gpio_controls.php b/modules/gpio/html/gpio_controls.php
index a5f07cc2f..34cde453b 100755
--- a/modules/gpio/html/gpio_controls.php
+++ b/modules/gpio/html/gpio_controls.php
@@ -6,7 +6,7 @@
$simple = isset($_POST['simple']) ? $_POST['simple'] : '';
$onoff = isset($_POST['onoff']) ? $_POST['onoff'] : '';
if (($onoff == "onoff")){
- $db->exec("UPDATE gpio SET simple='$simple', status='$simple' WHERE gpio='$gpio_post'") or die("PDO exec error");
+ $db->exec("UPDATE gpio SET simple='$simple', status='$simple' WHERE gpio='$gpio_post'") or exit(header("Location: html/errors/db_error.php"));
if ($simple == 'on'){
include('modules/gpio/html/gpio_on.php');
} else {
@@ -32,13 +32,13 @@
$trigger = isset($_POST['trigger']) ? $_POST['trigger'] : '';
if ($triggeronoff == "onoff") {
if ( $trigger == 'on' ) {
- $db->exec("UPDATE gpio SET trigger_run='on', status='Wait' WHERE gpio='$gpio_post'") or die("exec error");
+ $db->exec("UPDATE gpio SET trigger_run='on', status='Wait' WHERE gpio='$gpio_post'") or exit(header("Location: html/errors/db_error.php"));
$db = null;
$cmd=("nohup modules/gpio/trigger_proc $gpio_post");
shell_exec( $cmd . "> /dev/null 2>/dev/null &" );
} else {
- $db->exec("UPDATE gpio SET trigger_run='', status='OFF' WHERE gpio='$gpio_post'") or die("exec error");
+ $db->exec("UPDATE gpio SET trigger_run='', status='CONTROLS OFF' WHERE gpio='$gpio_post'") or exit(header("Location: html/errors/db_error.php"));
$db = null;
shell_exec("modules/gpio/trigger_close $gpio_post");
}
@@ -56,7 +56,7 @@
-$sth2 = $db->prepare("select * from gpio where mode='simple'");
+$sth2 = $db->prepare("select * from gpio where mode='simple'") or exit(header("Location: html/errors/db_error.php"));
$sth2->execute();
$result2 = $sth2->fetchAll();
foreach ( $result2 as $a) {
diff --git a/modules/gpio/html/gpio_trigger.php b/modules/gpio/html/gpio_trigger.php
index 273907f9d..3faea5a79 100755
--- a/modules/gpio/html/gpio_trigger.php
+++ b/modules/gpio/html/gpio_trigger.php
@@ -2,7 +2,7 @@
$triggerexit = isset($_POST['triggerexit']) ? $_POST['triggerexit'] : '';
if (($triggerexit == "triggerexit") ){
- $db->exec("UPDATE gpio SET mode='' where gpio='$gpio_post' ") or die("humid off db error");
+ $db->exec("UPDATE gpio SET mode='' where gpio='$gpio_post' ") or exit(header("Location: html/errors/db_error.php"));
$db = null;
header("location: " . $_SERVER['REQUEST_URI']);
exit();
@@ -11,7 +11,7 @@
$triggerrun = isset($_POST['triggerrun']) ? $_POST['triggerrun'] : '';
if ($triggerrun == "on") {
- $db->exec("UPDATE gpio SET trigger_run='on', status='Wait' WHERE gpio='$gpio_post'") or die("exec error");
+ $db->exec("UPDATE gpio SET trigger_run='on', status='Wait' WHERE gpio='$gpio_post'") or exit(header("Location: html/errors/db_error.php"));
$db = null;
$cmd=("nohup modules/gpio/trigger_proc $gpio_post");
shell_exec( $cmd . "> /dev/null 2>/dev/null &" );
@@ -19,7 +19,7 @@
exit();
}
if ($triggerrun == "off") {
- $db->exec("UPDATE gpio SET trigger_run='', status='OFF' WHERE gpio='$gpio_post'") or die("exec error");
+ $db->exec("UPDATE gpio SET trigger_run='', status='WWW OFF' WHERE gpio='$gpio_post'") or exit(header("Location: html/errors/db_error.php"));
$db = null;
shell_exec("modules/gpio/trigger_close $gpio_post");
header("location: " . $_SERVER['REQUEST_URI']);
@@ -32,7 +32,7 @@
$tout=isset($_POST["tout".$num]) ? $_POST["tout".$num] : '';
if (($toutonoff == "onoff") && (!empty($tout))) {
$tout == "off" ? $tout='' : "";
- $db->exec("UPDATE gpio SET tout$num='$tout' WHERE gpio='$gpio_post'") or die("exec error");
+ $db->exec("UPDATE gpio SET tout$num='$tout' WHERE gpio='$gpio_post'") or exit(header("Location: html/errors/db_error.php"));
$db = null;
header("location: " . $_SERVER['REQUEST_URI']);
exit();
diff --git a/modules/gpio/html/gpio_triggerout.php b/modules/gpio/html/gpio_triggerout.php
index dc72ab06d..c55a60ffd 100755
--- a/modules/gpio/html/gpio_triggerout.php
+++ b/modules/gpio/html/gpio_triggerout.php
@@ -1,7 +1,7 @@
exec("UPDATE gpio SET mode='' where gpio='$gpio_post' ") or die("simple off db error");
+ $db->exec("UPDATE gpio SET mode='' where gpio='$gpio_post' ") or exit(header("Location: html/errors/db_error.php"));
$db = null;
header("location: " . $_SERVER['REQUEST_URI']);
exit();
diff --git a/modules/gpio/trigger_close b/modules/gpio/trigger_close
index 59c6196c6..d2091951d 100755
--- a/modules/gpio/trigger_close
+++ b/modules/gpio/trigger_close
@@ -26,6 +26,7 @@ function close {
close
+sqlite3 $dir/dbf/nettemp.db "UPDATE gpio SET trigger_run='', status='BUTTON OFF' WHERE gpio='$gl'"
fil=$(ls $dir/tmp/mail/hour/ |grep alarm$gl)
for i in $fil; do
diff --git a/modules/gpio/trigger_proc b/modules/gpio/trigger_proc
index 28c324e68..4d5c82766 100755
--- a/modules/gpio/trigger_proc
+++ b/modules/gpio/trigger_proc
@@ -17,8 +17,8 @@ function triggerout_gpio {
else
/usr/local/bin/gpio -g write $g 1
fi
- ledalarm
done
+
}
function ledalarm {
@@ -70,11 +70,12 @@ do
status=$(/usr/local/bin/gpio -g read $gpio)
if [[ "$status" = "0" && "$rev" = "on" ]] || [[ "$status" = "1" && "$rev" = "" ]]
then
- trigger="on"
- triggerout_gpio
- mail
- sqlite3 $dir/dbf/nettemp.db "UPDATE gpio SET status='ALARM' WHERE gpio='$gpio'"
- $dir/modules/gpio/timestamp $gpio
+ trigger="on"
+ triggerout_gpio
+ ledalarm &
+ mail
+ sqlite3 $dir/dbf/nettemp.db "UPDATE gpio SET status='ALARM' WHERE gpio='$gpio'"
+ $dir/modules/gpio/timestamp $gpio
break
fi
sleep 0.1
diff --git a/readme.md b/readme.md
index b52d1d055..33af70f26 100755
--- a/readme.md
+++ b/readme.md
@@ -45,8 +45,10 @@ USERS:
Changelog:
-8.6.1
+8.6.2
+fix trigger, mail notification
+8.6.1
Fix not working HIGH/LOW reverse state.
8.6