Dr. Arne Jachens

Set up the Raspberry Pi

no warranty for any of the provided information

Since there are many service tasks to be performed on a regular basis, this overview shows when each task had been performed the last time. And the button behind each row resets the service date to today.

<?php
/* published under GPL www.gnu.org/licenses/gpl.html */
function HV_serviceShowLog($fname){
  /* read log file */
  $service=HV_serviceReadLog($fname);
  /* show dates in a form */
  $today=date('Y-m-d');
  $content ="<table>\n";
  for($n=0;$n<count($service);$n++){
    $content.="<tr><td>".$service[$n]['name']."</td>";
    $content.="<td>".$service[$n]['date']."</td>\n";
    $content.="<td><form action='?what2do=updateService' method='POST'>\n";
    $content.="<input type='hidden' name='serviceDate".$n."' value='".$today."'>\n";
    $content.="<input type='submit' name='service".$n."' value='heute'></form></td>\n";
  } #n
  $content.="</table>\n";
  return $content;
}

function HV_serviceUpdateLog($fname){
  /* read log file */
  $service=HV_serviceReadLog($fname);
  /* get data from form */
  for($n=0;$n<count($service);$n++){
    if(isset($_POST['service'.$n])){
      $service[$n]['date']=$_POST['serviceDate'.$n];
    }
  } #n
  /* write log file */
  $fid = fopen($fname, "w");
  for($n=0;$n<count($service);$n++){
    $string=$service[$n]['name']."=".trim($service[$n]['date'])."\n";
    fputs($fid,$string);
  } #n
  fclose($fid);
}

function HV_serviceReadLog($fname){
  if (file_exists($fname)) {
    $fid = fopen($fname, "r");
    $line = trim(fgets( $fid, 512 ));
    $n=-1;
    while(!feof($fid)){
      $n++;
      $values=explode("=",$line);
      $service[$n]['name']=$values[0];
      $service[$n]['date']=trim($values[1]);
      $line = fgets($fid, 512);
    } #n
    fclose($fid);
    return $service;
  }else{
    return FALSE;
  }
}
  ?>

python

1HvcControl.py
2HvcHCSR04ultrasonic.py
3HvcMain.py
4HvcMotorDriver.py
5HvcOneWire.py
6HvcOperationMode.py
7HvcRaw2phys.py
8HvcReadSPI.py
9HvcSendI2C.py
10HvcSetGPIO.py
11HvcTables.py
12HvcWeather.py
13makeDoc.py

php

1HV_Admin_Login.php
2HV_colorMap.php
3HV_composeH2Oplot.php
4HV_config.php
5HV_H2Olevel.php
6HV_readOperationState.php
7HV_restart.php
8HV_serviceLog.php
9HV_setParameters.php
10HV_showHouse.php
11HV_showLog.php
12HV_showWeatherForecast.php
13HV_TempCal.php
14index.php
15readFilenames.php
16readNamedData.php

Der gesamte Sourcecode darf gemäß GNU General Public License weiterverbreitet werden.