1
0
This commit is contained in:
2022-09-05 13:47:41 +02:00
parent 0c9f8f8c3f
commit 4acb2992ca
15 changed files with 82 additions and 53 deletions

View File

@ -9,7 +9,7 @@ class notificationFreemobile
public $lastTry;
public $lastTryTimeout = 5;
protected $dest = array(
"daniel" => "15480189&pass=yVpPmCWmUl2HGp",
"Daniel" => "15480189&pass=yVpPmCWmUl2HGp",
);
function __construct()
@ -27,7 +27,7 @@ class notificationFreemobile
curl_setopt($ch, CURLOPT_URL, $this->url . $this->dest[$destinataire] . "&msg=" . urlencode(trim($message)));
// return the transfer as a string
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $result contains the output string
if ($this->curlErr <= 5)
{

View File

@ -33,10 +33,10 @@ class alerte_intrusion extends hook
{
if ($value == false and isPresent() === false)
{
logger(ALERT, sprintf(_("%s vient de s'ouvrir alors que personne n'est présent"), $device->friendlyName), __FILE__ . ":" . __LINE__);
logger(ALERT, sprintf(_("%s vient de s'ouvrir alors que personne n'est présent"), $device->friendlyName), __FILE__ . ":" . __LINE__, $device);
}else
{
logger(ALERT, sprintf(_("%s vient de se fermer alors que personne n'est présent"), $device->friendlyName), __FILE__ . ":" . __LINE__);
logger(ALERT, sprintf(_("%s vient de se fermer alors que personne n'est présent"), $device->friendlyName), __FILE__ . ":" . __LINE__, $device);
}
}
break;

View File

@ -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__);

View File

@ -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
@ -154,11 +155,11 @@ 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 < 100 and $soleil < 100)
}elseif ($exterieurLuxMoyen < 5000 and $salon_lux < 200 and $soleil < 100)
{
logger(DEBUG, "exterieurLuxMoyen < 5000 and salon_lux < 100 and soleil < 100", __FILE__ . ":" . __LINE__);
logger(DEBUG, "exterieurLuxMoyen < 5000 and salon_lux < 200 and soleil < 100", __FILE__ . ":" . __LINE__);
$this->close("Luminosité faible");
}
@ -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__);

View File

@ -50,7 +50,7 @@ class test_portes extends hook
}
if ($send)
{
logger(ALERT, _("doors opened :") . $msg, null ,$device);
logger(ALERT, _("doors opened :") . $msg, null, $device);
}
return $portes;
}