|
1 | 1 | <?php |
2 | 2 |
|
3 | | -/* |
4 | | - $tm=time(); |
5 | | - $this->setProperty('updated', $tm); |
6 | | - $this->setProperty('updatedText', date('H:i', $tm)); |
7 | | -*/ |
8 | | - |
9 | 3 | $level = $this->getProperty('level'); |
10 | 4 | $minWork = $this->getProperty('minWork'); |
11 | 5 | $maxWork = $this->getProperty('maxWork'); |
12 | 6 | $levelWork = $this->getProperty('levelWork'); |
13 | 7 |
|
14 | | -//DebMes("Level updated to " . $level, 'dimming'); |
15 | | - |
16 | 8 | $statusUpdated = 0; |
17 | 9 |
|
18 | 10 | if ($level > 0) { |
|
21 | 13 | $statusUpdated = 1; |
22 | 14 | $this->setProperty('status', 1, false); |
23 | 15 | } |
24 | | - if ($minWork != $maxWork) { |
25 | | - //DebMes("Level updated to " . $level ." ".$_SERVER['REQUEST_URI'], 'dimming'); |
26 | | - $levelWork = round($minWork + round(($maxWork - $minWork) * $level / 100)); |
27 | | - if ($this->getProperty('levelWork') != $levelWork) { |
28 | | - //DebMes("Setting new levelWork to " . (int)$levelWork, 'dimming'); |
29 | | - $this->setProperty('levelWork', (int)$levelWork); |
30 | | - } |
31 | | - } |
32 | 16 | } else { |
33 | 17 | if ($this->getProperty('status')) { |
34 | 18 | $statusUpdated = 1; |
35 | 19 | $this->setProperty('status', 0); |
36 | 20 | } |
37 | | - if ($levelWork>0) { |
38 | | - $this->setProperty('levelWork', 0); |
| 21 | +} |
| 22 | + |
| 23 | +if ($minWork != $maxWork) { |
| 24 | + $levelWork = round($minWork + round(($maxWork - $minWork) * $level / 100)); |
| 25 | + if ($this->getProperty('levelWork') != $levelWork) { |
| 26 | + $this->setProperty('levelWork', (int)$levelWork); |
39 | 27 | } |
40 | 28 | } |
41 | 29 |
|
| 30 | + |
42 | 31 | if (!$statusUpdated) { |
43 | 32 | $this->callMethod('logicAction'); |
44 | 33 | include_once(dirname(__FILE__) . '/devices.class.php'); |
|
0 commit comments