1
0

added distants notifications and devices availability warning

This commit is contained in:
2022-01-02 13:47:41 +01:00
parent 02dfa615fa
commit 2e6b2fe5cb
6 changed files with 99 additions and 17 deletions

31
class/availibility.php Normal file
View 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;
?>
?>