www/getfermentlog.php

Thu, 12 Oct 2023 14:19:46 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 12 Oct 2023 14:19:46 +0200
changeset 849
16079aef4c4c
parent 836
409f8c497429
permissions
-rw-r--r--

Version 0.3.44. Moved iSpindel Plato calculation from the php script to bmsd. This uses calibration data in the mon_ispindels table. Setup of this data will be done by the bmsapp applications. Default settings are stored in MySQL. From now on you don't need to store calibration data in the iSpindel.

<?php

require_once('config.php');

if (isset($_GET["code"]))
	$code = $_GET["code"];
else
	$code = "TB0015";

$connect = mysqli_connect(DBASE_HOST, DBASE_USER, DBASE_PASS, DBASE_NAME);
if (! $connect) {
        die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
}
mysqli_set_charset($connect, "utf8" );

$query = "SELECT * FROM log_fermenter WHERE code='".$code."' ORDER BY datetime;";
$result = mysqli_query($connect, $query) or die("SQL Error 1: " . mysqli_error($connect));
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {

    $logs[] = array(
        'date' => substr($row['datetime'],0,16),
        'air' => $row['temp_air'],
        'beer' => $row['temp_beer'],
        'chiller' => $row['temp_chiller'],
        'room' => $row['temp_room'],
        'tlo' => $row['sp_low'],
        'thi' => $row['sp_high'],
        'heater' => $row['heater_power'],
        'cooler' => $row['cooler_power'],
        'event' => $row['event']
    );
}

header("Content-type: application/json");
echo json_encode($logs);

mercurial