Пример #1
0
 } else {
     $xp = 100 / ($MaxPression - $MinPression);
 }
 $ii = $break = 0;
 do {
     $day = idate('w', $itime);
     $idate = date("d/m H:i", $itime);
     $tmin = $hum = $co = $pres = $noise = $tip = '';
     $key = $keys[$ii];
     if (abs($key - $itime) < 2 * $inter) {
         if ($ii < $num - 1) {
             ++$ii;
         } else {
             $break = 1;
         }
         $tmin = degree2($meas1[$key][0]);
         $hum = $meas1[$key][1];
         $co = $meas1[$key][2];
         $pres = intval($meas1[$key][3] + 0.5);
         $noise = $meas1[$key][4];
         $iidate = tr($jour[$day]) . date(" d/m/y", $key) . '&nbsp &nbsp &nbsp &nbsp' . date("H:i", $key);
         $tip = tipHTMLint5($iidate, $tmin, $hum, $co, $pres, $noise);
         if ($co) {
             $co = min($co, 1000);
             $co /= 10;
         }
         if ($xp) {
             $pres = intval(($pres - $MinPression) * $xp + 0.5);
         }
     } else {
         if ($key - $itime < 0) {
Пример #2
0
 } else {
     $idate = date("d/m H:i", $itime);
 }
 echo "data1.addRow([\"{$idate}\"";
 for ($j = 0; $j < $numCapteurs; $j++) {
     if ($view[$j] == 0) {
         continue;
     }
     $tmin0 = $tip = '';
     $key = $keys[$j][$ii[$j]];
     if (abs($key - $itime) < 2 * $inter) {
         if ($ii[$j] < $nmesures[$j] - 1) {
             ++$ii[$j];
         }
         if ($T1) {
             $tmin0 = degree2($mesure[$j][$key][1]);
         } else {
             $tmin0 = $mesure[$j][$key][1];
         }
         if ($HTime) {
             $tip = tip($tmin0, $mesure[$j][$key][3]);
         } else {
             $tip = $tmin0;
         }
         //tip($tmin0,$itime);
     }
     echo ",{$tmin0},'{$tip}'";
 }
 echo ",0]);\n";
 $itime += $inter;
 if ($itime >= $date_end) {
Пример #3
0
function fill($stationId, $devices, $mydevices, $dashboard)
{
    $Temperature_unit = $_SESSION['Temperature_unit'];
    $cu = $Temperature_unit ? '°' : 'F';
    $station = $devices["station_name"];
    $int_name = $devices["module_name"];
    $ext_name = $devices["modules"][0]["module_name"];
    $titre = "({$mydevices['latlng']['latitude']}°,{$mydevices['latlng']['longitude']}°,{$mydevices['latlng']['altitude']}m)";
    $drecent = $dashboard[-1]["time_utc"];
    $dateInt = date('d/m/Y H:i', $drecent);
    $dateExt = date('d/m/Y H:i', $dashboard[0]["time_utc"]);
    $recentData = time() - $drecent > 24 * 60 * 60 ? 0 : 1;
    $thum = tr('Humidité');
    $tson = tr('Bruit');
    $tpression = tr('Pression');
    $tint = degree2($dashboard[-1]["Temperature"]);
    $textcelsius = $dashboard[0]["Temperature"];
    $text = degree2($textcelsius);
    $tmin = degree2($dashboard[0]["min_temp"]);
    $tmax = degree2($dashboard[0]["max_temp"]);
    $dtmax = $dashboard[0]["date_max_temp"];
    $dtmin = $dashboard[0]["date_min_temp"];
    $dateMinMax = 'min:' . date('d/m/Y H:i', $dtmin) . ' max:' . date('d/m/Y H:i', $dtmax);
    $humInt = $dashboard[-1]["Humidity"];
    $humExt = $dashboard[0]["Humidity"];
    $co2 = $dashboard[-1]["CO2"];
    $db = $dashboard[-1]["Noise"];
    $pres = intval($dashboard[-1]["Pressure"] + 0.5);
    $dew = dewpoint($textcelsius, $humExt);
    $heati = heatIndex($textcelsius, $humExt);
    $hu = humidex($textcelsius, $dew);
    if (!$recentData) {
        $tint = $text = 'OLD';
    }
    $numModules = count($dashboard) - 1;
    $pluvio = $mydevices["pluviometre"];
    if ($pluvio) {
        $rain24 = $dashboard[$pluvio]["sum_rain_24"];
        $rain24 = intval($rain24 * 10 + 0.5) / 10;
        $rain1 = $dashboard[$pluvio]["sum_rain_1"];
        $rain1 = intval($rain1 * 10 + 0.5) / 10;
        $rain = $dashboard[$pluvio]["Rain"];
        $rain = intval($rain * 10 + 0.5) / 10;
        $rainTitle = 'r: ' . $rain . ' 1h:' . $rain1 . 'mm 24h:' . $rain24 . 'mm';
    }
    echo "\t\t\n\t<table class='icone'>\n\t<tr>\n\t<td colspan='7' class='th' title=\"{$titre}\">{$station}</td>\n\t</tr>\n\t<tr>\n\t<td style='height=40px;'><img src='icone/sun.png' ALT='outside' height='40'/></td> \n\t<td  class='c1' colspan='2' title=\"{$dateExt}  Heat Index: {$heati}{$cu} Humidex: {$hu}{$cu}\">{$text}{$cu} <span style='color:#aa0000; font-size: 12px;'>({$dew}{$cu})</span></td>\n\t<td></td>\n\t<td><img src='icone/maison.png' ALT='insideside' height='40'/></td> \n\t<td class='c1' colspan='2' title=\"{$dateInt}\">{$tint} {$cu}</td>\n\t</tr><tr>\n\t\n\t<td class='pl'>MinMax</td><td class='minimax' colspan='2' title=\"{$dateMinMax}\">\n\t        {$tmin}{$cu}&nbsp;<span style='color:#bb0000;'>{$tmax}{$cu}</span></td>\n\t<td class='e'></td>\n\t<td class='cl'>CO2</td>\n\t<td class='c' title=\"{$dateInt}\">{$co2} </td><td class='cunit'>ppm</td>\n\t</tr><tr>\n\n\t<td class='hl'>{$thum}</td>\n\t<td class='h' title=\"{$dateExt}\">{$humExt} </td><td class='hunit'>%</td>\n\t<td class='e'></td>\t\n\t<td class='hl'>{$thum}</td>\n\t<td class='h' title=\"{$dateInt}\">{$humInt} </td><td class='hunit'> %</td>\n\t</tr><tr>\n\t\n\t<td class='pl'>{$tpression}</td>\n\t<td class='p' title=\"{$dateInt}\">{$pres} </td><td class='punit'>mb</td>\n\t<td class='e'></td>\n\t<td class='nl'>{$tson}</td>\n\t<td class='n' title=\"{$dateInt}\">{$db}</td><td class='nunit'> db</td>\n\t</tr>\n\t";
    // WiFi
    $wifi = $devices["wifi_status"];
    $wifiTime = $devices["last_status_store"];
    $wifiT = $wifi . '  ' . date("d/m/y H:i", $devices["last_status_store"]);
    if ($wifiTime < time() - 60 * 60) {
        $wifi = 100;
    }
    $wifiImage = getWiFiImage($wifi);
    $firmware = $devices["firmware"];
    if (isset($devices['last_upgrade'])) {
        $firmwareDate = date("d/m/Y", $devices['last_upgrade']);
    } else {
        $firmwareDate = 'unknown';
    }
    // RADIO
    $numStations = count($dashboard) - 1;
    for ($j = 0; $j < $numStations; $j++) {
        $nameStations[$j] = $mydevices["modules"][$j]["module_name"];
    }
    $nameInt = $mydevices["module_name"];
    $tinfo = tr("Autres informations");
    $train = tr("Pluie");
    if ($pluvio == -2) {
        echo "\n        <tr><td class='rl'></td><td class='r'></td><td class='cunit'></td><td class='e'></td>\n        ";
    } else {
        echo "\n        <tr><td class='rl'>{$train}</td><td class='r' title=\"{$rainTitle}\"> {$rain24}</td><td class='cunit'>mm</td><td class='e'></td>   \n        ";
    }
    echo "  <td class='tooltip' colspan='3'>\n\t\t<a href='#' class='tooltip'>\n  \t\t{$tinfo}:\t\t\n        <div >\n        <table class='info'>\n        <tr><td style='width:90px;'>{$nameInt}</td>\n        <td colspan='2' style='text-align:center;'><img title='{$wifiT}' src={$wifiImage} ALT='wifi' height='13' /></td>\n        <td title=\"{$firmwareDate}\">{$firmware}</td>\n        </tr>\n";
    for ($i = 0; $i < $numStations; $i++) {
        $name = $nameStations[$i];
        $last_message = date("d/m/y H:i", $devices['modules'][$i]['last_message']);
        $radio = $devices['modules'][$i]['rf_status'];
        $radioImage = getRadioImage($radio);
        $battery = $devices['modules'][$i]['battery_vp'];
        $batteryType = $devices['modules'][$i]['type'];
        $batteryImage = getBatteryImage($battery, $batteryType);
        $firmware = $devices['modules'][$i]['firmware'];
        $radioT = $radio . ' ' . $last_message;
        $batteryT = $battery . ' ' . $last_message;
        echo "<tr>\n        <td>{$name}</td>\n        <td style='text-align:center;'><img title='{$radioT}' src={$radioImage} ALT='signal' height='13' /></td>\n        <td style='text-align:center;'><img title='{$batteryT}' src={$batteryImage} ALT='battery' height='13' /></td>\n        <td>{$firmware}</td>\n        </tr>";
    }
    echo "\n        </table>\n        </div>\n\t</a> </td>  \t\n\t</tr></table>\n";
}
Пример #4
0
            $temp = $hum = $co2 = ' ';
            //$rain = $dashboard[$i][$j]["Rain"];
            $rain1 = $dashboard[$i][$j]["sum_rain_1"];
            $rain1 = intval($rain1 * 10 + 0.5) / 10;
            $rain24 = $dashboard[$i][$j]["sum_rain_24"];
            $rain24 = intval($rain24 * 10 + 0.5) / 10;
        } else {
            $temp = degree2($dashboard[$i][$j]["Temperature"]);
            $hum = $dashboard[$i][$j]["Humidity"];
            $co2 = $dashboard[$i][$j]["CO2"];
            $rain1 = $rain24 = ' ';
        }
        $label[$i] .= "<tr><td class='name'>{$name}</td><td>&nbsp;</td> <td {$red}>{$temp}</td> <td {$green}>{$hum}</td> <td {$orange}>{$co2}</td> <td></td> <td></td><td {$green}>{$rain1}</td><td {$green}>{$rain24}</td></tr>";
    }
    $label[$i] .= '</table>';
    $temp = degree2($dashboard[$i][0]["Temperature"]);
    if ($Temperature_unit) {
        $slabel[$i] = $temp . '°';
    } else {
        $slabel[$i] = $temp . ' F';
    }
    // usilise pour les marker
}
?>
<script
<?php 
if ($use_google_key == 1) {
    //		echo("src='https://maps.googleapis.com/maps/api/js?libraries=weather,places?key=$google_key'>");
    echo "src='https://maps.googleapis.com/maps/api/js?libraries=weather,places?key={$google_key}&sensor=false'>";
} else {
    echo "src='https://maps.googleapis.com/maps/api/js?libraries=weather,places'>";
Пример #5
0
 $ii[1] = $i1 = $iii;
 $tmax0 = $tmax1 = -10000;
 do {
     $idate = date("d/m/y", $itime);
     $t0 = $t1 = $tip = $date0 = $date1 = '';
     for ($j = 0; $j < 2; $j++) {
         $key1 = $key = $keys[$j][$ii[$j]];
         if ($j == 1) {
             $key1 += $delta;
         }
         if (abs($key1 - $itime) < $inter) {
             if ($ii[$j] < $nmesures[$j] - 1) {
                 ++$ii[$j];
             }
             if ($selectMesure == 'T') {
                 $tt = degree2($mesure[$j][$key][1]);
             } else {
                 $tt = $mesure[$j][$key][1];
             }
             if ($j == 0 && $i0 < $nmesures[0]) {
                 $t0 = $tt;
                 ++$i0;
                 if ($t0 > $tmax0) {
                     $tmax0 = $t0;
                     $imax0 = $i;
                 }
                 $date0 = tr($jour[idate('w', $key)]) . date(' d/m/y', $key);
             } else {
                 if ($j == 1 && $i1 < $nmesures[1]) {
                     $t1 = $tt;
                     ++$i1;