a lot of debug
This commit is contained in:
@ -14,8 +14,9 @@ class rdc_store extends hook
|
||||
protected $propertyInitialized =array();
|
||||
protected $devicelist = array(
|
||||
RDC_EXTERIEUR_LUMINOSITE => "illuminance_lux",
|
||||
RDC_SALON_LUMINOSITE => "illuminance_lux",
|
||||
METEO => "rainin",
|
||||
//METEO => "solarradiation",
|
||||
METEO => "solarradiation",
|
||||
METEO => "windspeedkmh",
|
||||
METEO => "windgustkmh"
|
||||
);
|
||||
@ -35,7 +36,7 @@ class rdc_store extends hook
|
||||
$rafale = 0;
|
||||
$soleil = 0;
|
||||
$storeDevice = $indexDevices[RDC_STORE];
|
||||
$maxLevel = 100;
|
||||
$this->maxLevel = 100;
|
||||
$r = 100;
|
||||
|
||||
if (array_key_exists("position", $storeDevice->properties))
|
||||
@ -50,11 +51,19 @@ class rdc_store extends hook
|
||||
if (array_key_exists("illuminance_lux", $indexDevices[RDC_EXTERIEUR_LUMINOSITE]->properties))
|
||||
{
|
||||
$exterieur_lux = $mohaDB->moyenne($indexDevices[RDC_EXTERIEUR_LUMINOSITE], "illuminance_lux", 15);
|
||||
if ($exterieur_lux == 0)
|
||||
{
|
||||
$exterieur_lux = $indexDevices[RDC_EXTERIEUR_LUMINOSITE]->properties["illuminance_lux"]["value"];
|
||||
}
|
||||
logger(DEBUG, "exterieur_lux=" . $exterieur_lux, __FILE__ . ":" . __LINE__);
|
||||
}
|
||||
if (array_key_exists("illuminance_lux", $indexDevices[RDC_SALON_LUMINOSITE]->properties))
|
||||
{
|
||||
$salon_lux = $mohaDB->moyenne($indexDevices[RDC_SALON_LUMINOSITE], "illuminance_lux", 10);
|
||||
if ($salon_lux == 0)
|
||||
{
|
||||
$salon_lux = $indexDevices[RDC_SALON_LUMINOSITE]->properties["illuminance_lux"]["value"];
|
||||
}
|
||||
logger(DEBUG, "salon_lux=" . $salon_lux, __FILE__ . ":" . __LINE__);
|
||||
}
|
||||
if (array_key_exists(METEO, $indexDevices))
|
||||
@ -66,13 +75,17 @@ class rdc_store extends hook
|
||||
}
|
||||
if (array_key_exists("windgustkmh", $indexDevices[METEO]->properties))
|
||||
{
|
||||
$rafale = $mohaDB->moyenne($indexDevices[METEO], "windgustkmh", 12);
|
||||
if ($indexDevices[METEO]->properties["windgustkmh"]["value"] > 50)
|
||||
{
|
||||
logger(ALERT, "Vent fort :" . $indexDevices[METEO]->properties["windgustkmh"]["value"], __FILE__ . ":" . __LINE__);
|
||||
}
|
||||
$rafale = $mohaDB->moyenne($indexDevices[METEO], "windgustkmh", 7);
|
||||
logger(DEBUG, "rafale=" . $rafale, __FILE__ . ":" . __LINE__);
|
||||
}
|
||||
if (array_key_exists("solarradiation", $indexDevices[METEO]->properties))
|
||||
{
|
||||
$soleil = $mohaDB->moyenne($indexDevices[METEO], "solarradiation", 12);
|
||||
logger(DEBUG, "soleil=" . $exterieur_lux, __FILE__ . ":" . __LINE__);
|
||||
logger(DEBUG, "soleil=" . $soleil, __FILE__ . ":" . __LINE__);
|
||||
}
|
||||
}
|
||||
logger(DEBUG, sprintf(_("property=%s, value=%s"), $property, $value), __FILE__ . ":" . __LINE__);
|
||||
@ -94,10 +107,10 @@ class rdc_store extends hook
|
||||
{
|
||||
case "illuminance_lux":
|
||||
logger(DEBUG, "CASE: illuminance_lux:" . $value, __FILE__ . ":" . __LINE__);
|
||||
if ($exterieur_lux > 40000)
|
||||
if ($exterieur_lux > 30000)
|
||||
{
|
||||
logger(DEBUG, "exterieur_lux > 40000", __FILE__ . ":" . __LINE__);
|
||||
if ($this->maxLevel != 0 and $salon_lux > 150)
|
||||
logger(DEBUG, "exterieur_lux > 30000", __FILE__ . ":" . __LINE__);
|
||||
if ($this->maxLevel != 0 and $salon_lux > 100)
|
||||
{
|
||||
$store2level = $this->storeLevel + 15;
|
||||
if ( $store2level > $this->maxLevel )
|
||||
@ -110,9 +123,9 @@ class rdc_store extends hook
|
||||
$this->set($store2level);
|
||||
}
|
||||
}
|
||||
}elseif ($exterieur_lux < 35000)
|
||||
}elseif ($exterieur_lux < 15000 and $salon_lux < 300)
|
||||
{
|
||||
logger(DEBUG, "exterieur_lux < 35000", __FILE__ . ":" . __LINE__);
|
||||
logger(DEBUG, "exterieur_lux < 15000", __FILE__ . ":" . __LINE__);
|
||||
$this->close("Luminosité faible");
|
||||
}
|
||||
break;
|
||||
@ -141,11 +154,16 @@ class rdc_store extends hook
|
||||
|
||||
private function set ($level)
|
||||
{
|
||||
if ($this->storeLevel < $level)
|
||||
{
|
||||
logger(DEBUG, "function 'set' to level : " . $level, __FILE__ . ":" . __LINE__);
|
||||
//if ($this->storeLevel < $level)
|
||||
//{
|
||||
logger(DEBUG, "Open store :" . $level, __FILE__ . ":" . __LINE__);
|
||||
$this->send(100 - $level);
|
||||
}
|
||||
//}else
|
||||
/*{
|
||||
logger(DEBUG, "store is already at level" . $this->storeLevel . " so < at " . $level, __FILE__ . ":" . __LINE__);
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
private function close ($reason)
|
||||
|
Reference in New Issue
Block a user