コード例 #1
0
<?php

WriteToFile('log/switch.log', 'timer came back: ' . $_POST['data'] . chr(10));
$timerConfig = json_decode($_POST['data'], true);
$device = getDeviceDS($timerConfig['key']);
if (sizeof($device) > 0) {
    $dcfg = json_decode($device['d_config'], true);
    $tmr = $dcfg[$timerConfig['trigger']];
    if ($tmr) {
        $GLOBALS['command-mode'] = 'trigger';
        deviceCommand($timerConfig['key'], $timerConfig['param'], $tmr['value'], first($tmr['stxt'], 'API'));
    } else {
        WriteToFile('log/error.log', 'timer trigger not found: ' . $timerConfig['trigger'] . chr(10));
    }
}
コード例 #2
0
 function ajax_switch()
 {
     $this->skipView = true;
     deviceCommand($_REQUEST['key'], first($_REQUEST['p'], 'STATE'), $_REQUEST['v'], first($_REQUEST['by'], 'EXT'), true);
 }
コード例 #3
0
ファイル: H2Event.php プロジェクト: bangnaga/HomeOverlord
 function handleSETLine($line, $data)
 {
     $param = $data['fnParams'][0];
     $value = $data['fnParams'][1];
     $rvalue = $data['fnParams'][2];
     if ($data['reverseAction']) {
         $value = $rvalue;
     }
     if ($value == '') {
         return;
     }
     $idx = $this->getAllDevices();
     if (is_array($data['select'])) {
         foreach ($data['select'] as $k => $enabled) {
             if ($enabled) {
                 $ds = $idx[$k];
                 deviceCommand($k, $param, $value);
                 # todo: broadcast
             }
         }
     }
     $this->executeLine($data['line'], $data);
 }