debuggage
This commit is contained in:
@ -8,7 +8,7 @@ class notificationFreemobile
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->level = WARNING | ERROR;
|
||||
$this->level = ALERT | ERROR;
|
||||
}
|
||||
|
||||
function send($message)
|
||||
|
58
hooks/scripts/etage_plan_travail_eclairage
Normal file
58
hooks/scripts/etage_plan_travail_eclairage
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
class etage_plan_travail_eclairage extends hook
|
||||
{
|
||||
public $hookName = "etage_plan_travail_eclairage";
|
||||
public $active = true; //enable/disable hook (true => enabled)
|
||||
public $delay = 3; // amount of time in $timeunit
|
||||
public $timeUnit = "hour"; // unit of time for delay, second, minute, hour, day, week, month, year
|
||||
protected $devicelist = array("ETAGE_CUISINE_PLAN_TRAVAIL_ECLAIRAGE" => array("action", false));
|
||||
|
||||
// if you need some initialisation when creating the object, uncomment andput your code here.
|
||||
// If existing, This function is called by __construct
|
||||
/*protected function init()
|
||||
{
|
||||
// Your code here
|
||||
}
|
||||
*/
|
||||
|
||||
// callback fonction. Is called with these 3 parameters
|
||||
// $device -> calling device
|
||||
// $property -> property of the device (given by mqtt)
|
||||
// $value -> value of the property
|
||||
public function callBack(&$device, $property, $value)
|
||||
{
|
||||
// here your code
|
||||
if($value == "ON") // ON
|
||||
{
|
||||
$this->send("ON", "OFF");
|
||||
}elseif($value == "OFF")
|
||||
{
|
||||
$this->send("OFF", null, AUTO);
|
||||
}
|
||||
logger (INFO,sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $property, $value));
|
||||
}
|
||||
|
||||
private function send($state, $delayState = false, $method = MANUAL)
|
||||
{
|
||||
global $devices, $indexDevices;
|
||||
$device = & $indexDevices[ETAGE_CUISINE_PLAN_TRAVAIL_SPOT];
|
||||
$msg = array("state_l1" => $state);
|
||||
if ($device->state_l1["value"] != $state)
|
||||
{
|
||||
logger(INFO, sprintf(_("publishing message: %s to %s"), json_encode($msg), $device->friendlyName));
|
||||
$device->payload = $msg;
|
||||
$device->set();
|
||||
$device->method = $method;
|
||||
}else
|
||||
{
|
||||
logger(INFO, sprintf(_("not publishing message: %s to %s, already set"), json_encode($msg), $device->friendlyName));
|
||||
|
||||
}
|
||||
//echo 'delaystate = ' . var_dump($delayState);
|
||||
if ($delayState !== false) setDelay($device, $this->delay, $this->timeUnit, "state", $delayState, true);
|
||||
}
|
||||
}
|
||||
|
||||
$hooks["etage_plan_travail_eclairage"] = new etage_plan_travail_eclairage();
|
||||
?>
|
31
hooks/scripts/rdc_chambre_eclairage.php
Normal file
31
hooks/scripts/rdc_chambre_eclairage.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
class rdc_chambre_eclairage extends hook
|
||||
{
|
||||
public $hookName = "rdc_chambre_eclairage";
|
||||
public $active = false; //enable/disable hook (true => enabled)
|
||||
|
||||
protected $devicelist = array();
|
||||
|
||||
// if you need some initialisation when creating the object, uncomment andput your code here.
|
||||
// If existing, This function is called by __construct
|
||||
/*protected function init()
|
||||
{
|
||||
// Your code here
|
||||
}
|
||||
*/
|
||||
|
||||
// callback fonction. Is called with these 3 parameters
|
||||
// $device -> calling device
|
||||
// $property -> property of the device (given by mqtt)
|
||||
// $value -> value of the property
|
||||
public function callBack(&$device, $property, $value)
|
||||
{
|
||||
// here your code
|
||||
|
||||
logger (INFO,sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $property, $value));
|
||||
}
|
||||
}
|
||||
|
||||
$hooks["rdc_chambre_eclairage"] = new rdc_chambre_eclairage();
|
||||
?>
|
@ -12,7 +12,7 @@ class rdc_salon_eclairage extends hook
|
||||
);
|
||||
|
||||
public $delay = 5; // amount of time in $timeunit
|
||||
public $timeUnit = "minute"; // unit of time for delay, second, minute, day, week, month, year
|
||||
public $timeUnit = "minute"; // unit of time for delay, second, minute, hour, day, week, month, year
|
||||
public $luminance_min = 60;
|
||||
public $luminance_max = 3000;
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
class rdc_sdb_eclairage extends hook
|
||||
{
|
||||
public $hookName = "rdc_sdb_eclairage";
|
||||
public $active = true;
|
||||
|
||||
/* already defined in hook class */
|
||||
// public $active = true;
|
||||
@ -26,7 +27,7 @@ class rdc_sdb_eclairage extends hook
|
||||
public function callBack(&$device, $property, $value)
|
||||
{
|
||||
global $devices, $indexDevices;
|
||||
var_dump($value);
|
||||
//var_dump($value);
|
||||
switch($property)
|
||||
{
|
||||
case "occupancy":
|
||||
@ -56,9 +57,10 @@ class rdc_sdb_eclairage extends hook
|
||||
global $devices, $indexDevices;
|
||||
$msg = array("state_l1" => $state);
|
||||
$device = & $indexDevices[RDC_SDB_WC_ECLAIRAGE];
|
||||
logger(INFO, sprintf(_("publishing message: %s to %s"), $msg, $device->friendlyName));
|
||||
logger(INFO, sprintf(_("publishing message: %s to %s"), $state, $device->friendlyName));
|
||||
$device->payload = $msg;
|
||||
$device->set(null);
|
||||
|
||||
}
|
||||
}
|
||||
$hooks["rdc_sdb_eclairage"] = new rdc_sdb_eclairage();
|
||||
|
@ -14,7 +14,7 @@ class rdc_wc_eclairage extends hook
|
||||
public function callBack(&$device, $property, $value)
|
||||
{
|
||||
global $devices, $indexDevices;
|
||||
var_dump($value);
|
||||
//var_dump($value);
|
||||
switch($property)
|
||||
{
|
||||
case "state_l2":
|
||||
|
Reference in New Issue
Block a user