
Code: Select all
2016-12-21 20:25:39.798 User: Admin initiated a switch command (226/Motion Keuken/On)
2016-12-21 20:25:39.799 (Virtual Device) Lighting 2 (Motion Keuken)
2016-12-21 20:25:39.962 => Pass2PHP de functie reversed: Motion_Keuken
2016-12-21 20:25:39.966 => SETLEVEL 40
2016-12-21 20:25:39.969 User: Admin initiated a switch command (193/Lamp (Keukentafel)/Set Level)
2016-12-21 20:25:39.970 (RFXCom) Lighting 2 (Lamp (Keukentafel)))
To LIGHT ON: 2016-12-21 20:25:39.969 User: Admin initiated a switch command (193/Lamp (Keukentafel)/Set Level)
Total: 171ms
script_device_pass2php.lua
Code: Select all
c = ''
s = ''
i = ''
t = ''
for k,v in pairs(devicechanged) do c = c..k.."|"..v.."#" end
for k,v in pairs(otherdevices) do s = s..k.."|"..v.."#" end
for k,v in pairs(otherdevices_idx) do i = i..k.."|"..v.."#" end
for k,v in pairs(otherdevices_lastupdate) do t = t..k.."|"..v.."#" end
os.execute('curl -s --data "c='..c..'&s='..s..'&i='..i..'&t='..t..'" http://127.0.0.1/pass2php.php &')
start of pass2php.php
Code: Select all
<?php
error_reporting(E_ALL);
ini_set("display_errors","on");
date_default_timezone_set('Europe/Brussels');
define('time',$_SERVER['REQUEST_TIME']);
$c=ex($_REQUEST['c']);
$s=ex($_REQUEST['s']);
$i=ex($_REQUEST['i']);
$t=ex($_REQUEST['t']);
function ex($x){
$return=array();
$pieces=explode('#',$x);
foreach($pieces as $piece){
$keyval=explode('|',$piece);
if(count($keyval)>1)$return[$keyval[0]]=$keyval[1];
else $return[$keyval[0]]='';
}
return $return;
}
......