Person at home detection
This commit is contained in:
		@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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/>
 | 
			
		||||
                <input type="hidden" name="atDays" value="<?php echo htmlspecialchars(($_POST['day'] != '' ? json_encode($_POST['day']) : '')); ?>" required/>
 | 
			
		||||
                <?php foreach ($_POST['devices'] as $value) { ?>
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user