Skip to content

Commit

Permalink
Merge dev-branch to master: v1.0.8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
bombcheck committed Mar 8, 2018
2 parents 0f35a49 + ab00135 commit f1ec3a8
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 38 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# FB.Switch v1.0.8.1-STABLE
# FB.Switch [![GitHub release](https://img.shields.io/github/release/bombcheck/FB.Switch.svg)](https://github.com/bombcheck/FB.Switch/releases/latest)

*Webapp zur Steuerung und Verwaltung von 433-MHz-Funksteckdosen, FritzDect 200-Steckdosen und MiLight-Lampen.*

Expand All @@ -16,8 +16,8 @@
* Audio-Feedback beim Betätigen bestimmter Buttons und dem Abschluss bestimmter Operationen

## Voraussetzungen:
* Webserver mit Apache/PHP5 (z.B. einen Raspberry Pi)
* PHP-Curl-Modul wird benötigt
* Webserver mit Apache, PHP5 oder PHP7 (z.B. einen Raspberry Pi)
* PHP-Curl- und PHP-MB-String-Modul werden benötigt
* Benötigt keine Datenbank!

## Kompatible Hardware:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.8.1-STABLE
1.0.8.2-STABLE
17 changes: 7 additions & 10 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
$plugin = false;
$SysAlertMsg="FB.NET System Status KRITISCH";
$NoTimerAlertMsg="Timer ist deaktiviert";
$FileVer="2.42";
$FileVer="2.43";

//config.xml dateisystem rechte überprüfen
if(!file_exists($CONFIG_FILENAME)) {
Expand Down Expand Up @@ -183,18 +183,15 @@

}

function config_save($CONFIG_FILENAME, $xml) {
if(!isset($CONFIG_FILENAME)){
global $CONFIG_FILENAME;
}
if(!isset($xml)){
global $xml;
}
function config_save($CONFIGFILE = null, $xmldata = null) {
if($CONFIGFILE === null) { global $CONFIG_FILENAME; $CONFIGFILE = $CONFIG_FILENAME; }
if($xmldata === null) { global $xml; $xmldata = $xml; }

$dom = new DOMDocument('1.0');
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
$dom->loadXML($xml->asXML());
$dom->save($CONFIG_FILENAME);
$dom->loadXML($xmldata->asXML());
$dom->save($CONFIGFILE);
}

function check_config_global() {
Expand Down
20 changes: 10 additions & 10 deletions get_fbdect_temp.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
if ($NewOutdoorDateDiff > 1800) {
$NewOutdoorTemp = -1000;
} else $NewOutdoorTemp = $NewOutdoorTemp[0];
if ($NewOutdoorTemp == false || $NewOutdoorTemp == "") $NewOutdoorTemp = -1000;
if ($NewOutdoorTemp === false || $NewOutdoorTemp == "") $NewOutdoorTemp = -1000;
}
}

