Beispiel #1
0
 public function on($value)
 {
     $zwave = new Zwave();
     foreach ($this->switches as $switch) {
         switch ($switch['protocol']) {
             case 'zwave':
                 $value == true ? $val = 'on' : ($val = 'false');
                 $zwave->command($sensor['sensor'], $val);
                 break;
         }
     }
 }
Beispiel #2
0
function initTimestamp($arr)
{
    $zwave = new Zwave();
    $arrMvt2 = array();
    for ($i = 0; $i < count($arr); $i++) {
        array_push($arrMvt2, $zwave->GetTimestamp($arr[$i]['sensor']));
    }
    return $arrMvt2;
}
Beispiel #3
0
function checkBattery()
{
    $zwave = new Zwave();
    $bdd = getBDD();
    $req = $bdd->query('SELECT * FROM at_sensors WHERE type = "Battery"');
    while ($data = $req->fetch()) {
        switch ($data['protocol']) {
            case 'zwave':
                $val = $zwave->getValue($data['sensor']);
                if ($val <= 15) {
                    $push = new PushMessage();
                    $push->sendMessage('Atlantis', 'Certains capteurs necessitent un changement de piles !');
                }
                break;
        }
    }
}