1
0

debugging

This commit is contained in:
2022-01-28 23:05:58 +01:00
parent 1361cb9395
commit 425107cec7
22 changed files with 167 additions and 136 deletions

View File

@ -1,25 +1,19 @@
<?php
class <name_of_class>
class <name_of_class> extends hook
{
public $hookName = <public name of the hook>;
public $active = true; enable/disable hook (true => enabled)
public $active = true; //enable/disable hook (true => enabled)
private $devicelist = array(<ieee address or constant defined in config/devices_constants.php>) => <property of the device to watch>);
protected $devicelist = array(<ieee address or constant defined in config/devices_constants.php> => array(<property of the device to watch>, false));
// assigne the function to the sensors devices
function __construct()
// if you need some initialisation when creating the object, uncomment andput your code here.
// If existing, This function is called by __construct
/*protected function init()
{
global $indexDevices;
if ($this->active === true)
{
foreach ($this->devicelist as $ieeeAddress => $property)
{
$indexDevices[$ieeeAddress]->$property["functions"][] = array($this,"callback");
}
}
// put here your code to init the class
// Your code here
}
*/
// callback fonction. Is called with these 3 parameters
// $device -> calling device
@ -29,7 +23,7 @@ class <name_of_class>
{
// here your code
logger (INFO, _("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $property, $value);
logger (INFO,sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $property, $value), __FILE__ . ":" . __LINE__);
}
}