@@ -20,8 +20,8 @@ |
||
| 20 | 20 | 5 => ['name'=>'noolite.toilet','source'=>'pi'], |
| 21 | 21 | 6 => ['name'=>'noolite.diningroom','source'=>'pi'], |
| 22 | 22 | 7 => ['name'=>'noolite.kitchen','source'=>'pi'], |
| 23 | - 9 => ['name'=>'noolite.toilet','source'=>'human,upper'], |
|
| 24 | - 10 => ['name'=>'noolite.toilet','source'=>'human,lower'], |
|
| 23 | + 9 => ['name'=>'noolite.toilet','source'=>'human,upper'], |
|
| 24 | + 10 => ['name'=>'noolite.toilet','source'=>'human,lower'], |
|
| 25 | 25 | ]; |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -13,15 +13,15 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | private $channelMap = [ |
| 15 | 15 | |
| 16 | - 1 => ['name'=>'noolite.main','source'=>'human'], |
|
| 17 | - 2 => ['name'=>'noolite.kitchen','source'=>'human'], |
|
| 18 | - 3 => ['name'=>'noolite.diningroom','source'=>'human'], |
|
| 19 | - 4 => ['name'=>'noolite.main','source'=>'pi'], |
|
| 20 | - 5 => ['name'=>'noolite.toilet','source'=>'pi'], |
|
| 21 | - 6 => ['name'=>'noolite.diningroom','source'=>'pi'], |
|
| 22 | - 7 => ['name'=>'noolite.kitchen','source'=>'pi'], |
|
| 23 | - 9 => ['name'=>'noolite.toilet','source'=>'human,upper'], |
|
| 24 | - 10 => ['name'=>'noolite.toilet','source'=>'human,lower'], |
|
| 16 | + 1 => ['name'=>'noolite.main', 'source'=>'human'], |
|
| 17 | + 2 => ['name'=>'noolite.kitchen', 'source'=>'human'], |
|
| 18 | + 3 => ['name'=>'noolite.diningroom', 'source'=>'human'], |
|
| 19 | + 4 => ['name'=>'noolite.main', 'source'=>'pi'], |
|
| 20 | + 5 => ['name'=>'noolite.toilet', 'source'=>'pi'], |
|
| 21 | + 6 => ['name'=>'noolite.diningroom', 'source'=>'pi'], |
|
| 22 | + 7 => ['name'=>'noolite.kitchen', 'source'=>'pi'], |
|
| 23 | + 9 => ['name'=>'noolite.toilet', 'source'=>'human,upper'], |
|
| 24 | + 10 => ['name'=>'noolite.toilet', 'source'=>'human,lower'], |
|
| 25 | 25 | ]; |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $changeSet = []; |
| 61 | 61 | |
| 62 | 62 | |
| 63 | - if ($request->get('cmd')==4) { |
|
| 63 | + if ($request->get('cmd') == 4) { |
|
| 64 | 64 | // reverse state, only by human |
| 65 | 65 | |
| 66 | 66 | $oldState = $device->getState(); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | /** @var Action $action */ |
| 74 | 74 | foreach ($actions as $action) { |
| 75 | - if ($action->getArguments()=='{"state":"on"}') { |
|
| 75 | + if ($action->getArguments() == '{"state":"on"}') { |
|
| 76 | 76 | $resultAction = $action; |
| 77 | 77 | break; |
| 78 | 78 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $changeSet = ['state'=>'off']; |
| 83 | 83 | /** @var Action $action */ |
| 84 | 84 | foreach ($actions as $action) { |
| 85 | - if ($action->getArguments()=='{"state":"off"}') { |
|
| 85 | + if ($action->getArguments() == '{"state":"off"}') { |
|
| 86 | 86 | $resultAction = $action; |
| 87 | 87 | break; |
| 88 | 88 | } |
@@ -90,41 +90,41 @@ discard block |
||
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - if ($request->get('cmd')==0) { |
|
| 93 | + if ($request->get('cmd') == 0) { |
|
| 94 | 94 | // turn off, only by pi |
| 95 | 95 | |
| 96 | 96 | $changeSet = ['state'=>'off']; |
| 97 | 97 | /** @var Action $action */ |
| 98 | 98 | foreach ($actions as $action) { |
| 99 | - if ($action->getArguments()=='{"state":"off"}') { |
|
| 99 | + if ($action->getArguments() == '{"state":"off"}') { |
|
| 100 | 100 | $resultAction = $action; |
| 101 | 101 | break; |
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - if ($request->get('cmd')==6) { |
|
| 106 | + if ($request->get('cmd') == 6) { |
|
| 107 | 107 | // turn off, only by pi |
| 108 | 108 | |
| 109 | - $percent = round((($request->get('d0') - 34)/123) * 100); |
|
| 109 | + $percent = round((($request->get('d0') - 34)/123)*100); |
|
| 110 | 110 | |
| 111 | - $changeSet = ['state'=>'on','percent'=>$percent]; |
|
| 111 | + $changeSet = ['state'=>'on', 'percent'=>$percent]; |
|
| 112 | 112 | /** @var Action $action */ |
| 113 | 113 | foreach ($actions as $action) { |
| 114 | - if ($action->getArguments()=='{"state":"on"}') { |
|
| 114 | + if ($action->getArguments() == '{"state":"on"}') { |
|
| 115 | 115 | $resultAction = $action; |
| 116 | 116 | break; |
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - if ($request->get('cmd')==2) { |
|
| 121 | + if ($request->get('cmd') == 2) { |
|
| 122 | 122 | // turn on, only by pi |
| 123 | 123 | |
| 124 | 124 | $changeSet = ['state'=>'on']; |
| 125 | 125 | /** @var Action $action */ |
| 126 | 126 | foreach ($actions as $action) { |
| 127 | - if ($action->getArguments()=='{"state":"on"}') { |
|
| 127 | + if ($action->getArguments() == '{"state":"on"}') { |
|
| 128 | 128 | $resultAction = $action; |
| 129 | 129 | break; |
| 130 | 130 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (($changeSet['state'] == 'on') && !isset($changeSet['percent'])) { |
| 139 | - $changeSet['percent'] = 100; // ? I don't really know if they restore their states |
|
| 139 | + $changeSet['percent'] = 100; // ? I don't really know if they restore their states |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | if (!$resultAction) { |