11-11-2022, 18:16
Thank you for the quick feedback.
Have a nice day.
Rgs.
Werk_AG
Have a nice day.
Rgs.
Werk_AG
String SendHTML(float Temperature,float Humidity,float Pressure, float W_Speed, float W_Gust, char* W_Dir, float Rain_Today)
{
now = time(nullptr);
struct tm* timeInfo;
timeInfo = localtime(&now);
String ptr = "<!DOCTYPE html>";
ptr +="<html>";
ptr +="<head>";
ptr +="<title>Weather Cube - Mini Weather Station</title>";
ptr +="<meta charset='utf-8'>";
ptr +="<meta http-equiv='refresh' content='29'>";
ptr +="<meta name='viewport' content='width=device-width, initial-scale=1.0'>";
ptr +="<link href='https://fonts.googleapis.com/css?family=Open+Sans:300,400,600' rel='stylesheet'>";
ptr +="<style>";
ptr +="html { font-family: 'Open Sans', sans-serif; display: block; margin: 0px auto; text-align: center;color: #444444;}";
ptr +="body{margin: 0px;} ";
ptr +="h1 {margin: 25px auto 25px;} ";
ptr +=".side-by-side{display: table-cell;vertical-align: middle;position: relative;}";
ptr +=".text{font-weight: 600;font-size: 15px;width: 200px;}";
ptr +=".reading{font-weight: 600;font-size: 25px;padding-right: 25px;}";
ptr +=".temperature .reading{color: #F29C1F;}";
ptr +=".humidity .reading{color: #3B97D3;}";
ptr +=".pressure .reading{color: #26B99A;}";
ptr +=".wind .reading{color: #955BA5;}";
ptr +=".rain .reading{color: #3B97D3;}";
ptr +=".superscript{font-size: 12px;font-weight: 600;position: absolute;top: 4px;}";
ptr +=".data{padding: 10px;}";
ptr +=".container{display: table;margin: 0 auto;}";
ptr +="</style>";
ptr +="</head>";
ptr +="<body>";
ptr +="<h1>Weather Cube</h1>";
ptr +="<h3>";
sprintf(CHAR_buf, "%02d.%02d.%d", timeInfo->tm_mday, timeInfo->tm_mon+1, timeInfo->tm_year + 1900);
ptr +=CHAR_buf;
ptr +=" ";
sprintf(CHAR_buf, "%02d:%02d", timeInfo->tm_hour, timeInfo->tm_min);
ptr +=CHAR_buf;
ptr +="</h3>";
ptr +="<div class='container'>";
ptr +="<div class='data temperature'>";
ptr +="<div class='side-by-side text'>Teplota vzduchu</div>";
ptr +="<div class='side-by-side reading'>";
ptr +=String(Temperature,1);
if (Temp_Display_Unit == 0) ptr +="<span class='superscript'>°C</span></div>";
else ptr +="<span class='superscript'>°F</span></div>";
ptr +="</div>";
ptr +="<div class='data humidity'>";
ptr +="<div class='side-by-side text'>Vlhkost</div>";
ptr +="<div class='side-by-side reading'>";
ptr +=String(Humidity,1);
ptr +="<span class='superscript'>%</span></div>";
ptr +="</div>";
ptr +="<div class='data pressure'>";
ptr +="<div class='side-by-side text'>Tlak vzduchu</div>";
ptr +="<div class='side-by-side reading'>";
ptr +=String(Pressure, 1);
if (ATM_Display_Unit == 0) ptr +="<span class='superscript'>mBar</span></div>";
else ptr +="<span class='superscript'>inHg</span></div>";
ptr +="</div>";
ptr +="<div class='data wind'>";
ptr +="<div class='side-by-side text'>Rychlost větru</div>";
ptr +="<div class='side-by-side reading'>";
ptr +=String(W_Speed, 1);
if (Wind_Display_Unit == 0) ptr +="<span class='superscript'>Km/h</span></div>";
else if (Wind_Display_Unit == 1) ptr +="<span class='superscript'>mph</span></div>";
else if (Wind_Display_Unit == 2) ptr +="<span class='superscript'>m/s</span></div>";
else ptr +="<span class='superscript'>Kts</span></div>";
ptr +="</div>";
#if (GET_WEATHERDUINO_DATA == 1)
ptr +="<div class='data wind'>";
ptr +="<div class='side-by-side text'>Vítr v nárazech</div>";
ptr +="<div class='side-by-side reading'>";
ptr +=String(W_Gust, 1);
if (Wind_Display_Unit == 0) ptr +="<span class='superscript'>Km/h</span></div>";
else if (Wind_Display_Unit == 1) ptr +="<span class='superscript'>mph</span></div>";
else if (Wind_Display_Unit == 2) ptr +="<span class='superscript'>m/s</span></div>";
else ptr +="<span class='superscript'>Kts</span></div>";
ptr +="</div>";
ptr +="<div class='data wind'>";
ptr +="<div class='side-by-side text'>Směr větru</div>";
ptr +="<div class='side-by-side reading'>";
ptr +=W_Dir;
ptr +="</div>";
ptr +="<div class='data rain'>";
ptr +="<div class='side-by-side text'>Dnešní srážky</div>";
ptr +="<div class='side-by-side reading'>";
ptr +=String(Rain_Today, 1);
if (Rain_Display_Unit == 0) ptr +="<span class='superscript'>mm</span></div>";
else ptr +="<span class='superscript'>in</span></div>";
ptr +="</div>";
#endif
ptr +="<h5>by WeatherDuino</h5>";
ptr +="<img src='http://www.weatherduino.com/WD_services/images/WeatherDuino_50.png' alt='WeatherDuino'>";
ptr +="</div>";
ptr +="</div>";
ptr +="</body>";
ptr +="</html>";
return ptr;
}