first commit
This commit is contained in:
29
scripts/panneau_salon.php
Normal file
29
scripts/panneau_salon.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
$scriptTopic = Z2M;
|
||||
|
||||
//callback function
|
||||
$rdcPanneau = function($topic, $fn, $param, $value)
|
||||
{
|
||||
global $devices, $indexDevices;
|
||||
$delay = 20;
|
||||
$timeUnit = "sec";
|
||||
switch($param)
|
||||
{
|
||||
case "occupancy":
|
||||
if ($value == 1)
|
||||
{
|
||||
$msg = array("state" => "ON");
|
||||
$device = $devices[Z2M][$indexDevices["0x588e81fffe343e8f"]];
|
||||
$device->set($msg);
|
||||
setDelay($device, $delay, $timeUnit, $param, "OFF", true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
echo _("notification received from MQTT") . EOL;
|
||||
echo $param . "=> " . $value . EOL;
|
||||
};
|
||||
|
||||
//assignation of the function to the devices
|
||||
$devices[Z2M][$indexDevices["0x00124b0022ebac5c"]]->functions[] = $rdcPanneau;
|
||||
$devices[Z2M][$indexDevices["0x588e81fffe2cf695"]]->functions[] = $rdcPanneau;
|
||||
?>
|
Reference in New Issue
Block a user