added distants notifications and devices availability warning
This commit is contained in:
31
class/availibility.php
Normal file
31
class/availibility.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
<?php
|
||||
class availability
|
||||
{
|
||||
// by default all devices are listening for availability
|
||||
|
||||
// callback fonction. Is called with these 4 parameters
|
||||
public function callBack($topic, $fn, $param, $value)
|
||||
{
|
||||
global $devices, $indexDevices, $notificationMethods;
|
||||
switch($param)
|
||||
{
|
||||
case "availability":
|
||||
if ($value != "online")
|
||||
{
|
||||
//your code here
|
||||
logger("Device: " . $topic . "/" . $fn . "is offline");
|
||||
}
|
||||
break;
|
||||
}
|
||||
echo _("notification received from MQTT") . EOL;
|
||||
//echo $param . "=> " . $value . EOL;
|
||||
}
|
||||
}
|
||||
|
||||
$hooks["availability"] = new availability;
|
||||
?>
|
||||
|
||||
|
||||
|
||||
?>
|
Reference in New Issue
Block a user