Fallback Fix

This commit is contained in:
JonatanRek 2020-02-14 17:05:56 +01:00
parent 0b8ad755a0
commit bcd5f52a65

View File

@ -13,7 +13,7 @@ class FallbackManager
function check(){
//TODO: FIX IT
/*$allDevicesData = DeviceManager::getAllDevices();
$allDevicesData = DeviceManager::getAllDevices();
foreach ($allDevicesData as $deviceKey => $deviceValue) {
$allSubDevicesData = SubDeviceManager::getAllSubDevices($deviceValue['device_id']);
foreach ($allSubDevicesData as $subDeviceKey => $subDeviceValue) {
@ -22,12 +22,15 @@ class FallbackManager
}
$lastRecord = RecordManager::getLastRecord($subDeviceValue['subdevice_id']);
$minutes = (time() - $lastRecord['time']) / 60;
echo $minutes;
if ( $minutes > 2){
if ($lastRecord["value"] == $this->deviceDefinitions[$subDeviceValue['type']]["fallBack"]) {
return;
}
$minutes = (strtotime($lastRecord['time']) - time()) / 60;
if ( $minutes > 3){
RecordManager::create($deviceValue['device_id'], $subDeviceValue['type'], $this->deviceDefinitions[$subDeviceValue['type']]["fallBack"]);
}
}
}*/
}
}
}