diff --git a/app/class/AutomationManager.php b/app/class/AutomationManager.php index ae23625..f962681 100644 --- a/app/class/AutomationManager.php +++ b/app/class/AutomationManager.php @@ -78,8 +78,20 @@ class AutomationManager{ } else if ($onValue['type'] == 'outHome') { //TODO: Add Ovner to automation + $userHomeStatus = UserManager::getUserData('at_home', $onValue['value']); + if ($userHomeStatus == 'false' && $automation['executed'] == 0) { + $run = true; + } else if ($userHomeStatus == 'true' && $automation['executed'] == 1) { + $restart = true; + } } else if ($onValue['type'] == 'inHome') { //TODO: Add Ovner to automation + $userHomeStatus = UserManager::getUserData('at_home', $onValue['value']); + if ($userHomeStatus == 'true' && $automation['executed'] == 0) { + $run = true; + } else if ($userHomeStatus == 'false' && $automation['executed'] == 1) { + $restart = true; + } } else if ($onValue['type'] == 'noOneHome') { $users = UserManager::getUsers(); $membersHome = 0; diff --git a/app/templates/part/automationCreateFinal.phtml b/app/templates/part/automationCreateFinal.phtml index 2276228..0eb48c3 100644 --- a/app/templates/part/automationCreateFinal.phtml +++ b/app/templates/part/automationCreateFinal.phtml @@ -21,9 +21,12 @@ 'value'=> $subDeviceValue, ]); echo htmlspecialchars($json); - } - else { - echo $_POST['atSelector']; + } else { + if ($_POST['atSelector'] == "inHome" || $_POST['atSelector'] == "outHome") { + echo $USERMANAGER->getUserData('user_id'); + } else { + echo $_POST['atSelector']; + } } ?>" required/> diff --git a/app/views/Automation.php b/app/views/Automation.php index 9725d2f..4b3186d 100644 --- a/app/views/Automation.php +++ b/app/views/Automation.php @@ -54,6 +54,8 @@ class Automation extends Template $template->prepare('baseDir', BASEDIR); $template->prepare('title', 'Automation'); $template->prepare('langMng', $langMng); + $template->prepare('userManager', $userManager); + $template->prepare('automations', $automations); $template->prepare('subDevices', $approvedSubDevices);