DTux
/
dtux__moha
Archived
1
0
Fork 0
This commit is contained in:
Daniel Tartavel 2023-01-26 18:30:51 +01:00
parent ad73b91cc5
commit 098ecdbecb
4 changed files with 20 additions and 15 deletions

View File

@ -1 +0,0 @@
a:0:{}

View File

@ -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)

View File

@ -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();

View File

@ -14,6 +14,7 @@ StandardError=inherit
Restart=always
User=domotique
Group=domotique
Nice=15
[Install]
WantedBy=multi-user.target