<?php
//ESP Temperature, humitidy and pressure logger based on BME280 sensor and ESP32. Pushes the data to a web database for display. 
//See full project at http://projects.xief.net
//
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files.
//
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//
//This file provides basic configuration for the webpage part of the system. 


//database connection
define('DB_HOST', "localhost");
define('DB_USERNAME', "XXXXXXXX"); //change accordingly 
define('DB_PASSWORD', "XXXXXXXX"); //change accordingly 
define('DB_NAME', "XXXXXXXXXXXXX"); //change accordingly 

// Keep this API Key value to be compatible with the ESP32 code provided in the project page. 
// If you change this value, the ESP32 sketch needs to match
// used in logger_post_esp_data
$api_key_value = "XXXXXXXXXXXX";


//parameters for logger_esp_data.php:
$outsideSensor = "outside1";
//$maxDelayTime = 10*60; //time in s, before greying out sensor data  if compiles remove
$delayColor = "#cccccc";
$highlightDewPoint = "#ff0000"; //high risk as dew point outside higher than temp inside
$noWindowOpen = "#fc8803"; //if dew point outside higher than inside no need to open window
$greyOldData = "#e3e3e3"; //color definition for gray values
$timeNotShow = 60*60*24; //seconds to not show (1 day)
$timeGreyOldData = 60*15; //start greying out as older datapoint (15 min)
$timezone = 'Europe/Vienna';


//dew point calculation according to: https://www.omnicalculator.com/physics/dew-point
function dewPoint($temp, $hum) {
	
	$a = 17.62;
	$b = 243.12;
    $alpha = log($hum/100) + $a*$temp/($b+$temp);
	$dew = ($b * $alpha) / ($a - $alpha);
	return $dew;
	
}


?> 