示例#1
0
    $txtcolor = $bg3p;
    $fontsize = 9;
    $text = $tempTEMP . " °C";
    $tvalue = $tempTEMP;
    ImageTTFText($im, $fontsize, 0, 90 - $XcorrectMainTextHMS, 37, $txtcolor, $fontttfb, $text);
    $txtcolor = $bg3p;
    $fontsize = 7;
    $text = "min= {$mintemp} max= {$maxtemp}";
    ImageTTFText($im, $fontsize, 0, 67 - $XcorrectMainTextHMS, 49, $txtcolor, $fontttf, $text);
    $text = $resultreverse[0][0];
    ImageTTFText($im, $fontsize, 0, $imgmaxxhms - 127, 13, $txtcolor, $fontttf, $text);
}
#############################################################################
## dew point
if ($type == "HMS100TF" and $showdewpoint == 'yes') {
    $dp = sprintf("%3.1f", dewpoint($tvalue, $hvalue));
    $fontsize = 9;
    $text = $dp . " °C";
    ImageTTFText($im, $fontsize, 0, 350, 35, $bg1p, $fontttfb, $text);
    $txtcolor = $orange;
    $fontsize = 7;
    $text = "Dewpoint";
    ImageTTFText($im, $fontsize, 0, 350, 47, $bg1p, $fontttf, $text);
}
#############################################################################
## general
$txtcolor = $bg3p;
$fontsize = 9;
$text = $drawhms;
ImageTTFText($im, 8, 0, 90 - $XcorrectMainTextHMS, 22, $txtcolor, $fontttfb, $text);
$fontsize = 7;
示例#2
0
文件: fill.php 项目: qkdreyer/Netatmo
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";
}