Skip to content
Permalink
Browse files

Merge pull request #552 from Alexandr-logrus/alpha

fix
  • Loading branch information...
sergejey committed May 13, 2019
2 parents b047d69 + 2cc37d9 commit 063207eb03b03d8ba7f79da10e9871daf539d5c7
@@ -2,7 +2,7 @@
if (defined('DISABLE_SIMPLE_DEVICES') && DISABLE_SIMPLE_DEVICES==1) return;
$ot = $params['object'];
$ot = $this->object_title;
//$latestActivity = $this->getProperty('LatestActivity');
$this->setProperty('LatestActivity', time());
@@ -1,19 +1,19 @@
<?php
$ot=$this->object_title;
if (!isset($params['statusUpdated'])) {
setTimeout($ot.'_pressed_status', '', 3);
$ot = $this->object_title;
if (!isset($params['statusUpdated'])) {
setTimeout($ot . '_pressed_status', '', 3);
$this->setProperty('status', 1);
}
}
//$this->callMethod('statusUpdated');
//$this->callMethod('logicAction');
//$this->callMethod('statusUpdated');
//$this->callMethod('logicAction');
$linked_room=$this->getProperty('linkedRoom');
if ($linked_room) {
callMethodSafe($linked_room.'.onActivity', array('sensor'=>$ot));
}
$linked_room=$this->getProperty('linkedRoom');
if ($linked_room) {
callMethodSafe($linked_room . '.onActivity', array('sensor' => $ot));
}
include_once(DIR_MODULES.'devices/devices.class.php');
$dv=new devices();
$dv->checkLinkedDevicesAction($this->object_title, $this->getProperty('status'));
include_once(DIR_MODULES . 'devices/devices.class.php');
$dv = new devices();
$dv->checkLinkedDevicesAction($ot, $this->getProperty('status'));
@@ -1,22 +1,22 @@
<?php
$old_value=(float)$params['OLD_VALUE'];
$new_value=(float)$params['NEW_VALUE'];
$old_value = (float)$params['OLD_VALUE'];
$new_value = (float)$params['NEW_VALUE'];
$diff = $new_value-$old_value;
if ($diff<0) {
if ($diff < 0) {
$diff = $new_value;
}
$conversion = (float)$this->getProperty('conversion');
if ($conversion>0) {
if ($conversion > 0) {
$diff = $diff * $conversion;
}
$data_value = (float)$this->getProperty('value');
$new_data_value = round(($data_value + $diff),3);
$new_data_value = round(($data_value + $diff), 3);
if ($data_value!=$new_data_value) {
$this->setProperty('value',$new_data_value);
if ($data_value != $new_data_value) {
$this->setProperty('value', $new_data_value);
}
@@ -3,21 +3,21 @@
$ot = $this->object_title;
$updatedTime = $this->getProperty('updated');
$passed = time() - $updatedTime;
$newTimeout=0;
$newTimeout = 0;
$passedText = getPassedText($updatedTime);
$this->setProperty('updatedText',$passedText);
$this->setProperty('updatedText', $passedText);
if ($passed<10) {
if ($passed < 10) {
$newTimeout = 10;
} elseif ($passed<60) {
} elseif ($passed < 60) {
$newTimeout = 10;
} elseif ($passed<60*60) {
} elseif ($passed < 60*60) {
$newTimeout = 60;
} elseif ($passed<20*60*60) {
} elseif ($passed < 20*60*60) {
$newTimeout = 60 * 60;
}
if ($newTimeout > 0) {
setTimeOut($ot.'_updateTime','callMethod("'.$ot.'.setUpdatedText");',$newTimeout);
setTimeOut($ot . '_updateTime', 'callMethod("' . $ot . '.setUpdatedText");', $newTimeout);
}
@@ -1,14 +1,14 @@
<?php
$level=$this->getProperty('level');
$minWork=$this->getProperty('minWork');
$maxWork=$this->getProperty('maxWork');
$levelWork=$this->getProperty('levelWork'); //
DebMes("Levelwork updated to ".$levelWork,'dimming');
if ($minWork!=$maxWork) {
$new_level=round((($levelWork-$minWork)/($maxWork-$minWork))*100);
if ($new_level!=$level) {
DebMes("Setting new level to ".$new_level,'dimming');
$this->setProperty('level',$new_level);
$level = $this->getProperty('level');
$minWork = $this->getProperty('minWork');
$maxWork = $this->getProperty('maxWork');
$levelWork = $this->getProperty('levelWork'); //
DebMes("Levelwork updated to " . $levelWork, 'dimming');
if ($minWork != $maxWork) {
$new_level = round((($levelWork-$minWork)/($maxWork-$minWork))*100);
if ($new_level != $level) {
DebMes("Setting new level to " . $new_level, 'dimming');
$this->setProperty('level', $new_level);
}
}
@@ -1,13 +1,13 @@
<?php
$status = $this->getProperty('status');
$level=$this->getProperty('level');
$levelSaved=$this->getProperty('levelSaved');
$level = $this->getProperty('level');
$levelSaved = $this->getProperty('levelSaved');
if ($this->getProperty('setMaxTurnOn')) {
$levelSaved=100;
$levelSaved = 100;
}
if ($status>0 && !$level && $levelSaved) {
$this->setProperty('level',$levelSaved);
if ($status > 0 && !$level && $levelSaved) {
$this->setProperty('level', $levelSaved);
} else {
$this->callMethod('logicAction');
include_once(DIR_MODULES . 'devices/devices.class.php');
@@ -1,9 +1,9 @@
<?php
$this->setProperty('status', 1);
$this->setProperty('status', 1);
if ($this->getProperty('level')==0) {
if ($this->getProperty('level') == 0) {
$this->setProperty('level', 100);
} else {
} else {
$this->setProperty('level', $this->getProperty('level'));
}
}
@@ -1,24 +1,24 @@
<?php
$ot=$this->object_title;
$ot = $this->object_title;
$tm=time();
$tm = time();
$this->setProperty('updated', $tm);
$this->setProperty('updatedText', date('H:i', $tm));
if ($this->getProperty('alive') == 0) {
$this->setProperty('alive', 1);
}
$alive_timeout=(int)$this->getProperty('aliveTimeout')*60*60;
$alive_timeout = (int)$this->getProperty('aliveTimeout')*60*60;
if (!$alive_timeout) {
$alive_timeout=2*24*60*60; // 2 days alive timeout by default
}
setTimeout($ot.'_alive_timer', 'setGlobal("'.$ot.'.alive", 0);', $alive_timeout);
setTimeout($ot . '_alive_timer', 'setGlobal("' . $ot . '.alive", 0);', $alive_timeout);
$this->callMethodSafe('logicAction');
include_once(DIR_MODULES.'devices/devices.class.php');
include_once(DIR_MODULES . 'devices/devices.class.php');
$dv=new devices();
$dv->checkLinkedDevicesAction($this->object_title, $this->getProperty('status'));
$dv->checkLinkedDevicesAction($ot, $this->getProperty('status'));
@@ -31,7 +31,7 @@
$nobodyhome_timeout = SETTINGS_BEHAVIOR_NOBODYHOME_TIMEOUT * 60;
}
if ($nobodyhome_timeout) {
setTimeOut("nobodyHome", "callMethodSafe('NobodyHomeMode.activate');", $nobodyhome_timeout);
setTimeOut('nobodyHome', "callMethodSafe('NobodyHomeMode.activate');", $nobodyhome_timeout);
}
$linked_room = $this->getProperty('linkedRoom');
@@ -1,15 +1,15 @@
<?php
$color=$this->getProperty('color');
$color = $this->getProperty('color');
$hsv = hexToHsv($color);
if ($hsv && is_array($hsv)) {
$this->setProperty('hue', intval( $hsv[0] ) );
$this->setProperty('saturation',intval( $hsv[1] * 100 ) );
$this->setProperty('lightness', intval( $hsv[2] * 100 ) );
$this->setProperty('hue', intval($hsv[0]));
$this->setProperty('saturation', intval($hsv[1] * 100));
$this->setProperty('lightness', intval($hsv[2] * 100));
}
if ($color!='000000') {
$this->setProperty('colorSaved',$color);
if ($color != '000000') {
$this->setProperty('colorSaved', $color);
}
@@ -2,8 +2,8 @@
if (!$params['color']) return;
$color=strtolower($params['color']);
$color=preg_replace('/^#/','',$color);
$color = strtolower($params['color']);
$color = preg_replace('/^#/','',$color);
$transform=array(
'red'=>'ff0000',
@@ -13,7 +13,7 @@
);
if (isset($transform[$color])) {
$color=$transform[$color];
$color = $transform[$color];
}
if ($color == '000000') {
@@ -22,7 +22,6 @@
if (!$this->getProperty('status')) {
$this->callMethod('turnOn');
}
$this->setProperty('color',$color);
$this->setProperty('colorSaved',$color);
//
$this->setProperty('color', $color);
$this->setProperty('colorSaved', $color);
}
@@ -1,6 +1,6 @@
<?php
$color = $this->getProperty('color');
if ($color != '000000') $this->setProperty('colorSaved',$this->getProperty('color'));
if ($color != '000000') $this->setProperty('colorSaved', $this->getProperty('color'));
$this->setProperty('color', '000000');
$this->setProperty('status', 0);
@@ -2,9 +2,9 @@
$this->setProperty('status', 1);
$colorSaved=$this->getProperty('colorSaved');
if ($colorSaved && $colorSaved!='000000') {
$this->setProperty('color',$colorSaved);
$colorSaved = $this->getProperty('colorSaved');
if ($colorSaved && $colorSaved != '000000') {
$this->setProperty('color', $colorSaved);
} else {
$this->setProperty('color','ffffff');
$this->setProperty('color', 'ffffff');
}
@@ -1,24 +1,23 @@
<?php
$ot=$this->object_title;
$ot = $this->object_title;
$tm=time();
$this->setProperty('updated', $tm);
$this->setProperty('updated', time());
$this->setProperty('updatedText', date('H:i', $tm));
if ($this->getProperty('alive') == 0) {
$this->setProperty('alive', 1);
}
$alive_timeout=(int)$this->getProperty('aliveTimeout')*60*60;
$alive_timeout = (int)$this->getProperty('aliveTimeout')*60*60;
if (!$alive_timeout) {
$alive_timeout=2*24*60*60; // 2 days alive timeout by default
$alive_timeout = 2*24*60*60; // 2 days alive timeout by default
}
setTimeout($ot.'_alive_timer', 'setGlobal("'.$ot.'.alive", 0);', $alive_timeout);
setTimeout($ot . '_alive_timer', 'setGlobal("' . $ot . '.alive", 0);', $alive_timeout);
$this->callMethodSafe('logicAction');
include_once(DIR_MODULES.'devices/devices.class.php');
include_once(DIR_MODULES . 'devices/devices.class.php');
$dv=new devices();
$dv->checkLinkedDevicesAction($this->object_title, $this->getProperty('status'));
$dv->checkLinkedDevicesAction($ot, $this->getProperty('status'));
@@ -1,4 +1,4 @@
<?php
$this->setProperty('disabled',1);
$this->setProperty('relay_status',0); // turn off
$this->setProperty('disabled', 1);
$this->setProperty('relay_status', 0); // turn off
@@ -1,3 +1,3 @@
<?php
$this->setProperty('disabled',0);
$this->setProperty('disabled', 0);
@@ -14,10 +14,10 @@
$nobodyhome_timeout = SETTINGS_BEHAVIOR_NOBODYHOME_TIMEOUT * 60;
}
if ($nobodyhome_timeout) {
setTimeOut("nobodyHome", "callMethodSafe('NobodyHomeMode.activate');", $nobodyhome_timeout);
setTimeOut('nobodyHome', "callMethodSafe('NobodyHomeMode.activate');", $nobodyhome_timeout);
}
if ($linked_room) {
callMethodSafe($linked_room.'.onActivity', array('sensor'=>$ot));
callMethodSafe($linked_room . '.onActivity', array('sensor'=>$ot));
}
}
@@ -1,9 +1,8 @@
<?php
$disabled=$this->getProperty('disabled');
if ($disabled) {
$this->setProperty('disabled',0);
} else {
$this->setProperty('disabled',1);
$this->setProperty('relay_status',0); // turn off
}
if ($this->getProperty('disabled')) {
$this->setProperty('disabled', 0);
} else {
$this->setProperty('disabled', 1);
$this->setProperty('relay_status', 0); // turn off
}

0 comments on commit 063207e

Please sign in to comment.
You can’t perform that action at this time.