diff --git a/events.db b/events.db deleted file mode 100644 index c856afc..0000000 --- a/events.db +++ /dev/null @@ -1 +0,0 @@ -a:0:{} \ No newline at end of file diff --git a/hooks/scripts/radiateurs.php b/hooks/scripts/radiateurs.php index ca09a32..a5f20e8 100644 --- a/hooks/scripts/radiateurs.php +++ b/hooks/scripts/radiateurs.php @@ -2,7 +2,7 @@ class radiateurs extends hook { public $hookName = "radiateurs"; - public $active = false; + public $active = true; /* already defined in hook class */ // public $active = true; @@ -25,6 +25,7 @@ class radiateurs extends hook // ETAGE_BUREAU_FENETRE => "contact" ); + // list of actions (sensor => hvac) protected $hvac = array( RDC_CHAMBRE_BAIE => RDC_CHAMBRE_RADIATEUR, RDC_SALON_BAIE => RDC_SALON_RADIATEUR, @@ -49,6 +50,11 @@ class radiateurs extends hook // ETAGE_CHAMBRE_RADIATEUR => 0 ); + function installHooks(&$indexDevices) + { + return $this->installHooksFunction($indexDevices); + } + // callback fonction. Is called with these 3 parameters public function callBack(&$device, $property, $value) { @@ -107,7 +113,7 @@ class radiateurs extends hook $t = getValue($device->ieeeAddress, "current_heating_setpoint"); if ($t != $this->minTemp) { - $this->prevTemp[$device->ieeeAddress] = getValue($device->ieeeAddress, "current_heating_setpoint"); + $this->prevTemp[$device->ieeeAddress] = $t; } $setTo = $minTemp; }else @@ -125,7 +131,6 @@ class radiateurs extends hook if ($flag === false) { $setTo = (!empty($this->prevTemp[$device->ieeeAddress])?$this->prevTemp[$device->ieeeAddress]:19); - } } if ($setTo <> 0) diff --git a/moha.php b/moha.php index 5fca957..fc1f830 100644 --- a/moha.php +++ b/moha.php @@ -272,6 +272,7 @@ if (file_exists($dataPath . "events.db")) } } + // topics definition listHooks("./topics_callbacks", $topicsCallbacks); if (!empty($topicsCallbacks)) @@ -341,8 +342,6 @@ if (file_exists($dataPath . "devices.db")) } } - - // Program start logger(DEBUG, _("Program start"), __FILE__ . ":" . __LINE__); $client = new Mosquitto\Client(); @@ -387,7 +386,7 @@ configWatchInit(); while (true) { // test if looping is more then 5 second and send and alert - echo date("c") . " début"; +// echo date("c") . " début"; $now = new datetime("now"); $testTime = clone $now; $testTime->modify("-5 second"); @@ -398,14 +397,15 @@ while (true) $timeLoop = $now; $client->loop(); // mqtt server loop() -echo date("c") . " One shot"; - if ($oneshot === false) // execute while the first loop :WARNING hooks may not be initialized + + if ($oneshot === false) // execute while the first loop :WARNING all hooks may not be initialized { + echo date("c") . " One shot"; logger(DEBUG, _("Oneshot part of loop"), __FILE__ . ":" . __LINE__, false); pws2mqttGetList(); $oneshot = true; } -echo date("c") . " initialisation des hooks"; +//echo date("c") . " initialisation des hooks"; if($hooksInitialized == 0) // all hooks are not initialized { $i = 1; @@ -432,13 +432,13 @@ echo date("c") . " initialisation des hooks"; { //logger(DEBUG, _("looping"), __FILE__ . ":" . __LINE__); } - echo date("c") . " chech events"; +// echo date("c") . " chech events"; checkEvents(); - echo date("c") . " topics availabiblity"; +// echo date("c") . " topics availabiblity"; checkTopicsAvailability(); -echo date("c") . " apiserver"; +//echo date("c") . " apiserver"; if ($apiServerIsActive) apiServer($read); -echo date("c") . " surveillance Configuration"; +//echo date("c") . " surveillance Configuration"; // surveillance du dossier de configuration if ($cwfd !== false) { @@ -458,7 +458,7 @@ echo date("c") . " surveillance Configuration"; } } } -echo date("c") . " fin"; +//echo date("c") . " fin"; } endMoha(); diff --git a/systemd/moha.service b/systemd/moha.service index f26f619..acf4b26 100644 --- a/systemd/moha.service +++ b/systemd/moha.service @@ -14,6 +14,7 @@ StandardError=inherit Restart=always User=domotique Group=domotique +Nice=15 [Install] WantedBy=multi-user.target