示例#1
0
// Copyright (C) Ron Klinkien, The Netherlands.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General PUBLIC License for more details.
// You should have received a copy of the GNU General PUBLIC License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
include "config.php";
include "functions.php";
$device = $_GET["device"];
$value = $_GET["value"];
if ($locations) {
    if (!isset($_GET["location"])) {
        $location = "*";
    } else {
        $location = $_GET["location"];
    }
    $data = get_device_list($location);
} else {
    $data = get_device_list("*");
}
$response = do_jsonrpc("device.set", array("device_id" => intval($device), "value" => $value));
if ($locations) {
    header('Location: device.php?location=' . $location);
} else {
    header('Location: device.php');
}
示例#2
0
function get_status()
{
    // modes
    $housemode = do_jsonrpc("housemode.get", null);
    $retarr['house_mode'] = $housemode['mode'];
    $retarr['mute_mode'] = $housemode['mute'];
    if ($retarr['mute_mode']) {
        $retarr['mute_mode'] = "<img src='images/icons/mute.png' height='16' width='16' alt='icon' />";
    } else {
        $retarr['mute_mode'] = "<img src='images/icons/sound.png' height='16' width='16' alt='icon' />";
    }
    // domotiga version
    $retarr['program_version'] = do_jsonrpc("domotiga.version", null);
    // sun moon data
    $astro = do_jsonrpc("astro.get", null);
    $retarr['data_sunset'] = $astro['sunset'];
    $retarr['data_sunrise'] = $astro['sunrise'];
    // new messages
    $newmessage = do_jsonrpc("data.newmessage", null);
    $retarr['data_newmails'] = $newmessage['email'];
    $retarr['data_newcalls'] = $newmessage['call'];
    $retarr['data_newvoicemails'] = $newmessage['voicemail'];
    return $retarr;
}
<?php

// DomotiGa - an open source home automation program
// Copyright (C) Ron Klinkien, The Netherlands.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General PUBLIC License for more details.
// You should have received a copy of the GNU General PUBLIC License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
include "config.php";
include "functions.php";
$mode = $_GET["mode"];
$mute = $_GET["mute"];
if (isset($mute)) {
    if ($mute == "true") {
        $response = do_jsonrpc("housemode.set", array("mute" => true));
    } else {
        if ($mute == "false") {
            $response = do_jsonrpc("housemode.set", array("mute" => false));
        }
    }
}
if (isset($mode)) {
    $response = do_jsonrpc("housemode.set", array("mode" => $mode));
}
header('Location: index.php');
示例#4
0
    $_SESSION['sortord'] = "asc";
}
if (isset($_GET['setsortord'])) {
    $_SESSION['sortord'] = $_GET['setsortord'];
}
// Session variables for current view
if (!isset($_SESSION['view'])) {
    $_SESSION['view'] = "main";
}
//if (isset($r_setview)) $_SESSION['view']=$r_setview;
//if (isset($r_reload)) unset($_SESSION['lastget']);
//if (!isset($_SESSION['refresh'])) $_SESSION['refresh']=$defaultrefresh;
//if (!isset($r_debug)) $r_debug=0;
if (isset($_GET['action'])) {
    echo "<h3>Requested to turn " . $_GET['name'] . " " . $_GET['action'] . ".</h3>";
    $response = do_jsonrpc("device.set", array("device_id" => (int) $_GET['deviceid'], "value" => $_GET['action']));
    header("Location: index.php?setview=control");
}
if (!isset($_GET['setview'])) {
    if (!isset($_SESSION['view'])) {
        $_SESSION['view'] = 'main';
    }
} else {
    $_SESSION['view'] = $_GET['setview'];
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="images/favicon.ico" />