debug
This commit is contained in:
@ -11,10 +11,12 @@ class rdc_store extends hook
|
||||
public $storeUpTime = 41;
|
||||
public $maxLevel;
|
||||
public $storeLevel;
|
||||
public $motorReversal = false;
|
||||
protected $propertyInitialized =array();
|
||||
protected $devicelist = array(
|
||||
RDC_EXTERIEUR_LUMINOSITE => "illuminance_lux",
|
||||
RDC_SALON_LUMINOSITE => "illuminance_lux",
|
||||
RDC_STORE_VIBRATION => "vibration",
|
||||
METEO => "rainin",
|
||||
METEO => "solarradiation",
|
||||
METEO => "windspeedkmh",
|
||||
@ -46,7 +48,6 @@ class rdc_store extends hook
|
||||
//$this->maxLevel = 100;
|
||||
$r = 100;
|
||||
$moving = "STOP";
|
||||
$motorReversal = false;
|
||||
$store2level = false;
|
||||
|
||||
if (array_key_exists("moving", $storeDevice->properties))
|
||||
@ -58,19 +59,19 @@ class rdc_store extends hook
|
||||
{
|
||||
if ($storeDevice->properties["motor_reversal"]["value"] == "ON")
|
||||
{
|
||||
$motorReversal = true;
|
||||
$this->motorReversal = true;
|
||||
}else
|
||||
{
|
||||
$motorReversal = false;
|
||||
$this->motorReversal = false;
|
||||
}
|
||||
logger(DEBUG, "Motor reversal =" . bool2string($motorReversal), __FILE__ . ":" . __LINE__);
|
||||
logger(DEBUG, "Motor reversal =" . bool2string($this->motorReversal), __FILE__ . ":" . __LINE__);
|
||||
}
|
||||
|
||||
if ($moving == "STOP")
|
||||
if ($moving == "STOP" or $moving == null)
|
||||
{
|
||||
if (array_key_exists("position", $storeDevice->properties))
|
||||
{
|
||||
if ($motorReversal)
|
||||
if ($this->motorReversal)
|
||||
{
|
||||
$this->storeLevel = $storeDevice->properties["position"]["value"];
|
||||
}else
|
||||
@ -97,7 +98,7 @@ class rdc_store extends hook
|
||||
{
|
||||
if ($indexDevices[METEO]->properties["windgustkmh"]["value"] > 50)
|
||||
{
|
||||
logger(ALERT, "Vent fort :" . $indexDevices[METEO]->properties["windgustkmh"]["value"], __FILE__ . ":" . __LINE__);
|
||||
logger(ALERT, "Vent fort :" . $indexDevices[METEO]->properties["windgustkmh"]["value"], __FILE__ . ":" . __LINE__, $device);
|
||||
}
|
||||
$rafale = $mohaDB->moyenne($indexDevices[METEO], "windgustkmh", 6);
|
||||
if ($rafale == 0)
|
||||
@ -110,7 +111,7 @@ class rdc_store extends hook
|
||||
{
|
||||
if ($indexDevices[METEO]->properties["windspeedkmh"]["value"] > 50)
|
||||
{
|
||||
logger(ALERT, "Vent fort :" . $indexDevices[METEO]->properties["windspeedkmh"]["value"], __FILE__ . ":" . __LINE__);
|
||||
logger(ALERT, "Vent fort :" . $indexDevices[METEO]->properties["windspeedkmh"]["value"], __FILE__ . ":" . __LINE__, $device);
|
||||
}
|
||||
$vent = $mohaDB->moyenne($indexDevices[METEO], "windspeedkmh", 6);
|
||||
if ($vent == 0)
|
||||
@ -154,7 +155,7 @@ class rdc_store extends hook
|
||||
logger(DEBUG, "exterieur_lux > 33000 or salon_lux >600", __FILE__ . ":" . __LINE__);
|
||||
if ($this->maxLevel != 0 and $salon_lux > 100)
|
||||
{
|
||||
$store2level = $this->storeLevel + 15;
|
||||
$store2level = $this->storeLevel + 20;
|
||||
}
|
||||
}elseif ($exterieurLuxMoyen < 5000 and $salon_lux < 200 and $soleil < 100)
|
||||
{
|
||||
@ -174,13 +175,7 @@ class rdc_store extends hook
|
||||
//calcul du maxlevel par rapport a la vitesse des rafales
|
||||
$r = round(($rafale-20)/4, 0, PHP_ROUND_HALF_UP)*10;
|
||||
if ($r < 0) $r = 0;
|
||||
if ($motorReversal)
|
||||
{
|
||||
$this->maxLevel = $r;
|
||||
}else
|
||||
{
|
||||
$this->maxLevel = 100 - $r;
|
||||
}
|
||||
$this->maxLevel = 100 - $r;
|
||||
logger(DEBUG, "rafale=" . $rafale, __FILE__ . ":" . __LINE__);
|
||||
}
|
||||
logger(DEBUG, "maxlevel=" . $this->maxLevel, __FILE__ . ":" . __LINE__);
|
||||
@ -191,9 +186,15 @@ class rdc_store extends hook
|
||||
logger(DEBUG, "CASE: rainin:" . $value, __FILE__ . ":" . __LINE__);
|
||||
$this->close("Pluie");
|
||||
break;
|
||||
case "windgustkmh";
|
||||
case "windgustkmh":
|
||||
logger(DEBUG, "CASE: windgustkmh:" . $rafale, __FILE__ . ":" . __LINE__);
|
||||
break;
|
||||
case "vibration":
|
||||
$tmpStore = $this->storeLevel - 20;
|
||||
if ($store2level == false or $store2level > $tmpStore)
|
||||
{
|
||||
$this->setTo($store2level, AUTO);
|
||||
}
|
||||
default:
|
||||
}
|
||||
logger(DEBUG, "maxLevel = " . $this->maxLevel . ' result => $r = ' . $r, __FILE__ . ":" . __LINE__);
|
||||
@ -222,10 +223,14 @@ class rdc_store extends hook
|
||||
private function setTo($level, $method)
|
||||
{
|
||||
logger(DEBUG, "function 'set' to level : " . $level, __FILE__ . ":" . __LINE__);
|
||||
if (!$this->motorReversal)
|
||||
{
|
||||
$level = 100 - $level;
|
||||
}
|
||||
if ($level <= 100)
|
||||
{
|
||||
logger(DEBUG, "Open store :" . $level, __FILE__ . ":" . __LINE__);
|
||||
$this->send(100 - $level, $method);
|
||||
$this->send($level, $method);
|
||||
}//else
|
||||
/*{
|
||||
logger(DEBUG, "store is already at level" . $this->storeLevel . " so < at " . $level, __FILE__ . ":" . __LINE__);
|
||||
|
Reference in New Issue
Block a user