1
0

a lot of bugs corrected\nrdc_wc_eclairage

This commit is contained in:
2022-03-13 22:33:26 +01:00
parent 9dde1c2d53
commit c8772aeda0
24 changed files with 534 additions and 191 deletions

View File

@@ -9,10 +9,10 @@ class rdc_chambre_eclairage extends hook
public $luminance_min = 60;
public $luminance_max = 3000;
protected $devicelist = array(
RDC_CHAMBRE_AMBIANCE => array("state", false), // "ON"/"OFF"
RDC_CHAMBRE_ECLAIRAGE => array("state_l1", false), // "ON"/"OFF"
RDC_CHAMBRE_MVMT => array("occupancy", false),
RDC_CHAMBRE_ARMOIRE_GAUCHE => array("contact", false)
RDC_CHAMBRE_AMBIANCE => "state", // "ON"/"OFF"
RDC_CHAMBRE_ECLAIRAGE => "state_l1", // "ON"/"OFF"
RDC_CHAMBRE_MVMT => "occupancy",
RDC_CHAMBRE_ARMOIRE_GAUCHE => "contact"
);
// callback fonction. Is called with these 3 parameters
@@ -25,9 +25,10 @@ class rdc_chambre_eclairage extends hook
$lux = $indexDevices[RDC_CHAMBRE_LUMINOSITE]->properties["illuminance_lux"];
$targetAmbiance = $indexDevices[RDC_CHAMBRE_AMBIANCE];
$targetEclairage = $indexDevices[RDC_CHAMBRE_ECLAIRAGE];
logger(DEBUG, sprintf(_("property=%s, value=%s"), $property, $value), __FILE__ . ":" . __LINE__);
if ($property == "occupancy" and $value == ON)
{
logger(DEBUG, _("CASE: occupancy"), __FILE__ . ":" . __LINE__);
$this->send($targetAmbiance, "state", "ON", "OFF", AUTO);
}elseif ($property == "contact")
{
@@ -42,7 +43,7 @@ class rdc_chambre_eclairage extends hook
logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $property, bool2string($value)), __FILE__ . ":" . __LINE__);
}
private function send($deviceObject, $property, $state, $delayState = false, $method = MANUAL)
private function send(&$deviceObject, $property, $state, $delayState = false, $method = MANUAL)
{
global $indexDevices;
$msg = array($property => $state);