some debugging and modifying hooks functions to fetch parameters
This commit is contained in:
@@ -25,19 +25,19 @@ class notificationFreemobile
|
||||
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
|
||||
// $result contains the output string
|
||||
echo "1 curlErr =>"; var_dump($curlErr); echo EOL;
|
||||
//echo "1 curlErr =>"; var_dump($curlErr); echo EOL;
|
||||
if ($curlErr <= 10)
|
||||
{
|
||||
$result = curl_exec($ch);
|
||||
echo "1 result => "; var_dump($result);echo EOL;
|
||||
//echo "1 result => "; var_dump($result);echo EOL;
|
||||
if ($result === false)
|
||||
{
|
||||
$curlErr += 1;
|
||||
logger(ERROR, sprintf( _("Curl return error %d: %s when sending notification"), curl_errno($ch), curl_error($ch)), false);
|
||||
}else
|
||||
}/*else
|
||||
{
|
||||
logger(INFO, sprintf(_("Curl return: %s when sending notification"), $result), false);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
// close curl resource to free up system resources
|
||||
curl_close($ch);
|
||||
|
@@ -4,7 +4,14 @@ class rdc_salon_eclairage
|
||||
public $hookName = "rdc_salon_eclairage";
|
||||
public $active = true;
|
||||
// list of devices we are listening to
|
||||
private $devicelist = array("0x00124b0022ebac5c", "0x588e81fffe2cf695", "0x00124b001f900753", "0x04cf8cdf3c78aff0");
|
||||
|
||||
private $devicelist = array(
|
||||
RDC_SALON_MVMT => "occupancy",
|
||||
RDC_SALON_MVMT2 => "occupancy",
|
||||
RDC_ENTREE_PORTE => "contact",
|
||||
RDC_SALON_LUMINOSITE => "illuminance_lux"
|
||||
);
|
||||
|
||||
public $delay = 3; // amount of time in $timeunit
|
||||
public $timeUnit = "minute"; // unit of time for delay, second, minute, day, week, month, year
|
||||
public $luminance_min = 80;
|
||||
@@ -18,9 +25,9 @@ class rdc_salon_eclairage
|
||||
// assigne the function to the sensors devices
|
||||
if ($this->active === true)
|
||||
{
|
||||
foreach ($this->devicelist as $ieeeAddress)
|
||||
foreach ($this->devicelist as $ieeeAddress => $param)
|
||||
{
|
||||
$indexDevices[$ieeeAddress]->functions[] = array($this,"callback");
|
||||
$indexDevices[$ieeeAddress]->$param["functions"][] = array($this,"callback");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,13 +39,13 @@ class rdc_salon_eclairage
|
||||
switch($param)
|
||||
{
|
||||
case "occupancy":
|
||||
if ($value == 1 and $indexDevices["0x04cf8cdf3c78aff0"]->illuminance_lux <= $this->luminance_min)
|
||||
if ($value == 1 and $indexDevices[RDC_SALON_LUMINOSITE]->illuminance_lux["value"] <= $this->luminance_min)
|
||||
{
|
||||
$this->send("ON");
|
||||
}
|
||||
break;
|
||||
case "contact":
|
||||
if ($value == false and $indexDevices["0x04cf8cdf3c78aff0"]->illuminance_lux <= $this->luminance_min)
|
||||
if ($value == false and $indexDevices[RDC_SALON_LUMINOSITE]->illuminance_lux["value"] <= $this->luminance_min)
|
||||
{
|
||||
$this->send("ON");
|
||||
}
|
||||
@@ -54,7 +61,7 @@ class rdc_salon_eclairage
|
||||
{
|
||||
global $devices, $indexDevices;
|
||||
$msg = array("state" => $state);
|
||||
$device = & $indexDevices["0x588e81fffe343e8f"];
|
||||
$device = & $indexDevices[RDC_SALON_ECLAIRAGE_PANNEAU];
|
||||
logger(INFO, sprintf(_("publishing message: %s to %s"), $msg, $device->friendlyName));
|
||||
$device->payload = $msg;
|
||||
$device->set(null);
|
||||
|
@@ -23,9 +23,9 @@ class rdc_sdb_eclairage
|
||||
// assigne the function to the sensors devices
|
||||
if ($this->active === true)
|
||||
{
|
||||
foreach ($this->devicelist as $ieeeAddress)
|
||||
foreach ($this->devicelist as $ieeeAddress => $param)
|
||||
{
|
||||
$indexDevices[$ieeeAddress]->functions[] = array($this,"callback");
|
||||
$indexDevices[$ieeeAddress]->$param["functions"][] = array($this,"callback");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user