FallBack Start
This commit is contained in:
parent
a0fdd324e2
commit
e76b3127f3
2
api.php
2
api.php
@ -69,6 +69,8 @@ if (DEBUGMOD != 1) {
|
|||||||
|
|
||||||
//automationExecution
|
//automationExecution
|
||||||
try {
|
try {
|
||||||
|
$fallbackManager = new FallbackManager(RANGES);
|
||||||
|
$fallbackManager->check();
|
||||||
AutomationManager::executeAll();
|
AutomationManager::executeAll();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$logManager->write("[Automation] Something happen during automation execution", LogRecordType::ERROR);
|
$logManager->write("[Automation] Something happen during automation execution", LogRecordType::ERROR);
|
||||||
|
33
app/class/FallbackManager.php
Normal file
33
app/class/FallbackManager.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class FallbackManager
|
||||||
|
{
|
||||||
|
public $deviceDefinitions = "";
|
||||||
|
|
||||||
|
function __construct($deviceDefinition)
|
||||||
|
{
|
||||||
|
$this->deviceDefinitions = $deviceDefinition;
|
||||||
|
}
|
||||||
|
|
||||||
|
function check(){
|
||||||
|
//TODO: FIX IT
|
||||||
|
/*$allDevicesData = DeviceManager::getAllDevices();
|
||||||
|
foreach ($allDevicesData as $deviceKey => $deviceValue) {
|
||||||
|
$allSubDevicesData = SubDeviceManager::getAllSubDevices($deviceValue['device_id']);
|
||||||
|
foreach ($allSubDevicesData as $subDeviceKey => $subDeviceValue) {
|
||||||
|
if (!isset($this->deviceDefinitions[$subDeviceValue['type']]["fallBack"])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$lastRecord = RecordManager::getLastRecord($subDeviceValue['subdevice_id']);
|
||||||
|
$minutes = (time() - $lastRecord['time']) / 60;
|
||||||
|
echo $minutes;
|
||||||
|
if ( $minutes > 2){
|
||||||
|
RecordManager::create($deviceValue['device_id'], $subDeviceValue['type'], $this->deviceDefinitions[$subDeviceValue['type']]["fallBack"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user