Expand All @@ -49,16 +49,16 @@
$XMLdata = Fritzbox_GetHAactorsInfoXML();
foreach($xml->devices->device as $device) {
if ($device->vendor == "fbdect200") {
if (Fritzbox_GetHAactorDataFromXML($XMLdata,trim($device->address->masterdip),'present') == 1) {
if($NewOutdoorTemp != false && trim($device->id) == $OutdoorTempSource) {
$ResStr .= trim($device->id).":".trim($NewOutdoorTemp)."|";
if($NewOutdoorTemp !== false && trim($device->id) == $OutdoorTempSource) {
$ResStr .= trim($device->id).":".trim($NewOutdoorTemp)."|";
} else {
if (Fritzbox_GetHAactorDataFromXML($XMLdata,trim($device->address->masterdip),'present') == 1) {
$ResStr .= trim($device->id).":".Fritzbox_GetHAactorDataFromXML($XMLdata,trim($device->address->masterdip),'temperature')."|";
} else {
$ResStr .= trim($device->id).":".Fritzbox_GetHAactorDataFromXML($XMLdata,trim($device->address->masterdip),'temperature')."|";
}
} else {
$ResStr .= trim($device->id).":-1000|";
}
}
$ResStr .= trim($device->id).":-1000|";
}
}
}
}
}
echo substr($ResStr, 0, strlen($ResStr)-1);
Expand Down
36 changes: 24 additions & 12 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
}
// Über Linkfunktion -> GET
if (isset($_GET['action'])) {
$r_action = (string)$_GET['action'];
$r_action = (string)$_GET['action'];
$r_type = (string)$_GET['type'];
$r_id = (string)$_GET['id'];
if (isset($_GET['async'])) {
Expand All @@ -28,16 +28,28 @@
exit();
}

if($r_action == "toggle" and $r_type == "device"){
$xpath='//device/id[.="'.$r_id.'"]/parent::*';
if($r_action == "toggle" and $r_type == "device"){
$xpath='//device/id[.="'.$r_id.'"]/parent::*';
$res = $xml->xpath($xpath);
$parent = $res[0];
if($parent[0]->status == "OFF"){
$r_action = "on";
}elseif($parent[0]->status == "ON"){
$r_action = "off";
}
}
if($parent[0]->status == "OFF"){
$r_action = "on";
}elseif($parent[0]->status == "ON"){
$r_action = "off";
}
}

if($r_action == "status" and $r_type == "device"){
$xpath='//device/id[.="'.$r_id.'"]/parent::*';
$res = $xml->xpath($xpath);
$parent = $res[0];
if($parent[0]->status == "OFF"){
echo "0";
}elseif($parent[0]->status == "ON"){
echo "1";
}
exit();
}
}
if (isset($_POST['todo'])) {
if ($_POST['todo'] == "sendmilight") {
Expand All @@ -51,10 +63,10 @@
if (isset($_GET['timerrun'])) {
require("send_msg.php");
require("timer.php");
include("countdowntimer.php");
include("countdowntimer.php");
if ($xml->global->timerGlobalRun != "false" && $xml->global->AlertState != "red") timer_check();
ping_check();
if ($xml->global->AlertState != "red") countdowntimer_check();
ping_check();
if ($xml->global->AlertState != "red") countdowntimer_check();
fbdect_check();
exit();
}
Expand Down
6 changes: 5 additions & 1 deletion js/fbswitch_1.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@
var DevicesTemp = response.split('|');
var IndoorTemp = "";
var OutdoorTemp = "";
var ShowTemp = false;

if (DevicesTemp.length > 0) {
for (tIndex = 0; tIndex < DevicesTemp.length; ++tIndex) {
Expand All @@ -220,12 +221,14 @@
IndoorTemp = parseInt(tempvar[1]) / 10;
if (IndoorTemp == -100) IndoorTemp = '---';
else IndoorTemp = IndoorTemp.toFixed(1) + ' °C';
ShowTemp = true;
}

if (tempvar[0] == <?php echo $OutdoorTempSource; ?>) {
OutdoorTemp = parseInt(tempvar[1]) / 10;
if (OutdoorTemp == -100) OutdoorTemp = '---';
else OutdoorTemp = OutdoorTemp.toFixed(1) + ' °C';
ShowTemp = true;
}
}
if (IndoorTemp == "") IndoorTemp = '---';
Expand Down Expand Up @@ -256,7 +259,8 @@
// var OutdoorTemp = '---';
// }

if (IndoorTemp != '---' || OutdoorTemp != '---') {
//if (IndoorTemp != '---' || OutdoorTemp != '---') {
if (ShowTemp == true) {
$('#tempmsg_favs').fadeIn('fast');
$('#tempmsg_devs').fadeIn('fast');
$('#tempmsg_groups').fadeIn('fast');
Expand Down
2 changes: 1 addition & 1 deletion milight_ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

$milight = new Milight($_GET['mlip'], (integer)$_GET['mlport']);
$milight->setDelay(0);
$milight->setRepeats(3);
$milight->setRepeats(1);
$milight->setRgbwActiveGroup((integer)$_GET['mlgroup']);

if (isset($_GET['off'])) {
Expand Down

0 comments on commit f1ec3a8

Please sign in to comment.