@@ -33,7 +33,7 @@ public static function mainMotionChange($_options) {
3333 if (isset ($ _options ['seconds ' ]) && $ _options ['seconds ' ] > 0 ) {
3434 sleep ($ _options ['seconds ' ]);
3535 }
36- log::add ('lightmanager ' , 'debug ' , $ lightmanager ->getHumanName () . '[autoMotionLightOff ] ' . json_encode ($ _options ));
36+ log::add ('lightmanager ' , 'debug ' , $ lightmanager ->getHumanName () . '[mainMotionChange ] ' . json_encode ($ _options ));
3737 $ lightmanager ->handleStateLight ();
3838 }
3939
@@ -48,7 +48,7 @@ public static function autoMotionLightOff($_options) {
4848 log::add ('lightmanager ' , 'debug ' , $ lightmanager ->getHumanName () . ' autoMotionLightOff => ' . json_encode ($ _options ));
4949 $ stateHandling = $ lightmanager ->getCmd (null , 'stateHandling ' );
5050 if ($ stateHandling ->execCmd () == 0 ) {
51- log::add ('lightmanager ' , 'debug ' , $ lightmanager ->getHumanName () . '[autoMotionLightOff] handling disable , do nothing ' );
51+ log::add ('lightmanager ' , 'debug ' , $ lightmanager ->getHumanName () . '[autoMotionLightOff] handling disabled , do nothing ' );
5252 return ;
5353 }
5454 if ($ lightmanager ->getMotionState ()) {
@@ -69,7 +69,7 @@ public static function autoLightOff($_options) {
6969 log::add ('lightmanager ' , 'debug ' , $ lightmanager ->getHumanName () . '[autoLightOff] autoLightOff => ' . json_encode ($ _options ));
7070 $ stateHandling = $ lightmanager ->getCmd (null , 'stateHandling ' );
7171 if ($ stateHandling ->execCmd () == 0 ) {
72- log::add ('lightmanager ' , 'debug ' , $ lightmanager ->getHumanName () . '[autoLightOff] handling disable , do nothing ' );
72+ log::add ('lightmanager ' , 'debug ' , $ lightmanager ->getHumanName () . '[autoLightOff] handling disabled , do nothing ' );
7373 return ;
7474 }
7575 $ delay_off_no_motion = jeedom::evaluateExpression ($ lightmanager ->getConfiguration ('delay::off_no_motion ' ));
@@ -99,7 +99,7 @@ public static function mainHandleChange($_options) {
9999 }
100100 log::add ('lightmanager ' , 'debug ' , $ lightmanager ->getHumanName () . '[mainHandleChange] ' . json_encode ($ _options ));
101101 $ crons = cron::searchClassAndFunction ('lightmanager ' , 'autoLightOff ' , '"lightmanager_id": ' . $ lightmanager ->getId ());
102- if (is_array ($ crons )) {
102+ if (is_array ($ crons ) && count ( $ crons ) > 0 ) {
103103 log::add ('lightmanager ' , 'debug ' , $ lightmanager ->getHumanName () . '[handleStateLight] I need to remove previous plan cron, count ' . count ($ crons ));
104104 foreach ($ crons as $ cron ) {
105105 log::add ('lightmanager ' , 'debug ' , $ lightmanager ->getHumanName () . '[handleStateLight] Check if cron need to be remove : ' . $ cron ->getId () . ' state : ' . $ cron ->getState ());
@@ -152,19 +152,19 @@ public function handleStateLight() {
152152 }
153153 $ stateHandling = $ this ->getCmd (null , 'stateHandling ' );
154154 if ($ stateHandling ->execCmd () == 0 ) {
155- log::add ('lightmanager ' , 'debug ' , $ this ->getHumanName () . '[handleStateLight] Handling disable , do nothing ' );
155+ log::add ('lightmanager ' , 'debug ' , $ this ->getHumanName () . '[handleStateLight] Handling disabled , do nothing ' );
156156 return ;
157157 }
158158 $ lightState = $ this ->getLightState ();
159159 if ($ lightState != $ this ->getCache ('lastLightOrder ' , $ lightState ) && $ this ->getConfiguration ('auto_walkout ' ) == 1 ) {
160- log::add ('lightmanager ' , 'debug ' , $ this ->getHumanName () . '[handleStateLight] Light state no same that last order, do nothing ' );
160+ log::add ('lightmanager ' , 'debug ' , $ this ->getHumanName () . '[handleStateLight] Light state no same that last order, disable handling ' );
161161 $ stateHandling ->event (0 );
162162 return ;
163163 }
164164 $ motionState = $ this ->getMotionState ();
165165 $ this ->setCache ('lastMotionOrder ' , $ motionState );
166166 $ crons = cron::searchClassAndFunction ('lightmanager ' , 'autoMotionLightOff ' , 'lightmanager_id": ' . $ this ->getId ());
167- if (is_array ($ crons )) {
167+ if (is_array ($ crons ) && count ( $ crons ) > 0 ) {
168168 log::add ('lightmanager ' , 'debug ' , $ this ->getHumanName () . '[handleStateLight] I need to remove previous plan cron, count ' . count ($ crons ));
169169 foreach ($ crons as $ cron ) {
170170 log::add ('lightmanager ' , 'debug ' , $ this ->getHumanName () . '[handleStateLight] Check if cron need to be remove : ' . $ cron ->getId () . ' state : ' . $ cron ->getState ());
@@ -254,7 +254,7 @@ public function getMotionState() {
254254 continue ;
255255 }
256256 $ value = jeedom::evaluateExpression ($ motion ['cmdMotion ' ]);
257- log::add ('lightmanager ' , 'debug ' , $ this ->getHumanName () . ' ' . $ motion ['cmdMotion ' ] . ' result : ' . $ value );
257+ log::add ('lightmanager ' , 'debug ' , $ this ->getHumanName () . '[getMotionState] ' . $ motion ['cmdMotion ' ] . ' result : ' . $ value );
258258 if (isset ($ motion ['invert ' ]) && $ motion ['invert ' ] == 1 ) {
259259 $ value = 1 - $ value ;
260260 }
0 commit comments