Свойства класса:
Методы класса:
$volume=round(65535*$params['VALUE']/100);
$this->setProperty('volumeLevel',$params['VALUE']);
safe_exec('..\\apps\\nircmd\\nircmdc setsysvolume '.$volume);
say("Изменилась громкость до ".$params['VALUE']." процентов");Свойства класса:
Методы класса:
//$params['t']
$this->setProperty("updated",time());
$this->setProperty("updatedTime",date("H:i",time()));
$this->setProperty("alive",1);
$ot=$this->object_title;
$alive_timeout=(int)$this->getProperty("aliveTimeOut");
if (!$alive_timeout) {
$alive_timeout=60*2*60;
}
clearTimeOut($ot."_alive");
setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout);
if (!isset($params['h'])) {
return;
}
Свойства класса:
Методы класса:
//play ringtone
$this->setProperty('ringtone','1,1');//play ringtone
$this->setProperty('ringtone','10,1');
Свойства класса:
Методы класса:
//$params['t']
$this->setProperty("updated",time());
$this->setProperty("updatedTime",date("H:i",time()));
$this->setProperty("alive",1);
$ot=$this->object_title;
$alive_timeout=(int)$this->getProperty("aliveTimeOut");
if (!$alive_timeout) {
$alive_timeout=6*60;
}
clearTimeOut($ot."_alive");
setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout);
$old_hum=$this->getProperty('humidity');
$t_new=round($old_hum,0);
$this->setProperty('roundhum',$t_new);
if (!isset($params['h'])) {
return;
}
Свойства класса:
Методы класса:
if ($params['status']) {
$this->setProperty('status',$params['status']);
}
$this->setProperty('updatedTimestamp',time());
$this->setProperty("alive",1);
$ot=$this->object_title;
$alive_timeout=(int)$this->getProperty("aliveTimeOut");
if (!$alive_timeout) {
$alive_timeout=12*60*60;
}
clearTimeOut($ot."_alive");
setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout);Свойства класса:
Методы класса:
$this->setProperty('status',$params['status']); // выставляем статус сенсора
$this->setProperty('updatedTimestamp',time()); // выставляем время срабатывания сенсора
$this->setProperty('alive',1);
$ot=$this->object_title;
$alive_timeout=(int)$this->getProperty("aliveTimeOut");
if (!$alive_timeout) {
$alive_timeout=24*60*60;
}
clearTimeOut($ot."_alive");
setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout);
if ($params['status']) {
$this->setProperty('motionDetected',1);
clearTimeOut($this->object_title.'_detected');
setTimeOut($this->object_title.'_detected',"setGlobal('".$this->object_title.".motionDetected',0);",30);
$linked_room=$this->getProperty('LinkedRoom');
if ($linked_room!='') {
callMethod($linked_room.'.onActivity');
}
if ($this->object_title=='sensorMovement3' || $this->object_title=='sensorMovementRemote1' || $this->object_title=='sensorMovementRemote2') {
//|| $this->object_title=='sensorMovement5'
return; // не реагируем на движение в спальне, по ip-сенсорам и по сенсору на втром этаже
}
ClearTimeOut("nobodyHome");
SetTimeOut("nobodyHome","callMethod('NobodyHomeMode.activate');", 1*60*60); // выполняем если целый час никого не было
if (getGlobal('NobodyHomeMode.active')) {
callMethod('NobodyHomeMode.deactivate');
}
$last_register=registeredEventTime('inhouseMovement'); // проверяем когда в последний раз срабатывало событие "движение внутри дома"
registerEvent('inhouseMovement',$this->name,2); // регистрируем событие "движение внутри дома"
if (timeBetween('05:00', '12:00') && ((time()-$last_register)>2*60*60)) {
runScript('Greeting'); // запускаем скрипт "доброе утро"
}
}Свойства класса:
Методы класса:
//$params['t']
$this->setProperty("updated",time());
$this->setProperty("updatedTime",date("H:i",time()));
$this->setProperty("alive",1);
$ot=$this->object_title;
$alive_timeout=(int)$this->getProperty("aliveTimeOut");
if (!$alive_timeout) {
$alive_timeout=6*60;
}
clearTimeOut($ot."_alive");
setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout);
$old_lux=$this->getProperty('lux');
$t_new=round($old_lux,0);
$this->setProperty('roundlux',$t_new);
if (!isset($params['h'])) {
return;
}
$old_temp=$this->getProperty('lux');
$t=round($params['h'],1);
if ($t>100) return;
$this->setProperty('lux',$t);
if ($params['uptime']) {
$this->setProperty('uptime',$params['uptime']);
}
if ($t>$old_temp) {
$d=1;
} elseif ($t<$old_temp) {
$d=-1;
} else {
$d=0;
}
$this->setProperty('direction',$d);
$linked_room=$this->getProperty("LinkedRoom");
if ($linked_room) {
setGlobal($linked_room.'.lux',$t);
}Свойства класса:
Методы класса:
if ($params['heartbeat']) {
$this->setProperty('heartbeat',$params['heartbeat']);
}
$this->setProperty('updatedTimestamp',time());
$this->setProperty("alive",1);
$ot=$this->object_title;
$alive_timeout=(int)$this->getProperty("aliveTimeOut");
if (!$alive_timeout) {
$alive_timeout=4*60;
}
clearTimeOut($ot."_alive");
setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout);Свойства класса:
Методы класса:
$this->setProperty("updated",time());
$this->setProperty("updatedTime",date('H:i'));
if ($this->getProperty('active')) {
say("Режим ".$this->getProperty('title')." активирован.");
} else {
say("Режим ".$this->getProperty('title')." выключен.");
}$this->setProperty('active',1);$this->setProperty('active',0);Свойства класса:
Методы класса:
//$params['t']
$this->setProperty("updated",time());
$this->setProperty("updatedTime",date("H:i",time()));
$this->setProperty("alive",1);
$ot=$this->object_title;
$alive_timeout=(int)$this->getProperty("aliveTimeOut");
if (!$alive_timeout) {
$alive_timeout=6*60;
}
clearTimeOut($ot."_alive");
setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout);
$old_press=$this->getProperty('pressure');
$press_new=round($old_press,0);
$this->setProperty('roundpress',$press_new);
if (!isset($params['h'])) {
return;
}
$old_temp=$this->getProperty('pressure');
$t=round($params['h'],1);
if ($t>100) return;
$this->setProperty('pressure',$t);
if ($params['uptime']) {
$this->setProperty('uptime',$params['uptime']);
}
if ($t>$old_temp) {
$d=1;
} elseif ($t<$old_temp) {
$d=-1;
} else {
$d=0;
}
$this->setProperty('direction',$d);
$linked_room=$this->getProperty("LinkedRoom");
if ($linked_room) {
setGlobal($linked_room.'.pressure',$t);
}Свойства класса:
Методы класса:
$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);Свойства класса:
Методы класса:
$cmdline='"c:\Program Files\nooLite\nooLite.exe" -api '.$params['command'];
$last_called=gg('NoolightCommandSend');
$min_delay=3;
$now=time();
if (($now-$last_called)>$min_delay) {
//safe_exec($cmdline);
$last_callled=$now;
sg('NoolightCommandSend',$last_called);
DebMes("Noolite instant exec: ".$cmdline);
system($cmdline);
//exec($cmdline);
} else {
if ($last_callled<$now) {
$last_callled=$now;
}
$last_called+=$min_delay;
sg('NoolightCommandSend',$last_called);
DebMes("Noolite scheduled job for ".date('H:i:s',$last_called));
AddScheduledJob("noolight".md5($cmdline),"safe_exec('".$cmdline."');",$last_called);
}
$this->setProperty("status",0);
//safe_exec('"c:\Program Files\nooLite\noolite.exe" -api -off_ch'.$this->getProperty("channel"));
$this->callMethod("sendCommand",array('command'=>'-off_ch'.$this->getProperty("channel")));$this->setProperty("status",1);
$this->callMethod("sendCommand",array('command'=>'-on_ch'.$this->getProperty("channel")));Свойства класса:
Методы класса:
$code1=$this->getProperty('Code1');
$code2=$this->getProperty('Code2');
safe_exec("c:\_majordomo\apps\arduino_gw\arduino_gw.exe rcon$code1:$code2;");
$this->setProperty("status",1);$code1=$this->getProperty('Code1');
$code2=$this->getProperty('Code2');
safe_exec("c:\_majordomo\apps\arduino_gw\arduino_gw.exe rcoff$code1:$code2;");
$this->setProperty("status",0);Свойства класса:
Методы класса:
$latestActivity=$this->getProperty('LatestActivity');
$this->setProperty('LatestActivity',time());
$this->setProperty('LatestActivityTime',date('H:i'));
$this->setProperty('SomebodyHere',1);
$ot=$this->object_title;
if ($this->getProperty("IdleDelay")) {
$activity_timeout=(int)$this->getProperty("IdleDelay");
} else {
$activity_timeout=10*60;
}
clearTimeOut($ot."_activity_timeout");
setTimeOut($ot."_activity_timeout","callMethod('".$ot.".onIdle');",$activity_timeout);
$this->callMethod("updateActivityStatus");
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/Rooms_onActivity.php');
/* end injection of {SDevices} */$this->setProperty('SomebodyHere',0);
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/Rooms_onIdle.php');
/* end injection of {SDevices} */$rooms=getObjectsByClass("Rooms");
$total=count($rooms);
for($i=0;$i<$total;$i++) {
$rooms[$i]['room']=getGlobal($rooms[$i]['TITLE'].'.Title');
if (!$rooms[$i]['room']) {
$rooms[$i]['room']=$rooms[$i]['TITLE'];
}
$rooms[$i]['active']=getGlobal($rooms[$i]['TITLE'].'.SomebodyHere');
$rooms[$i]['time']=getGlobal($rooms[$i]['TITLE'].'.LatestActivity');
$rooms[$i]['diff']=time()-$rooms[$i]['time'];
}
function rooms_cmp($a, $b)
{
if ($a['diff'] == $b['diff']) {
return 0;
}
return ($a['diff'] < $b['diff']) ? -1 : 1;
}
usort($rooms,"rooms_cmp");
if (!$rooms[0]['active']) {
$somebodyHomeText="Никого нет дома. Были в ".date('H:i',$rooms[0]['time'])." (".$rooms[0]['room'].")";
} else {
$res_rooms=array();
for($i=0;$i<$total;$i++) {
if ($rooms[$i]['active']) {
$res_rooms[]=$rooms[$i]['room'];
}
}
$somebodyHomeText="Кто-то дома: ".implode(", ",$res_rooms);
}
setGlobal('somebodyHomeText',$somebodyHomeText);
//echo "Updated";
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/Rooms_updateActivityStatus.php');
/* end injection of {SDevices} */Свойства класса:
Методы класса:
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SDevices_statusUpdated.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SDevices_logicAction.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SDevices_setUpdatedText.php');
/* end injection of {SDevices} */Свойства класса:
Методы класса:
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SButtons_pressed.php');
/* end injection of {SDevices} */Свойства класса:
Методы класса:
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SCameras_motionDetected.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SCameras_updatePreview.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SCameras_takeSnapshot.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SCameras_takeSeries.php');
/* end injection of {SDevices} */Свойства класса:
Методы класса:
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SControllers_turnOn.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SControllers_turnOff.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SControllers_switch.php');
/* end injection of {SDevices} */Свойства класса:
Методы класса:
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SDimmers_levelUpdated.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SDimmers_turnOn.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SDimmers_turnOff.php');
/* end injection of {SDevices} */Свойства класса:
Методы класса:
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SRGB_colorUpdated.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SRGB_setColor.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SRGB_turnOn.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SRGB_turnOff.php');
/* end injection of {SDevices} */Свойства класса:
Методы класса:
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SThermostats_valueUpdated.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SThermostats_statusUpdated.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SThermostats_tempUp.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SThermostats_tempDown.php');
/* end injection of {SDevices} */Свойства класса:
Методы класса:
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SCounters_valueUpdated.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SCounters_valueWorkUpdated.php');
/* end injection of {SDevices} */Методы класса:
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SLeak_statusUpdated.php');
/* end injection of {SDevices} */Свойства класса:
Методы класса:
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SMotions_motionDetected.php');
/* end injection of {SDevices} */Свойства класса:
Методы класса:
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SOpenClose_statusUpdated.php');
/* end injection of {SDevices} */Свойства класса:
Методы класса:
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SSensors_valueUpdated.php');
/* end injection of {SDevices} */Свойства класса:
Методы класса:
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SPowerSensors_valueUpdated.php');
/* end injection of {SDevices} *//* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SPowerSensors_loadStatusChanged.php');
/* end injection of {SDevices} */Методы класса:
/* begin injection of {SDevices} */
require(DIR_MODULES.'devices/SSmoke_statusUpdated.php');
/* end injection of {SDevices} */Свойства класса:
Методы класса:
//$this->setProperty('status',$params['status']); // установка свойство статуса, передаваемого в параметре status
$this->setProperty('timedrop',time()); // обновление времени последней установки статуса
$new_st=$this->getProperty('status');
if ( $new_st == 1 ) { // если статус = 1
ClearTimeOut("ACdrop1"); // очищаем таймер события "нет сети 220В две минуты"
ClearTimeOut("ACdrop2"); // очищаем таймер события "нет сети 220В пятнадцать минут"
ClearTimeOut("ACdrop3"); // очищаем таймер события "нет сети 220В два часа"
setGlobal("APCUPS1.stateColor",'green');
say("Сеть 220 Вольт восстановлена");
} elseif ( $new_st == 0 ) {
SetTimeOut("ACdrop1","runScript('ACdrop1');", 2*60); // назначаем новый таймер. срабатывает через 2 минуты после последнего срабатывания датчика.
SetTimeOut("ACdrop2","runScript('ACdrop2');", 15*60); // назначаем новый таймер. срабатывает через 15 минут после последнего срабатывания датчика.
SetTimeOut("ACdrop3","runScript('ACdrop3');", 2*60*60); // назначаем новый таймер. срабатывает через два часа после последнего срабатывания датчика.
}
Свойства класса:
Методы класса:
$details=array();
$t=$params['stateColor'];
$red_state=0;
$yellow_state=0;
$grey_state=0;
if ($t == "red") {
$red_state=1;
$details[]="Батарея ИБП разряжена";
}
if ($t == "yellow") {
$yellow_state=1;
$details[]="Работа от аккумуляторов ИБП";
}
if ($t == "green") {
$green_state=1;
$details[]="Работа ИБП от сети ";
}
if ($t == "grey") {
$grey_state=1;
$details[]="Нет связи с ИБП";
}
if ($red_state) {
$state='red';
$state_title='Красный';
} elseif ($yellow_state) {
$state='yellow';
$state_title='Жёлтый';
} elseif ($grey_state) {
$state='grey';
$state_title='Серый';
} else {
$state='green';
$state_title='Зелёный';
}
$this->setProperty('stateDetails',implode(". ",$details));
if ($this->getProperty('stateColor')!=$state) {
$this->setProperty('stateColor',$state);
$this->setProperty('stateTitle',$state_title);
if ($state!='green') {
say("Уровень системы питания изменился на ".$state_title.".");
say(implode(". ",$details));
} else {
say("Уровень системы питания восстановлен на ".$state_title);
}
$this->callMethod('stateChanged');
}
Свойства класса:
Методы класса:
//$params['t'];
$this->setProperty("updated",time());
$this->setProperty("updatedTime",date("H:i",time()));
$this->setProperty("alive",1);
$ot=$this->object_title;
$alive_timeout=(int)$this->getProperty("aliveTimeOut");
if (!$alive_timeout) {
$alive_timeout=6*60;
}
clearTimeOut($ot."_alive");
setTimeOut($ot."_alive","sg('".$ot.".alive',0);",$alive_timeout);
$old_temp=$this->getProperty('temp');
$t_new=round($old_temp,1);
$av_temp=$this->getProperty('roundTemp');
$av_temp=($av_temp+$t_new)/2;
$this->setProperty('averTemp',$av_temp);
$this->setProperty('roundTemp',$t_new);
if (!isset($params['t'])) {
return;
}
$old_temp=$this->getProperty('temp');
$t=round($params['t'],1);
if ($t>110) return;
$this->setProperty('temp',$t);
if ($params['uptime']) {
$this->setProperty('uptime',$params['uptime']);
}
if ($t>$old_temp) {
$d=1;
} elseif ($t<$old_temp) {
$d=-1;
} else {
$d=0;
}
$this->setProperty('direction',$d);
$linked_room=$this->getProperty("LinkedRoom");
if ($linked_room) {
setGlobal($linked_room.'.Temperature',$t);
}Свойства класса:
Свойства класса:
Методы класса:
//=======метод set_name(установка имени)=======================
include_once(DIR_MODULES.'Yeelight/Yeelight_library.php');
$Location = $this->getProperty('Location');
$id = $this->getProperty('id');
$name = $this->getProperty('name');
$data = [
"Location" => "$Location",
"id" => "$id",
];
$socketFactory = new Factory();
$bulbFactory = new BulbFactory($socketFactory);
$bulb = $bulbFactory->create($data);
$res = $bulb->setName($name); //установить имя
if (array_key_exists('result', $res)) {
$result = $res [result][0];
//переменная содержит ответ от лампочки
}
if (array_key_exists('error', $res)) {
$result = $res [error][message].". Code ".$res [error][code];
DebMes("Ошибка Yeelight: ".$result);
}//========= метод on_off (включение/выключение) ===================
include_once(DIR_MODULES.'Yeelight/Yeelight_library.php');
$Location = $this->getProperty('Location');
$id = $this->getProperty('id');
$status = $this->getProperty('status');
if ($status) {$power = 'on'; }
if (!$status) {$power = 'off'; }
$data = [
"Location" => $Location,
"id" => $id,
];
$socketFactory = new Factory();
$bulbFactory = new BulbFactory($socketFactory);
$bulb = $bulbFactory->create($data);
$res = $bulb->setPower($power, 'smooth', 1000); //включить/выключить
if (array_key_exists('result', $res)) {
$result = $res [result][0];
//переменная содержит ответ от лампочки
}
if (array_key_exists('error', $res)) {
$result = $res [error][message].". Code ".$res [error][code];
DebMes("Ошибка Yeelight: ".$result);
}//========= метод set_bright (установка яркости) ====================
include_once(DIR_MODULES.'Yeelight/Yeelight_library.php');
$Location = $this->getProperty('Location');
$id = $this->getProperty('id');
$bright = (int) ($this->getProperty('bright'));
$data = [
"Location" => $Location,
"id" => $id,
];
$socketFactory = new Factory();
$bulbFactory = new BulbFactory($socketFactory);
$bulb = $bulbFactory->create($data);
$res = $bulb->setBright($bright, 'smooth', 1000); //установить яркость
if (array_key_exists('result', $res)) {
$result = $res [result][0];
//переменная содержит ответ от лампочки
}
if (array_key_exists('error', $res)) {
$result = $res [error][message].". Code ".$res [error][code];
DebMes("Ошибка Yeelight: ".$result);
}//========= метод switch (переключение) ===================
$status=$this->getProperty('status');
if ($status) {
$this->setProperty('status',0);
$this->callMethod('on_off');
} else {
$this->setProperty('status',1);
$this->callMethod('on_off');
}//========= метод on_off (включение/выключение) ===================
include_once(DIR_MODULES.'Yeelight/Yeelight_library.php');
$Location = $this->getProperty('Location');
$id = $this->getProperty('id');
$status = $this->getProperty('status');
if ($status) {$power = 'on'; }
if (!$status) {$power = 'off'; }
$data = [
"Location" => $Location,
"id" => $id,
];
$socketFactory = new Factory();
$bulbFactory = new BulbFactory($socketFactory);
$bulb = $bulbFactory->create($data);
$res = $bulb->setPower($power, 'sudden', 1); //включить/выключить
if (array_key_exists('result', $res)) {
$result = $res [result][0];
//переменная содержит ответ от лампочки
}
if (array_key_exists('error', $res)) {
$result = $res [error][message].". Code ".$res [error][code];
DebMes("Ошибка Yeelight: ".$result);
}//========= метод start_cf (запуск цветового потока) ====================
include_once(DIR_MODULES.'Yeelight/Yeelight_library.php');
$Location = $this->getProperty('Location');
$id = $this->getProperty('id');
//$bright = (int) ($this->getProperty('bright'));
$data = [
"Location" => $Location,
"id" => $id,
];
$socketFactory = new Factory();
$bulbFactory = new BulbFactory($socketFactory);
$bulb = $bulbFactory->create($data);
$res = $bulb->startCf(2,1,[[10000,2,4000,100],[10000,2,4000,2]]); //запукс цветового потока изменеия яркости
if (array_key_exists('result', $res)) {
$result = $res [result][0];
//переменная содержит ответ от лампочки
}
if (array_key_exists('error', $res)) {
$result = $res [error][message].". Code ".$res [error][code];
DebMes("Ошибка Yeelight: ".$result);
}//========= метод switch_eco (переключение) ===================
$status=$this->getProperty('status');
$bright = (int) ($this->getProperty('bright'));
if ($status) {
if ($bright == 100){
$this->setProperty('bright',10);
$this->callMethod('set_bright');
}
else {
$this->setProperty('bright',100);
$this->callMethod('set_bright');
}
}//========= метод stop_cf (остановка цветового потока) ====================
include_once(DIR_MODULES.'Yeelight/Yeelight_library.php');
$Location = $this->getProperty('Location');
$id = $this->getProperty('id');
//$bright = (int) ($this->getProperty('bright'));
$data = [
"Location" => $Location,
"id" => $id,
];
$socketFactory = new Factory();
$bulbFactory = new BulbFactory($socketFactory);
$bulb = $bulbFactory->create($data);
$res = $bulb->stopCf(); //остановка цветового потока изменеия яркости
if (array_key_exists('result', $res)) {
$result = $res [result][0];
//переменная содержит ответ от лампочки
}
if (array_key_exists('error', $res)) {
$result = $res [error][message].". Code ".$res [error][code];
DebMes("Ошибка Yeelight: ".$result);
}require(DIR_MODULES.'Yeelight/Yeelight_set_hsv.php');
require(DIR_MODULES.'Yeelight/Yeelight_set_ct.php');
require(DIR_MODULES.'Yeelight/Yeelight_set_rgb.php');
Свойства класса:
Методы класса:
, Украина
© 2025 SJLab | Реквизиты: Курицын С. С. ИНН 762001394609 | Контакты | Публичный договор
SmartLiving