modified init and some debugging
This commit is contained in:
15
moha.php
15
moha.php
@ -53,7 +53,8 @@ define( "INFO", $client::LOG_INFO); // => 1
|
||||
define( "NOTICE", $client::LOG_NOTICE); // => 2
|
||||
define( "WARNING", $client::LOG_WARNING); // => 4
|
||||
define( "ERROR", $client::LOG_ERR); // => 8
|
||||
define( "ALL", DEBUG | INFO | NOTICE | WARNING | ERROR);
|
||||
define( "ALERT", 32);
|
||||
define( "ALL", DEBUG | INFO | NOTICE | WARNING | ERROR | ALERT);
|
||||
$logLevel = ALL;
|
||||
$notificationLevel = WARNING | ERROR;
|
||||
|
||||
@ -61,7 +62,7 @@ require "utils.php";
|
||||
require "mqtt_functions.php";
|
||||
require "events.php";
|
||||
require "db_functions.php";
|
||||
require "class/availability.php";
|
||||
//require "class/availability.php";
|
||||
|
||||
//include predefined file witch define constants for devices
|
||||
if (is_readable($configDir . "/" . "devices_constants.php"))
|
||||
@ -94,7 +95,7 @@ $client->connect("192.168.1.253", 1883, 5);
|
||||
foreach($topics as $name => $topic)
|
||||
{
|
||||
//echo $name;
|
||||
$topic->mid = $client->subscribe($name . "/#", 2);
|
||||
$topic->mid = $client->subscribe($name . "/bridge/#", 2);
|
||||
$mids[$topic->mid] = $name;
|
||||
$topic->status = false;
|
||||
}
|
||||
@ -104,6 +105,7 @@ while (true)
|
||||
$client->loop();
|
||||
if ($dbInit == 2 and ! $included)
|
||||
{
|
||||
getDevicesValues();
|
||||
loadHooks("./hooks", $hooksList);
|
||||
if (!empty($hooksList))
|
||||
{
|
||||
@ -118,6 +120,13 @@ while (true)
|
||||
if ($oneshot === false) // execute once initialization finished
|
||||
{
|
||||
$oneshot = true;
|
||||
foreach($topics as $name => $topic)
|
||||
{
|
||||
//echo $name;
|
||||
$topic->mid = $client->subscribe($name . "/#", 2);
|
||||
$mids[$topic->mid] = $name;
|
||||
$topic->status = false;
|
||||
}
|
||||
}
|
||||
checkEvents();
|
||||
}
|
||||
|
Reference in New Issue
Block a user