Re: Помогите с кодом (с логикой) пожалуйста
Добавлено: Чт май 06, 2021 10:48 am
При автономном переключении статус не меняется, а вот если вручную запустить метод getStatus, то вполне обновляет свойство.
Код: Выделить всё
//Запрос требуемой температуры
$RequiredTemp = $this->getProperty('RequiredTemp');
//Включение термостата MegaD на радиаторном контуре 1-го этажа
file_get_contents("http://192.168.0.211/sec/?pt=31&misc=".$RequiredTemp);
//Изменяем статус термостата на контуре
$this->setProperty('Status', 1);
sg('BranchesAll.StatusAll', 1);Код: Выделить всё
//Выключение термостата MegaD на радиаторном контуре 1-го этажа
file_get_contents("http://192.168.0.211/sec/?pt=31&misc=5");
//Изменяем статус термостата на контуре
$this->setProperty('Status', 0);
$this->callMethod('checkStatusAll');Код: Выделить всё
$Status = $this->getProperty('Status');
if ($Status == 0 || $Status == "") {
$this->callMethod('turnOn');
} else {
$this->callMethod('turnOff');
}Код: Выделить всё
$objects=getObjectsByClass("HeatingSystem");
foreach($objects as $obj) {
if (gg($obj['TITLE'].".Status") == 1) {
callMethod($obj['TITLE'].".turnOff");
}
}Код: Выделить всё
$Mode = $this->getProperty('Mode');
if ($Mode == 0 || $Mode == "") {
$this->setProperty('Mode', 1);
$this->callMethod('AutoMode');
} else {
$this->setProperty('Mode', 0);
}Код: Выделить всё
$objects=getObjectsByClass("HeatingSystem");
foreach($objects as $obj) {
if (gg($obj['TITLE'].".Status") == 1) {
sg('BranchesAll.StatusAll', 1);
return;
}
}
sg('BranchesAll.StatusAll', 0);Код: Выделить всё
$RequiredTemp = $this->getProperty('RequiredTemp') - 1;
$this->setProperty('RequiredTemp', $RequiredTemp);
$ot = $this->object_title;
SetTimeOut($ot."_RequiredTempCh","file_get_contents('http://192.168.0.211/sec/?pt=31&misc=$RequiredTemp');",5);Код: Выделить всё
$RequiredTemp = $this->getProperty('RequiredTemp') + 1;
$this->setProperty('RequiredTemp', $RequiredTemp);
$ot = $this->object_title;
SetTimeOut($ot."_RequiredTempCh","file_get_contents('http://192.168.0.211/sec/?pt=31&misc=$RequiredTemp');",5);Код: Выделить всё
<style type="text/css">
.gorizontalno {
display: inline-block
}
.button:active {
transform: scale(0.9, 0.9);
}
</style>
<div class="gorizontalno">
<div class="button">
<div style='display:%BranchesAll.StatusAll|"block;none"%' onClick='callMethod("%BranchesAll.turnOffAll");'><img src="\cms\scenes\styles\switch\i_warm_on.png" width="48" height="32"><font size="4" color="gray"> ОТОПЛЕНИЕ</font></div>
<div style='display:%BranchesAll.StatusAll|"none;block"%' onClick='callMethod("%BranchesAll.turnOffAll");'><img src="\cms\scenes\styles\switch\i_warm_on.png" width="48" height="32" style="background-color: yellow;"><b> ОТОПЛЕНИЕ</b></div>
</div>
</div>
<div><font size="1">Температура на улице: %О.P%</font></div>
<div><font size="1">Температура в доме: %О.P%</font></div>Код: Выделить всё
<style type="text/css">
.gorizontalno {
display: inline-block
}
.button:active {
transform: scale(0.9, 0.9);
}
</style>
<div><font size="3">Радиаторный контур 1 эт.</font></div>
<div class="gorizontalno">
<div class="button">
<div style='display:%RadiatorBranch_01.Status|"block;none"%' onClick='callMethod("%RadiatorBranch_01.switch");'><img src="\cms\scenes\styles\switch\i_warm_on.png"></div>
<div style='display:%RadiatorBranch_01.Status|"none;block"%' onClick='callMethod("%RadiatorBranch_01.switch");'><img src="\cms\scenes\styles\switch\i_warm_on.png" style="background-color: yellow;"></div>
</div>
</div>
<div class="gorizontalno">
<div class="button">
<div style='display:%RadiatorBranch_01.Mode|"block;none"%' onClick='callMethod("%RadiatorBranch_01.changeMode");'><img src="\cms\scenes\Manual.png"></div>
<div style='display:%RadiatorBranch_01.Mode|"none;block"%' onClick='callMethod("%RadiatorBranch_01.changeMode");'><img src="\cms\scenes\Auto.png"></div>
</div>
</div>
<div class="gorizontalno">
<div class="button">
<div style='display:%PumpHeat_01.Status|"block;none"%' onClick='callMethod("%PumpHeat_01.turnOn");'><img src="\cms\scenes\PumpHeatOff.png"></div>
<div style='display:%PumpHeat_01.Status|"none;block"%' onClick='callMethod("%PumpHeat_01.turnOff");'><img src="\cms\scenes\PumpHeatOn.gif"></div>
</div>
</div>
<div class="gorizontalno">
<div class="button">
<div onClick='callMethod("%RadiatorBranch_01.requiredTempDown");'><img src="\cms\scenes\minus3.jpg"></div>
</div>
</div>
<div class="gorizontalno">
<div style='font-size:18pt; text-align:center'>%RadiatorBranch_01.RequiredTemp%</div>
</div>
<div class="gorizontalno">
<div class="button">
<div onClick='callMethod("%RadiatorBranch_01.requiredTempUp");'><img src="\cms\scenes\plus3.jpg"></div>
</div>
</div>
<div class="gorizontalno">
<div style='font-size:18pt; font-weight:bold; font-stretch:condensed; text-align:center; color:blue; -webkit-text-stroke:1px yellow; left:52px; bottom:12px'><i>%SensorTemp_01.Value%</i></div>
</div>