1
0
moha/class/availibility.php

32 lines
596 B
PHP
Raw Normal View History

<?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;
?>
?>