Person at home detection
This commit is contained in:
		@@ -78,8 +78,20 @@ class AutomationManager{
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
					} else if ($onValue['type'] == 'outHome') {
 | 
										} else if ($onValue['type'] == 'outHome') {
 | 
				
			||||||
						//TODO: Add Ovner to automation
 | 
											//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') {
 | 
										} else if ($onValue['type'] == 'inHome') {
 | 
				
			||||||
						//TODO: Add Ovner to automation
 | 
											//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') {
 | 
										} else if ($onValue['type'] == 'noOneHome') {
 | 
				
			||||||
						$users = UserManager::getUsers();
 | 
											$users = UserManager::getUsers();
 | 
				
			||||||
						$membersHome = 0;
 | 
											$membersHome = 0;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,9 +21,12 @@
 | 
				
			|||||||
                        'value'=> $subDeviceValue,
 | 
					                        'value'=> $subDeviceValue,
 | 
				
			||||||
                    ]);
 | 
					                    ]);
 | 
				
			||||||
                    echo  htmlspecialchars($json);
 | 
					                    echo  htmlspecialchars($json);
 | 
				
			||||||
                }
 | 
					                } else {
 | 
				
			||||||
                else {
 | 
					                    if ($_POST['atSelector'] == "inHome" || $_POST['atSelector'] == "outHome") {
 | 
				
			||||||
                    echo $_POST['atSelector'];
 | 
					                       echo $USERMANAGER->getUserData('user_id');
 | 
				
			||||||
 | 
					                    } else {
 | 
				
			||||||
 | 
					                        echo $_POST['atSelector'];
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
                } ?>" required/>
 | 
					                } ?>" required/>
 | 
				
			||||||
                <input type="hidden" name="atDays" value="<?php echo htmlspecialchars(($_POST['day'] != '' ? json_encode($_POST['day']) : '')); ?>" required/>
 | 
					                <input type="hidden" name="atDays" value="<?php echo htmlspecialchars(($_POST['day'] != '' ? json_encode($_POST['day']) : '')); ?>" required/>
 | 
				
			||||||
                <?php foreach ($_POST['devices'] as $value) { ?>
 | 
					                <?php foreach ($_POST['devices'] as $value) { ?>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -54,6 +54,8 @@ class Automation extends Template
 | 
				
			|||||||
		$template->prepare('baseDir', BASEDIR);
 | 
							$template->prepare('baseDir', BASEDIR);
 | 
				
			||||||
		$template->prepare('title', 'Automation');
 | 
							$template->prepare('title', 'Automation');
 | 
				
			||||||
		$template->prepare('langMng', $langMng);
 | 
							$template->prepare('langMng', $langMng);
 | 
				
			||||||
 | 
							$template->prepare('userManager', $userManager);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$template->prepare('automations', $automations);
 | 
							$template->prepare('automations', $automations);
 | 
				
			||||||
		$template->prepare('subDevices', $approvedSubDevices);
 | 
							$template->prepare('subDevices', $approvedSubDevices);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user