- debug\n- webserver fonctionnel
This commit is contained in:
@ -45,14 +45,7 @@ class availability
|
||||
}
|
||||
break;
|
||||
}
|
||||
//echo sprintf(_("notification received from MQTT -> device %s is %s"), $device->friendlyName , $value). EOL;
|
||||
//echo $property . "=> " . $value . EOL;
|
||||
}
|
||||
/*
|
||||
public function getHook()
|
||||
{
|
||||
return array($this,"callback");
|
||||
}*/
|
||||
}
|
||||
|
||||
$hooks["availability"] = new availability();
|
||||
|
@ -26,21 +26,27 @@ class rdc_chambre_eclairage extends hook
|
||||
$targetAmbiance = $indexDevices[RDC_CHAMBRE_AMBIANCE];
|
||||
$targetEclairage = $indexDevices[RDC_CHAMBRE_ECLAIRAGE];
|
||||
|
||||
if ($property == "occupancy" and $value == "ON")
|
||||
if ($property == "occupancy" and $value == ON)
|
||||
{
|
||||
$this->send($targetAmbiance, "ON", "OFF", AUTO);
|
||||
}elseif ($property == "contact" and $value = true and getValue(RDC_CHAMBRE_ECLAIRAGE, "state_l1") == "OFF")
|
||||
$this->send($targetAmbiance, "state", "ON", "OFF", AUTO);
|
||||
}elseif ($property == "contact")
|
||||
{
|
||||
$this->send($targetEclairage, "ON", "OFF", AUTO);
|
||||
if ($value == false and getValue(RDC_CHAMBRE_ECLAIRAGE, "state_l1") == "OFF")
|
||||
{
|
||||
$this->send($targetEclairage, "state_l1", "ON", "OFF", AUTO);
|
||||
}elseif ($value == true and getValue(RDC_CHAMBRE_ECLAIRAGE, "state_l1") == "ON")
|
||||
{
|
||||
$this->send($targetEclairage, "state_l1", "OFF", null, null);
|
||||
}
|
||||
}
|
||||
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, $state, $delayState = false, $method = MANUAL)
|
||||
private function send($deviceObject, $property, $state, $delayState = false, $method = MANUAL)
|
||||
{
|
||||
global $devices, $indexDevices;
|
||||
$msg = array("state_l1" => $state);
|
||||
if ($deviceObject->properties["state_l1"]["value"] != $state)
|
||||
$msg = array($property => $state);
|
||||
if ($deviceObject->properties[$property]["value"] != $state)
|
||||
{
|
||||
logger(INFO, sprintf(_("publishing message: %s to %s"), json_encode($msg), $deviceObject->friendlyName), __FILE__ . ":" . __LINE__);
|
||||
$deviceObject->payload = $msg;
|
||||
|
@ -22,7 +22,7 @@ class rdc_wc_eclairage extends hook
|
||||
{
|
||||
setDelay($device, $this->delayManual, $this->timeUnit, "state_l2", "OFF", true);
|
||||
$device->method = MANUAL;
|
||||
}elseif ($value = "OFF")
|
||||
}elseif ($value == "OFF")
|
||||
{
|
||||
deleteEvent(searchEvent($device, "state_l2", "OFF"));
|
||||
}
|
||||
|
Reference in New Issue
Block a user