1
0

debuggage

This commit is contained in:
2022-06-20 10:34:55 +02:00
parent da3f4ab51f
commit 58812c442f
13 changed files with 130 additions and 87 deletions

View File

@@ -11,7 +11,10 @@ class rdc_salon_eclairage extends hook
RDC_ENTREE_PORTE => "contact",
RDC_SALON_LUMINOSITE => "illuminance_lux"
);
protected $actionneurs = array(
array(RDC_SALON_MVMT, "occupancy", 1),
array(RDC_SALON_MVMT2, "occupancy", 1)
);
public $delay = 3; // amount of time in $timeunit
public $timeUnit = "minute"; // unit of time for delay, second, minute, hour, day, week, month, year
public $luminance_min = 50;
@@ -58,11 +61,8 @@ class rdc_salon_eclairage extends hook
logger(INFO, _("CASE: Contact Door"), __FILE__ . ":" . __LINE__);
if ($value == false and $illuminance <= $this->luminance_min)
{
logger(INFO, _("Door is open and illumance < min"), __FILE__ . ":" . __LINE__);
if ($deviceTarget->properties["state"]["method"] !== MANUAL)
{
$this->send($deviceTarget, "ON", false);
}else
logger(INFO, _("Door is open and illumance < min and method =>") . $deviceTarget->properties["state"]["method"], __FILE__ . ":" . __LINE__);
if ($deviceTarget->properties["state"]["method"] == IDLE)
{
$this->send($deviceTarget, "ON", "OFF", AUTO);
}
@@ -89,7 +89,7 @@ class rdc_salon_eclairage extends hook
logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $param, bool2string($value)), __FILE__ . ":" . __LINE__);
}
private function send(&$deviceTarget, $state, $delayState = false, $method = MANUAL)
private function send(&$deviceTarget, $state, $delayState = false, $method = AUTO)
{
global $indexDevices;
@@ -98,8 +98,8 @@ class rdc_salon_eclairage extends hook
//{
logger(INFO, sprintf(_("publishing message: %s to %s"), json_encode($msg), $deviceTarget->friendlyName), __FILE__ . ":" . __LINE__);
$deviceTarget->payload = $msg;
$deviceTarget->set();
$deviceTarget->properties["state"]["method"] = $method;
$deviceTarget->set("state", "method");
//$deviceTarget->properties["state"]["method"] = $method;
/*}else
{
logger(INFO, sprintf(_("not publishing message: %s to %s, already set"), json_encode($msg), $deviceTarget->friendlyName), __FILE__ . ":" . __LINE__);