1
0
This commit is contained in:
2022-05-29 01:55:22 +02:00
parent 68fb0579ce
commit cde4d728cf
7 changed files with 79 additions and 63 deletions

View File

@ -18,7 +18,7 @@ class notificationFreemobile
{
global $curlErr;
$result = false;
if ($this->active == true)
if ($this->active === true)
{
$ch = curl_init();
// set url

View File

@ -3,7 +3,7 @@
class rdc_store extends hook
{
public $hookName = "rdc_store";
public $active = true; //enable/disable hook (true => enabled)
public $active = false; //enable/disable hook (true => enabled)
public $timer = 0;
public $luminance_min = 60;
public $luminance_max = 3000;
@ -74,7 +74,7 @@ class rdc_store extends hook
$rainTmp = $indexDevices[METEO]->properties["rainin"]["value"];
$rain = $rainTmp - $rainS;
$rainS = $rainTmp;
logger(DEBUG, "rain=" . var_dump($rain), __FILE__ . ":" . __LINE__);
logger(DEBUG, "rain=" . $rain, __FILE__ . ":" . __LINE__);
}
if (array_key_exists("windgustkmh", $indexDevices[METEO]->properties))
{
@ -82,7 +82,7 @@ class rdc_store extends hook
{
logger(ALERT, "Vent fort :" . $indexDevices[METEO]->properties["windgustkmh"]["value"], __FILE__ . ":" . __LINE__);
}
$rafale = $mohaDB->moyenne($indexDevices[METEO], "windgustkmh", 7);
$rafale = $indexDevices[METEO]->properties["windgustkmh"]["value"]; //$mohaDB->moyenne($indexDevices[METEO], "windgustkmh", 6);
logger(DEBUG, "rafale=" . $rafale, __FILE__ . ":" . __LINE__);
}
if (array_key_exists("solarradiation", $indexDevices[METEO]->properties))
@ -92,7 +92,7 @@ class rdc_store extends hook
}
}
logger(DEBUG, sprintf(_("property=%s, value=%s"), $property, $value), __FILE__ . ":" . __LINE__);
if ($rafale >= 60 or $rain != 0)
if ($rafale >= 50 or $rain != 0)
{
$this->maxLevel = 0;
logger(DEBUG, sprintf("rafale = %s and rain = %s",$rafale, $rain), __FILE__ . ":" . __LINE__);
@ -100,7 +100,7 @@ class rdc_store extends hook
return 0;
}elseif ($rafale != 0)
{
$this->maxLevel = ($r = 100 - round(($rafale-10)/5, 0, PHP_ROUND_HALF_UP)*20)<0 ? 0 : $r;
$this->maxLevel = ($r = 100 - round($rafale/5, 0, PHP_ROUND_HALF_UP)*10)<0 ? 0 : $r;
//$this->maxLevel = 100 / $rafale;
logger(DEBUG, "rafale=" . $rafale, __FILE__ . ":" . __LINE__);
}
@ -110,7 +110,7 @@ class rdc_store extends hook
{
case "illuminance_lux":
logger(DEBUG, "CASE: illuminance_lux:" . $value, __FILE__ . ":" . __LINE__);
if ($exterieur_lux > 30000)
if ($exterieur_lux > 30000 or $salon_lux >600)
{
logger(DEBUG, "exterieur_lux > 30000", __FILE__ . ":" . __LINE__);
if ($this->maxLevel != 0 and $salon_lux > 100)
@ -126,7 +126,7 @@ class rdc_store extends hook
$this->set($store2level);
}
}
}elseif ($exterieur_lux < 15000 and $salon_lux < 110)
}elseif ($exterieur_lux < 12000 and $salon_lux < 150)
{
logger(DEBUG, "exterieur_lux < 15000", __FILE__ . ":" . __LINE__);
$this->close("Luminosité faible");
@ -140,19 +140,14 @@ class rdc_store extends hook
logger(DEBUG, "CASE: windgustkmh:" . $rafale, __FILE__ . ":" . __LINE__);
//case "windspeedkmh":
// logger(DEBUG, "CASE: windspeedkmh:" . $value, __FILE__ . ":" . __LINE__);
logger(DEBUG, "maxLevel = " . $this->maxLevel . ' result => $r = ' . $r, __FILE__ . ":" . __LINE__);
if ($this->storeLevel > $this->maxLevel)
{
$this->set($this->maxLevel);
}
break;
default:
}
/*if ($store2level <= $this->storeLevel)
logger(DEBUG, "maxLevel = " . $this->maxLevel . ' result => $r = ' . $r, __FILE__ . ":" . __LINE__);
if ($this->storeLevel > $this->maxLevel)
{
$this->set($store2level);
}*/
$this->set($this->maxLevel);
}
}
private function set ($level)