mirror of
https://git.steelants.cz/SH/PHP_SMART_HOME_V3.git
synced 2026-10-11 17:54:34 +00:00
Fallback better settings
This commit is contained in:
1 parent
bcd5f52a65
commit
15d95dae1d
1 file changed
+13
-5
@@ -2,6 +2,9 @@
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class FallbackManager
|
class FallbackManager
|
||||||
{
|
{
|
||||||
public $deviceDefinitions = "";
|
public $deviceDefinitions = "";
|
||||||
@@ -21,13 +24,18 @@ class FallbackManager
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$lastRecord = RecordManager::getLastRecord($subDeviceValue['subdevice_id']);
|
if (!isset($this->deviceDefinitions[$subDeviceValue['type']]["fallBackTime"])) {
|
||||||
if ($lastRecord["value"] == $this->deviceDefinitions[$subDeviceValue['type']]["fallBack"]) {
|
continue;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$minutes = (strtotime($lastRecord['time']) - time()) / 60;
|
$lastRecord = RecordManager::getLastRecord($subDeviceValue['subdevice_id']);
|
||||||
if ( $minutes > 3){
|
if ($lastRecord["value"] == $this->deviceDefinitions[$subDeviceValue['type']]["fallBack"]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$minutes = (time() - strtotime($lastRecord['time'])) / 60;
|
||||||
|
|
||||||
|
if ( $minutes > $this->deviceDefinitions[$subDeviceValue['type']]["fallBackTime"]){
|
||||||
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