1
0

making compatibility with mqtt's friendly names

This commit is contained in:
2021-12-31 14:34:20 +01:00
parent 5162731a16
commit 57390d099b
5 changed files with 151 additions and 61 deletions

View File

@ -5,8 +5,8 @@
$rdcPanneau = function($topic, $fn, $param, $value)
{
global $devices, $indexDevices;
$delay = 20;
$timeUnit = "sec";
$delay = 3;
$timeUnit = "min";
switch($param)
{
case "occupancy":
@ -14,16 +14,19 @@
{
$msg = array("state" => "ON");
$device = $devices[Z2M][$indexDevices["0x588e81fffe343e8f"]];
$device->set($msg);
setDelay($device, $delay, $timeUnit, $param, "OFF", true);
$device->payload = $msg;
$device->set(null);
setDelay($device, $delay, $timeUnit, "state", "OFF", true);
}
break;
}
echo _("notification received from MQTT") . EOL;
echo $param . "=> " . $value . EOL;
//echo $param . "=> " . $value . EOL;
};
//assignation of the function to the devices
$devices[Z2M][$indexDevices["0x00124b0022ebac5c"]]->functions[] = $rdcPanneau;
$devices[Z2M][$indexDevices["0x588e81fffe2cf695"]]->functions[] = $rdcPanneau;
//assignation of the function to the sensors devices
$indexDevices["0x00124b0022ebac5c"]->functions[] = $rdcPanneau;
$indexDevices["0x588e81fffe2cf695"]->functions[] = $rdcPanneau;
$indexDevices["0x04cf8cdf3c78aff0"]->functions[] = $rdcPanneau;
?>