public static function transmitter($from_device_id, $to_device_id, $action_id, $retry = 3, $delay = 3)
 {
     $modelSetting = Setting::find()->select('data')->where(['name' => 'path_script_task'])->one();
     for ($try = 1; $try <= $retry; $try++) {
         // sudo visudo
         // add www-data ALL=(ALL) NOPASSWD: ALL
         // to grant execute right python
         $command = 'sudo ' . $modelSetting->data . ' --fr ' . $from_device_id . ' --to ' . $to_device_id . ' --ac ' . $action_id;
         Yii::info('$command: ' . $command, 'task-transmitter');
         exec(escapeshellcmd($command), $output, $return_var);
         foreach ($output as $line) {
             Yii::info('$line: ' . $line, 'task-transmitter');
         }
         Yii::info('$return_var: ' . $return_var, 'task-transmitter');
         if (0 != $return_var) {
             if ($try < $retry) {
                 Yii::info('!return_var, retry and delay', 'task-transmitter');
                 sleep($delay);
                 continue;
             } else {
                 Yii::error('!return_var, failed exec', 'task-transmitter');
                 return 'err:failed exec';
             }
         }
         $return = Task::sscanfOutput($output);
         if (!$return) {
             Yii::info('sscanfOutput, !return', 'task-transmitter');
             if ($try < $retry) {
                 Yii::info('!return, retry and delay', 'task-transmitter');
                 sleep($delay);
                 continue;
             } else {
                 Yii::error('!return, no output', 'task-transmitter');
                 return 'err:no output';
             }
         }
         Yii::info('sscanfOutput, return', 'task-transmitter');
         // from and to are exchanged
         $from = 0;
         $to = 0;
         $action = 0;
         $message = '';
         list($from, $to, $action, $message) = $return;
         if ($from == $from_device_id and $to == $to_device_id and $action == $action_id) {
             Yii::info('$message: ' . $message, 'task-transmitter');
             return $message;
         } else {
             Yii::info('transmitter function to receiver function', 'task-transmitter');
             // there is output but not for this task-transmitter
             Task::receiver($output);
             $try--;
         }
         if ($try >= $retry) {
             Yii::error('!retry, failed trying', 'task-transmitter');
             return 'err:failed trying';
         } else {
             Yii::info('retry', 'task-transmitter');
             sleep($delay);
         }
     }
     Yii::error('end, failed return', 'task-transmitter');
     return 'err:failed return';
 }
 /**
  * This command echoes what you have entered as the message.
  * @param string $message the message to be echoed.
  */
 public function actionIndex($output)
 {
     Yii::info('ReceiverController', 'task-receiver');
     return Task::receiver(array($output));
 }