- changed webserver to apiserver
- added webserver - a lot of debugging - install shell script
This commit is contained in:
@@ -12,7 +12,8 @@ class rdc_chambre_eclairage extends hook
|
||||
RDC_CHAMBRE_AMBIANCE => "state", // "ON"/"OFF"
|
||||
RDC_CHAMBRE_ECLAIRAGE => "state_l1", // "ON"/"OFF"
|
||||
RDC_CHAMBRE_MVMT => "occupancy",
|
||||
RDC_CHAMBRE_ARMOIRE_GAUCHE => "contact"
|
||||
RDC_CHAMBRE_ARMOIRE_GAUCHE => "contact",
|
||||
RDC_CHAMBRE_AMBIANCE_INTER => "action"
|
||||
);
|
||||
|
||||
// callback fonction. Is called with these 3 parameters
|
||||
@@ -26,19 +27,44 @@ 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);
|
||||
if ($targetAmbiance->properties["state"]["method"] == MANUAL)
|
||||
{
|
||||
$method = false;
|
||||
$delayState = false;
|
||||
}else
|
||||
{
|
||||
$method = AUTO;
|
||||
$delayState = "OFF";
|
||||
}
|
||||
|
||||
$this->send($targetAmbiance, "state", "ON", $delayState, $method);
|
||||
}elseif ($property == "contact")
|
||||
{
|
||||
if ($value == false)
|
||||
logger(DEBUG, _("CASE: contact"), __FILE__ . ":" . __LINE__);
|
||||
if ($value === false)
|
||||
{
|
||||
$this->send($targetEclairage, "state_l1", "ON", "OFF", AUTO);
|
||||
}elseif ($value == true)
|
||||
}elseif ($value === true)
|
||||
{
|
||||
$this->send($targetEclairage, "state_l1", "OFF", false, null);
|
||||
$this->send($targetEclairage, "state_l1", "OFF", false, IDLE);
|
||||
}
|
||||
}elseif ($property == "state" and $value == "OFF")
|
||||
{
|
||||
logger(DEBUG, _("CASE: state => value = 'OFF'"), __FILE__ . ":" . __LINE__);
|
||||
$targetAmbiance->properties[$property]["method"] = IDLE;
|
||||
}elseif ($property == "state_l1" and $value == "OFF")
|
||||
{
|
||||
logger(DEBUG, _("CASE: state_l1 => value = 'OFF'"), __FILE__ . ":" . __LINE__);
|
||||
$targetEclairage->properties[$property]["method"] = IDLE;
|
||||
}elseif ($property == "action")
|
||||
{
|
||||
logger(DEBUG, _("CASE: action"), __FILE__ . ":" . __LINE__);
|
||||
if ($targetAmbiance->properties[$property]["method"] == IDLE)
|
||||
{
|
||||
$targetAmbiance->properties[$property]["method"] == MANUAL;
|
||||
}
|
||||
}
|
||||
logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $property, bool2string($value)), __FILE__ . ":" . __LINE__);
|
||||
@@ -53,7 +79,7 @@ class rdc_chambre_eclairage extends hook
|
||||
logger(INFO, sprintf(_("publishing message: %s to %s"), json_encode($msg), $deviceObject->friendlyName), __FILE__ . ":" . __LINE__);
|
||||
$deviceObject->payload = $msg;
|
||||
$deviceObject->set();
|
||||
$deviceObject->method = $method;
|
||||
$deviceObject->properties[$property]["method"] = $method;
|
||||
///}else
|
||||
/*{
|
||||
logger(INFO, sprintf(_("not publishing message: %s to %s, already set"), json_encode($msg), $deviceObject->friendlyName), __FILE__ . ":" . __LINE__);
|
||||
|
Reference in New Issue
Block a user