mirror of
https://git.steelants.cz/SH/PHP_SMART_HOME_V3.git
synced 2026-10-11 17:54:34 +00:00
Automations
This commit is contained in:
1 parent
edf0b1ceb4
commit
d8c7a54446
5 files changed
+39
-24
No files matched your search
@@ -55,7 +55,7 @@ class AutomationManager{
|
||||
$run = false;
|
||||
$restart = false;
|
||||
|
||||
if ($automation['active'] == 1 && $automation['locked'] != 1){
|
||||
if ($automation['active'] == 1 && $automation['locked'] != 1){
|
||||
Db::edit('automation', array('locked' => 1), 'WHERE automation_id = ?', array($automation['automation_id']));
|
||||
if (in_array($dayNameNow, $actionDays)){
|
||||
if (in_array($onValue['type'], ['sunSet', 'sunRise', 'time','now'])) {
|
||||
@@ -118,6 +118,18 @@ class AutomationManager{
|
||||
} else if ($membersHome > 0 && $automation['executed'] == 0){
|
||||
$run = true;
|
||||
}
|
||||
} else if ($onValue['type'] == 'atDeviceValue') {
|
||||
|
||||
$subDeviceId = SubDeviceManager::getSubDeviceByMaster($onValue['value']['deviceID'], $onValue['value']['type'])["subdevice_id"];
|
||||
$lastValue = RecordManager::getLastRecord($subDeviceId);
|
||||
|
||||
if ($lastValue['value'] == $onValue['value']['value'] && $automation['executed'] == 0) {
|
||||
$run = true;
|
||||
|
||||
} else if ($lastValue['value'] != $onValue['value']['value'] && $automation['executed'] == 1){
|
||||
$restart = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//finalization
|
||||
|
||||
Reference in new issue
Block a user