Skip to content
Permalink
Browse files

fix

Незначительные оптимизации, чистка кода.
  • Loading branch information...
Alexandr-logrus committed Dec 13, 2018
1 parent af69016 commit d7f756710569c9fea6379e7e28e7aea3d1ce3673
@@ -1,6 +1,5 @@
<?php
//$ot = $this->object_title;
$ot = $params['ORIGINAL_OBJECT_TITLE'];
$action = $this->getProperty('actionRGB');
@@ -14,14 +13,14 @@
$check = 0;
$color = '000000';
if ($this->getProperty('color') != $color) {
$this->callMethod('setColor', array('color'=> $color));
$this->setProperty('color', $color);
$check = 1;
}
} elseif (getGlobal('NobodyHomeMode.active') == 2 && $action) { //Все спят
$check = 0;
$color = 'cd00ff';
if ($this->getProperty('color') != $color) {
$this->callMethod('setColor', array('color'=> $color));
$this->setProperty('color', $color);
$check = 1;
}
if ($this->getProperty('brightness') != 5) {
@@ -46,7 +45,7 @@
}
}
if ($this->getProperty('color') != $color) {
$this->callMethod('setColor', array('color'=> $color));
$this->setProperty('color', $color);
$check = 1;
}
if (getGlobal('DarknessMode.active')) {
@@ -59,10 +58,9 @@
$check = 1;
}
} else {
$this->callMethod('turnOff');
$this->setProperty('color', '000000');
}
if ($check) {
setTimeout($ot . '_timerCheck', 'callMethod("' . $ot . '.action");', 5);
}
@@ -1,6 +1,7 @@
<?php
$color = $this->getProperty('color');
$color = $params['NEW_VALUE'];
if ($color != '000000') {
$this->setProperty('colorSaved', $color);
$this->setProperty('status', 1);
@@ -1,23 +1,7 @@
<?php
if (!$params['color']) return;
if (isset($params['color']) == 0) return;
$color = strtolower($params['color']);
$color = preg_replace('/^#/','',$color);
/*
$transform = array(
'red'=>'ff0000',
'green'=>'00ff00',
'blue'=>'0000ff',
'white'=>'ffffff'
);
if (isset($transform[$color])) {
$color = $transform[$color];
}
*/
if ($color == '000000') {
$this->callMethod('turnOff');
} else {
$this->setProperty('color', $color);
}
$this->setProperty('color', $color);
@@ -1,4 +1,3 @@
<?php
$this->setProperty('colorSaved', $this->getProperty('color'));
$this->setProperty('color', '000000');

0 comments on commit d7f7567

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