Свойства класса:
Методы класса:
Объекты класса:
if ($this->getProperty("AlarmOn") != 1){safe_exec('mpc stop');callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>0));callMethod("NooLiteD_Zal_3Lamp.dim",array("value"=>0));exit();}; callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>20)); safe_exec('mpc volume 20'); safe_exec('mpc stop && mpc clear && mpc add 3sec.mp3 && mpc add http://ep256.streamr.ru && mpc --wait play && sleep 1 && mpc volume 20'); sleep(180); if ($this->getProperty("AlarmOn") != 1){safe_exec('mpc stop');callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>0));callMethod("NooLiteD_Zal_3Lamp.dim",array("value"=>0));exit();}; callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>30)); safe_exec('mpc volume 40'); sleep(180); if ($this->getProperty("AlarmOn") != 1){safe_exec('mpc stop');callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>0));callMethod("NooLiteD_Zal_3Lamp.dim",array("value"=>0));exit();}; callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>60)); safe_exec('mpc volume 50'); sleep(180); if ($this->getProperty("AlarmOn") != 1){safe_exec('mpc stop');callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>0));callMethod("NooLiteD_Zal_3Lamp.dim",array("value"=>0));exit();}; callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>90)); safe_exec('mpc volume 60'); sleep(180); if ($this->getProperty("AlarmOn") != 1){safe_exec('mpc stop');callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>0));callMethod("NooLiteD_Zal_3Lamp.dim",array("value"=>0));exit();}; callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>100)); callMethod("NooLiteD_Zal_3Lamp.dim",array("value"=>30)); safe_exec('mpc volume 60'); sleep(180); if ($this->getProperty("AlarmOn") != 1){safe_exec('mpc stop');callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>0));callMethod("NooLiteD_Zal_3Lamp.dim",array("value"=>0));exit();}; callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>100)); callMethod("NooLiteD_Zal_3Lamp.dim",array("value"=>50)); safe_exec('mpc volume 60'); sleep(180); if ($this->getProperty("AlarmOn") != 1){safe_exec('mpc stop');callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>0));callMethod("NooLiteD_Zal_3Lamp.dim",array("value"=>0));exit();}; callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>100)); callMethod("NooLiteD_Zal_3Lamp.dim",array("value"=>70)); safe_exec('mpc volume 60'); sleep(180); if ($this->getProperty("AlarmOn") != 1){safe_exec('mpc stop');callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>0));callMethod("NooLiteD_Zal_3Lamp.dim",array("value"=>0));exit();}; callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>100)); callMethod("NooLiteD_Zal_3Lamp.dim",array("value"=>100)); safe_exec('mpc volume 40'); say(timeNow()); $w="Сейчас за окном ".gg("ThisComputer.TempOutside")." градусов. ".gg("ThisComputer.weatherFull"); say($w); safe_exec('mpc volume 60');
if (isWeekDay()){ // сегодня рабочий день if ($this->getProperty("AlarmOn") != 1){safe_exec('mpc stop');callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>0));callMethod("NooLiteD_Zal_3Lamp.dim",array("value"=>0));exit();}; callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>20)); safe_exec('mpc volume 20'); safe_exec('mpc stop && mpc clear && mpc add 3sec.mp3 && mpc add http://ep256.streamr.ru && mpc --wait play && sleep 1 && mpc volume 20'); sleep(180); if ($this->getProperty("AlarmOn") != 1){safe_exec('mpc stop');callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>0));callMethod("NooLiteD_Zal_3Lamp.dim",array("value"=>0));exit();}; callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>30)); safe_exec('mpc volume 40'); sleep(180); if ($this->getProperty("AlarmOn") != 1){safe_exec('mpc stop');callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>0));callMethod("NooLiteD_Zal_3Lamp.dim",array("value"=>0));exit();}; callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>60)); safe_exec('mpc volume 50'); sleep(180); if ($this->getProperty("AlarmOn") != 1){safe_exec('mpc stop');callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>0));callMethod("NooLiteD_Zal_3Lamp.dim",array("value"=>0));exit();}; callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>90)); safe_exec('mpc volume 60'); sleep(180); if ($this->getProperty("AlarmOn") != 1){safe_exec('mpc stop');callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>0));callMethod("NooLiteD_Zal_3Lamp.dim",array("value"=>0));exit();}; callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>100)); callMethod("NooLiteD_Zal_3Lamp.dim",array("value"=>30)); safe_exec('mpc volume 60'); sleep(180); if ($this->getProperty("AlarmOn") != 1){safe_exec('mpc stop');callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>0));callMethod("NooLiteD_Zal_3Lamp.dim",array("value"=>0));exit();}; callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>100)); callMethod("NooLiteD_Zal_3Lamp.dim",array("value"=>50)); safe_exec('mpc volume 60'); sleep(180); if ($this->getProperty("AlarmOn") != 1){safe_exec('mpc stop');callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>0));callMethod("NooLiteD_Zal_3Lamp.dim",array("value"=>0));exit();}; callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>100)); callMethod("NooLiteD_Zal_3Lamp.dim",array("value"=>70)); safe_exec('mpc volume 60'); sleep(180); if ($this->getProperty("AlarmOn") != 1){safe_exec('mpc stop');callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>0));callMethod("NooLiteD_Zal_3Lamp.dim",array("value"=>0));exit();}; callMethod("NooLiteD_Zal_1Lamp.dim",array("value"=>100)); callMethod("NooLiteD_Zal_3Lamp.dim",array("value"=>100)); safe_exec('mpc volume 40'); say(timeNow()); $w="Сейчас за окном ".gg("ThisComputer.TempOutside")." градусов. ".gg("ThisComputer.weatherFull"); say($w); safe_exec('mpc volume 60'); }
Свойства класса:
Методы класса:
Объекты класса:
/* $command=$params['command']; $short_command=''; $dt=recognizeTime($command,$short_command); if (preg_match('/скажи сколько время/is',$command)) { if ($dt>0) { addScheduledJob("command".$dt,"processCommand('".$short_command."');",$dt); say('Задача принята'); return; } global $voicemode; $voicemode='on'; say('Сейчас '.timeNow()); } elseif (preg_match('/сколько время/is',$command)) { if ($dt>0) { addScheduledJob("command".$dt,"processCommand('".$short_command."');",$dt); say('Задача принята'); echo $short_command; return; } say('Сейчас '.timeNow()); } elseif (preg_match('/повтори (.+)/is',$command,$m) || preg_match('/скажи (.+)/is',$command,$m)) { if ($dt>0) { addScheduledJob("command".$dt,"processCommand('".$short_command."');",$dt); say('Задача принята'); return; } global $voicemode; $voicemode='on'; say($m[1]); } elseif (preg_match('/кто ты/is',$command)) { // say('Задача принята'); cm('voice_command.kto_ti'); return; } else { say('Неизвестная команда...'); } */ $command=$params['command']; $short_command=''; $dt=recognizeTime($command,$short_command); $objects=getObjectsByClass("voice_command"); foreach($objects as $obj){ if (preg_match('/'.mb_strtolower($obj['TITLE'],'utf-8').'(.*)/is',mb_strtolower($command,'utf-8'),$m)) { if ($dt>0) { addScheduledJob("command".$dt,"processCommand('".$short_command."');",$dt); say('Задача принята'); return; } callMethod($obj['TITLE'].".action",array("command"=>$m[1])); return; } } // если голосовых команд не найдено - отправим в чат callMethod("Chat_request.action",array("command"=>$command));
say("Отключено питание");
Свойства класса:
Методы класса:
$this->setProperty('status',$params['status']); // установка свойство статуса, передаваемого в параметре status $this->setProperty('updatedTimestamp',time()); // обновление времени последней установки статуса
Свойства класса:
Объекты класса:
Свойства класса:
Методы класса:
$status=$this->getProperty("status"); if ($status) { $this->callMethod('turnOn'); } else { $this->callMethod('turnOff'); }
$status=$this->getProperty("status"); if ($status) { $this->callMethod('turnOff'); } else { $this->callMethod('turnOn'); }
$this->setProperty("status",0);
$this->setProperty("status",1);
Свойства класса:
Методы класса:
$this->callMethod("sendCommand",array('command'=>'-unbind_ch '.$this->getProperty("channel")));
$buf2=$params['buf2']; // принятая команда if ($buf2==0){ //выключить нагрузку $this->setProperty("status",0); }elseif($buf2==2){ //включить нагрузку $this->setProperty("status",1); }elseif($buf2==4){ //включает или выключает нагрузку if ($this->getProperty("status")){ $this->setProperty("status",0); }else{ $this->setProperty("status",1); } }
$this->callMethod("sendCommand",array('command'=>'-bind_ch '.$this->getProperty("channel")));
$cmdline='sleep 0.5; /usr/bin/noolitepc -api '.$params['command']; safe_exec($cmdline); /* $last_called=gg('NoolightCommandSend'); if ((time()-$last_called)>2) { sg('NoolightCommandSend',time()); safe_exec($cmdline); // exec($cmdline); } else { $last_called+=2; sg('NoolightCommandSend',$last_called); AddScheduledJob("noolight".md5($cmdline),"safe_exec('".$cmdline."');",$last_called); } */
$this->setProperty("status",1); $this->callMethod("sendCommand",array('command'=>'-on_ch '.$this->getProperty("channel")));
$this->setProperty("status",0); $this->callMethod("sendCommand",array('command'=>'-off_ch '.$this->getProperty("channel")));
Объекты класса:
Свойства класса:
Методы класса:
$buf2=$params['buf2']; // принятая команда $buf3=$params['buf3']; // формат данных 0-нет, 1-1байт, 2-4байта $buf4=$params['buf4']; // Байт данных 0 $buf5=$params['buf5']; // Байт данных 1 $buf6=$params['buf6']; // Байт данных 2 $buf7=$params['buf7']; // Байт данных 3 if ($buf2==0){ //выключить нагрузку $this->setProperty("status",0); $this->setProperty("brightness",0); }elseif($buf2==1){ //запускает плавное понижение яркости //$this->setProperty("status",1); }elseif($buf2==2){ //включить нагрузку $this->setProperty("status",1); $this->setProperty("brightness",100); }elseif($buf2==3){ //запускает плавное повышение яркости //$this->setProperty("status",1); }elseif($buf2==4){ //включает или выключает нагрузку if ($this->getProperty("status")){ $this->setProperty("status",0); $this->setProperty("brightness",0); }else{ $this->setProperty("status",1); $this->setProperty("brightness",100); } }elseif($buf2==5){ //запускает плавное изменение яркости в обратном направлении //$this->setProperty("status",1); }elseif($buf2==6){ //установить заданную в «Байт данных 0» яркость $this->setProperty("brightness",$buf4); }elseif($buf2==10){ //остановить регулировку //$this->setProperty("status",1); }
$this->setProperty("status",0); $this->setProperty("brightness",0); $this->callMethod("refresh");
$value=$this->getProperty("brightness"); $this->callMethod("sendCommand",array('command'=>'-set_ch '.$this->getProperty("channel").' '.$value)); if ($value>0) { $this->setProperty('status',1); } else { $this->setProperty('status',0); }
$this->setProperty("status",1); $this->setProperty("brightness",100); $this->callMethod("refresh");
if ($params['value']) { $this->setProperty("brightness",$params['value']); $this->callMethod("refresh"); }
if ((getGlobal("NooLiteD_Bathroom.Status") == 0) && (getGlobal("NooLiteD_WC.Status") == 0) ) { setGlobal("NooLiteD_Bathroom_WC_Vent.TurnOffAt",time() + 300); }
Объекты класса:
$buf2=$params['buf2']; // принятая команда $buf3=$params['buf3']; // формат данных 0-нет, 1-1байт, 2-4байта $buf4=$params['buf4']; // Байт данных 0 $buf5=$params['buf5']; // Байт данных 1 $buf6=$params['buf6']; // Байт данных 2 $buf7=$params['buf7']; // Байт данных 3 if ($buf2==0){ //выключить нагрузку $this->setProperty("status",0); $this->setProperty("brightness",0); $this->setProperty("LastTurnOn",0); callMethod("NooLiteD_Bathroom_WC_Vent.DelayedOff"); }elseif($buf2==1){ //запускает плавное понижение яркости //$this->setProperty("status",1); }elseif($buf2==2){ //включить нагрузку $this->setProperty("status",1); $this->setProperty("brightness",100); $this->setProperty("LastTurnOn",time()); callMethod("NooLiteD_Bathroom_WC_Vent.TurnOn"); setGlobal("NooLiteD_Bathroom_WC_Vent.TurnOffAt",0); }elseif($buf2==3){ //запускает плавное повышение яркости //$this->setProperty("status",1); }elseif($buf2==4){ //включает или выключает нагрузку if ($this->getProperty("status")){ $this->setProperty("status",0); $this->setProperty("brightness",0); }else{ $this->setProperty("status",1); $this->setProperty("brightness",100); } }elseif($buf2==5){ //запускает плавное изменение яркости в обратном направлении //$this->setProperty("status",1); }elseif($buf2==6){ //установить заданную в «Байт данных 0» яркость $this->setProperty("brightness",$buf4); }elseif($buf2==10){ //остановить регулировку //$this->setProperty("status",1); }
$buf2=$params['buf2']; // принятая команда $buf3=$params['buf3']; // формат данных 0-нет, 1-1байт, 2-4байта $buf4=$params['buf4']; // Байт данных 0 $buf5=$params['buf5']; // Байт данных 1 $buf6=$params['buf6']; // Байт данных 2 $buf7=$params['buf7']; // Байт данных 3 if ($buf2==0){ //выключить нагрузку $this->setProperty("status",0); $this->setProperty("brightness",0); $this->setProperty("LastTurnOff",0); callMethod("NooLiteD_Bathroom_WC_Vent.DelayedOff"); }elseif($buf2==1){ //запускает плавное понижение яркости //$this->setProperty("status",1); }elseif($buf2==2){ //включить нагрузку $this->setProperty("status",1); $this->setProperty("brightness",100); $this->setProperty("LastTurnOn",time()); callMethod("NooLiteD_Bathroom_WC_Vent.TurnOn"); setGlobal("NooLiteD_Bathroom_WC_Vent.TurnOffAt",0); }elseif($buf2==3){ //запускает плавное повышение яркости //$this->setProperty("status",1); }elseif($buf2==4){ //включает или выключает нагрузку if ($this->getProperty("status")){ $this->setProperty("status",0); $this->setProperty("brightness",0); }else{ $this->setProperty("status",1); $this->setProperty("brightness",100); } }elseif($buf2==5){ //запускает плавное изменение яркости в обратном направлении //$this->setProperty("status",1); }elseif($buf2==6){ //установить заданную в «Байт данных 0» яркость $this->setProperty("brightness",$buf4); }elseif($buf2==10){ //остановить регулировку //$this->setProperty("status",1); }
Методы класса:
Объекты класса:
echo "status received: ".$params['status'];
global $voicemode; $voicemode='off'; processCommand($params['message']);
Свойства класса:
Методы класса:
$this->callMethod("sendCommand",array('command'=>'-unbind_ch '.$this->getProperty("channel")));
$this->callMethod("sendCommand",array('command'=>'-bind_ch '.$this->getProperty("channel")));
Объекты класса:
callMethod('NooLiteD_Zal_3Lamp.turnOff'); callMethod('NooLiteD_Zal_1Lamp.turnOff');
callMethod('NooLiteD_Zal_1Lamp.turnOn');
callMethod('NooLiteD_Zal_3Lamp.turnOn');
runScript('nl_detskaya_sleepmode');
callMethod(" NooLiteD_Kinder.receiveCommand", array("buf2"=>$params['buf2'],"buf4"=>$params['buf4']));
sg('NooLiteD_Zal_3Lamp.brightness',0); sg('NooLiteD_Zal_3Lamp.status',0); sg('NooLiteD_Zal_1Lamp.brightness',0); sg('NooLiteD_Zal_1Lamp.status',0); //callMethod('NooLiteD_Zal_3Lamp.turnOff'); //callMethod('NooLiteD_Zal_1Lamp.turnOff');
callMethod(" NooLiteD_Zal_1Lamp.receiveCommand", array("buf2"=>$params['buf2'],"buf4"=>$params['buf4']));
callMethod(" NooLiteD_Zal_3Lamp.receiveCommand", array("buf2"=>$params['buf2'],"buf4"=>$params['buf4']));
callMethod("NooLiteD_Spalna.receiveCommand", array("buf2"=>$params['buf2'],"buf4"=>$params['buf4']));
callMethod("NooLiteD_HallInDoor.receiveCommand", array("buf2"=>$params['buf2'],"buf4"=>$params['buf4']));
callMethod("NooLiteD_HallBig.receiveCommand", array("buf2"=>$params['buf2'],"buf4"=>$params['buf4']));
callMethod("NooLiteD_Bathroom.receiveCommand", array("buf2"=>$params['buf2'],"buf4"=>$params['buf4']));
callMethod("NooLiteD_WC.receiveCommand", array("buf2"=>$params['buf2'],"buf4"=>$params['buf4']));
callMethod("NooLiteD_Kitchen_Lustra.receiveCommand", array("buf2"=>$params['buf2'],"buf4"=>$params['buf4'])); callMethod("NooLite_Kitchen_Lumi_and_Vent.receiveCommand", array("buf2"=>$params['buf2'],"buf4"=>$params['buf4']));
Свойства класса:
Методы класса:
Объекты класса:
Свойства класса:
Методы класса:
Объекты класса:
$h=(int)date('G',time()); $m=date('i',time()); if (isWeekDay()) { if (($h>=8)&&($h<=21)) { if ($m=="00") { say(timeNow()); } } } $objects=getObjectsByClass("AlarmClock"); foreach($objects as $obj) { // переберем все будильники в системе if (getGlobal($obj['TITLE'].".AlarmOn") && timeIs(getGlobal($obj['TITLE'].".AlarmTime"))){ //если будильник включен и время совпало callMethod($obj['TITLE'].".AlarmRun"); // выполним метод будильника } } if (getGlobal("NooLiteD_WC.LastTurnOn") > 0) { if (getGlobal("NooLiteD_WC.LastTurnOn") + 900 - time() <= 0){ setGlobal("NooLiteD_WC.LastTurnOn",0); callMethod("NooLiteD_WC.TurnOff"); callMethod("NooLiteD_Bathroom_WC_Vent.DelayedOff"); } } if (getGlobal("NooLiteD_Bathroom.LastTurnOn") > 0) { if (getGlobal("NooLiteD_Bathroom.LastTurnOn") + 2700 - time() <= 0){ setGlobal("NooLiteD_Bathroom.LastTurnOn",0); callMethod("NooLiteD_Bathroom.TurnOff"); callMethod("NooLiteD_Bathroom_WC_Vent.DelayedOff"); } } if (getGlobal("NooLiteD_Bathroom_WC_Vent.TurnOffAt") > 0) { if (getGlobal("NooLiteD_Bathroom_WC_Vent.TurnOffAt") - time() <= 0){ setGlobal("NooLiteD_Bathroom_WC_Vent.TurnOffAt",0); callMethod("NooLiteD_Bathroom_WC_Vent.TurnOff"); } }
Методы класса:
Объекты класса:
if ($params['serial']=='' && $params['devname']!='') { $params['serial']=$params['devname']; } $device=SQLSelectOne("SELECT * FROM usbdevices WHERE SERIAL LIKE '".$params['serial']."'"); if (!$device['ID']) { // new device connected //say("Подключено новое устройство",1); $device=array(); $device['SERIAL']=$params['serial']; $device['TITLE']='устройство '.$params['devname']; $device['FIRST_FOUND']=date('Y-m-d H:i:s'); $device['LAST_FOUND']=date('Y-m-d H:i:s'); $device['LOG'].=$device['FIRST_FOUND'].' подключено (впервые)'."\n"; $device['ID']=SQLInsert('usbdevices',$device); } else { // device already in our database //say("Подключено ".$device['TITLE'],1); if ($device['USER_ID']) { $user=SQLSelectOne("SELECT * FROM users WHERE ID='".$device['USER_ID']."'"); if ($user['ID']) { //$user['NAME']; // теперь мы знаем имя пользователя, связанного с этим устройством } } $device['LAST_FOUND']=date('Y-m-d H:i:s'); $device['LOG']=$device['LAST_FOUND'].' подключено'."\n".$device['LOG']; SQLUpdate('usbdevices',$device); if ($device['SCRIPT_ID']!='') { runScript($device['SCRIPT_ID'],$params); } elseif ($device['SCRIPT']!='') { eval($device['SCRIPT']); } }
Свойства класса:
Методы класса:
Объекты класса:
say('Выключаю весь свет'); cm('NooLiteD_Zal_1Lamp.turnOff'); cm('NooLiteD_Zal_3Lamp.turnOff'); cm('NooLiteD_Kinder.turnOff');
say('Включаю весь свет'); cm('NooLiteD_Zal_1Lamp.turnOn'); cm('NooLiteD_Zal_3Lamp.turnOn'); cm('NooLiteD_Kinder.turnOn');
say('Я - Алиса, система домашней автоматизации MajorDoMo.'); //say('Я - Алиса, система домашней автоматизации MajorDoMo. Или полностью , что означает Главный Домашний Модуль.');
Свойства класса:
Объекты класса:
Свойства класса:
Методы класса:
$w="Обнаружено движение на камере: ".$this->getProperty('Text'); say($w,-1);
Объекты класса:
, Россия
© 2024 - Site Built By SergeJey | Реквизиты: Курицын С. С. ИНН 762001394609 | Контакты | Публичный договор
SmartLiving