Skip to content
Permalink
Browse files

Update SDimmers_levelUpdated.php

Dimmer linked action call fixed
  • Loading branch information...
sergejey committed Apr 18, 2019
1 parent 6e6a095 commit 4f1fdb825360bdab4a5ad2cd5c3bcd2a794f683e
Showing with 33 additions and 22 deletions.
  1. +33 −22 modules/devices/SDimmers_levelUpdated.php
@@ -6,26 +6,37 @@
$this->setProperty('updatedText', date('H:i', $tm));
*/
$level=$this->getProperty('level');
$minWork=$this->getProperty('minWork');
$maxWork=$this->getProperty('maxWork');
$level = $this->getProperty('level');
$minWork = $this->getProperty('minWork');
$maxWork = $this->getProperty('maxWork');
if ($level>0) {
$this->setProperty('levelSaved',$level);
if (!$this->getProperty('status')) {
$this->setProperty('status', 1, false);
}
if ($minWork!=$maxWork) {
DebMes("Level updated to ".$level,'dimming');
$levelWork=round($minWork+round(($maxWork-$minWork)*$level/100));
if ($this->getProperty('levelWork')!=$levelWork) {
DebMes("Setting new levelWork to ".(int)$levelWork,'dimming');
$this->setProperty('levelWork',(int)$levelWork);
}
}
} else {
if ($this->getProperty('status')) {
$this->setProperty('status', 0);
}
$this->setProperty('levelWork',(int)$minWork);
}
$statusUpdated = 0;
if ($level > 0) {
$this->setProperty('levelSaved', $level);
if (!$this->getProperty('status')) {
$statusUpdated = 1;
$this->setProperty('status', 1, false);
}
if ($minWork != $maxWork) {
DebMes("Level updated to " . $level, 'dimming');
$levelWork = round($minWork + round(($maxWork - $minWork) * $level / 100));
if ($this->getProperty('levelWork') != $levelWork) {
DebMes("Setting new levelWork to " . (int)$levelWork, 'dimming');
$this->setProperty('levelWork', (int)$levelWork);
}
}
} else {
if ($this->getProperty('status')) {
$statusUpdated = 1;
$this->setProperty('status', 0);
}
$this->setProperty('levelWork', (int)$minWork);
}
if (!$statusUpdated) {
$this->callMethod('logicAction');
include_once(DIR_MODULES . 'devices/devices.class.php');
$dv = new devices();
$dv->checkLinkedDevicesAction($this->object_title, $level);
}

0 comments on commit 4f1fdb8

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