mirror of
https://git.steelants.cz/SH/PHP_SMART_HOME_V3.git
synced 2026-10-11 17:54:34 +00:00
Fallback Fix
This commit is contained in:
1 parent
0b8ad755a0
commit
bcd5f52a65
1 file changed
+8
-5
@@ -13,7 +13,7 @@ class FallbackManager
|
|||||||
|
|
||||||
function check(){
|
function check(){
|
||||||
//TODO: FIX IT
|
//TODO: FIX IT
|
||||||
/*$allDevicesData = DeviceManager::getAllDevices();
|
$allDevicesData = DeviceManager::getAllDevices();
|
||||||
foreach ($allDevicesData as $deviceKey => $deviceValue) {
|
foreach ($allDevicesData as $deviceKey => $deviceValue) {
|
||||||
$allSubDevicesData = SubDeviceManager::getAllSubDevices($deviceValue['device_id']);
|
$allSubDevicesData = SubDeviceManager::getAllSubDevices($deviceValue['device_id']);
|
||||||
foreach ($allSubDevicesData as $subDeviceKey => $subDeviceValue) {
|
foreach ($allSubDevicesData as $subDeviceKey => $subDeviceValue) {
|
||||||
@@ -22,12 +22,15 @@ class FallbackManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
$lastRecord = RecordManager::getLastRecord($subDeviceValue['subdevice_id']);
|
$lastRecord = RecordManager::getLastRecord($subDeviceValue['subdevice_id']);
|
||||||
$minutes = (time() - $lastRecord['time']) / 60;
|
if ($lastRecord["value"] == $this->deviceDefinitions[$subDeviceValue['type']]["fallBack"]) {
|
||||||
echo $minutes;
|
return;
|
||||||
if ( $minutes > 2){
|
}
|
||||||
|
|
||||||
|
$minutes = (strtotime($lastRecord['time']) - time()) / 60;
|
||||||
|
if ( $minutes > 3){
|
||||||
RecordManager::create($deviceValue['device_id'], $subDeviceValue['type'], $this->deviceDefinitions[$subDeviceValue['type']]["fallBack"]);
|
RecordManager::create($deviceValue['device_id'], $subDeviceValue['type'], $this->deviceDefinitions[$subDeviceValue['type']]["fallBack"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user