예제 #1
1
function checkBattery()
{
    $bdd = getBDD();
    $req = $bdd->query('SELECT t1.* FROM at_plants_history t1 LEFT JOIN at_plants_history t2 ON (t1.sensor = t2.sensor AND t1.date < t2.date) WHERE t2.date IS NULL AND t1.battery < 15');
    if ($req) {
        $push = new PushMessage();
        $push->sendMessage('Atlantis', 'Certains capteurs necessitent un changement de piles !');
    }
}
예제 #2
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;
        }
    }
}