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; } } }
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; }
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; } } }