devicelist as $ieeeAddress) { $indexDevices[$ieeeAddress]->functions[] = array($this,"callback"); //print_r($indexDevices[$ieeeAddress]); } } // callback fonction. Is called with these 4 parameters public function callBack($topic, $fn, $param, $value) { global $devices, $indexDevices; switch($param) { case "occupancy": if ($value == 1) $this->send(); break; case "contact": if ($value == false) $this->send(); break; } echo _("notification received from MQTT") . EOL; //echo $param . "=> " . $value . EOL; } private function send() { global $devices, $indexDevices; if ($indexDevices["0x04cf8cdf3c78aff0"]->illuminance_lux <= 76) { $msg = array("state" => "ON"); $device = & $indexDevices["0x588e81fffe343e8f"]; $device->payload = $msg; $device->set(null); setDelay($device, $this->delay, $this->timeUnit, "state", "OFF", true); } } } $hooks["rdc/panneau/salon"] = new rdc_panneau_salon(); //assignation of the function to the sensors devices //$indexDevices["0x00124b0022ebac5c"]->functions[] = array($panneau_salon,"getCallback"); // rdc-salon-mvmt2 //$indexDevices["0x588e81fffe2cf695"]->functions[] = array($panneau_salon,"getCallback"); // rdc-salon-mvmt //$indexDevices["0x00124b001f900753"]->functions[] = array($panneau_salon,"getCallback"); // rdc-porte-entree //$indexDevices["0x04cf8cdf3c78aff0"]->functions[] = array($panneau_salon,"getCallback"); // rdc-salon-luminosite ?>