Aufzeichnung der Temperaturwerte und Graphische Darstellung von DS18x20 Sensoren

    Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

    • @premo

      das ist falsch:

      DocumentRoot /var/www/volkszaehler.org/htdocs/

      nur

      DocumentRoot /var/www/

      dann klappt auch wieder mit dem shc

      Nachtrag:

      im php script muss dann stehen:

      $middleware = 'http://192.168.200.170/volkszaehler.org/htdocs/middleware.php';
      SHC Master B2+ WLAN sowie 1 Slave B2+, 2 Slave B+ und 2 Slave Raspi B. 5x Pi Cam; Imac mit OSX El Capitan; Iphone 6 plus; Ipad mini; Lenovo Android Tablet.
    • Moin

      Leider funktioniert es auch mit
      "DocumentRoot /var/www/"
      "$middleware = 'http://192.168.200.170/volkszaehler.org/htdocs/middleware.php';
      nicht. Mit theow1POOL.php & starten werden die Werte in Putty angezeigt.

      PHP-Quellcode

      1. #!/usr/bin/php
      2. <?php
      3. if (! function_exists('pcntl_fork')) die('PCNTL functions not available on this PHP installation');
      4. $mapping = array(
      5. '000005cc9836' => '500ceb00-39e9-11e6-b0bb-8fa5b05fc1a2', // Wintergarten
      6. );
      7. $middleware = 'http://192.168.178.31/volkszaehler.org/htdocs/middleware.php';
      8. $maxforks = 10;
      9. $forks = 0;
      10. while(true) {
      11. foreach($mapping as $s_1w => $s_uuid) {
      12. if($forks >= $maxforks) {
      13. pcntl_wait($status);
      14. $forks--;
      15. }
      16. $pid[$s_1w] = pcntl_fork();
      17. if($pid[$s_1w] == -1) trigger_error('Could not fork', E_USER_WARNING);
      18. if($pid[$s_1w] == 0) {
      19. readSensor($s_1w, $s_uuid);
      20. exit(0);
      21. }
      22. if($pid[$s_1w] > 0) {
      23. $forks++;
      24. }
      25. }
      26. foreach($mapping as $s_1w => $s_uuid) {
      27. pcntl_waitpid($pid[$s_1w], $status);
      28. }
      29. $forks = 0;
      30. sleep(10);
      31. }
      32. function readSensor($s_1w, $s_uuid) {
      33. global $middleware;
      34. if(!file_exists('/sys/bus/w1/devices/28-'.$s_1w.'/w1_slave')) {
      35. echo 'Sensor 28-'.$s_1w.' not found'."\n";
      36. return -2;
      37. }
      38. $s_wert = file_get_contents('/sys/bus/w1/devices/28-'.$s_1w.'/w1_slave');
      39. if(strpos($s_wert, ' YES') === false) {
      40. echo 'Sensor 28-'.$s_1w.' - checksum incorrect'."\n";
      41. return -1;
      42. }
      43. if(preg_match('/t=(\-?\d+)$/', $s_wert, $match)) {
      44. $temp = $match[1]/1000;
      45. echo 'Sensor 28-'.$s_1w.' @ '.$temp.'°C'."\n";
      46. if($temp == 85) {
      47. echo 'Oops… Looks like a read error - ignoring value…'."\n";
      48. }else{
      49. file_get_contents($middleware.'/data/'.$s_uuid.'.json?operation=add&value='.$temp);
      50. }
      51. unset($temp);
      52. }else{
      53. echo 'Sensor 28-'.$s_1w.' - can not interpret data'."\n";
      54. return -3;
      55. }
      56. }
      57. ?>
      Alles anzeigen


      Quellcode

      1. <VirtualHost *:80>
      2. # The ServerName directive sets the request scheme, hostname and port that
      3. # the server uses to identify itself. This is used when creating
      4. # redirection URLs. In the context of virtual hosts, the ServerName
      5. # specifies what hostname must appear in the request's Host: header to
      6. # match this virtual host. For the default virtual host (this file) this
      7. # value is not decisive as it is used as a last resort host regardless.
      8. # However, you must set it for any further virtual host explicitly.
      9. #ServerName www.example.com
      10. ServerAdmin webmaster@localhost
      11. DocumentRoot /var/www/
      12. # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
      13. # error, crit, alert, emerg.
      14. # It is also possible to configure the loglevel for particular
      15. # modules, e.g.
      16. #LogLevel info ssl:warn
      17. ErrorLog ${APACHE_LOG_DIR}/error.log
      18. CustomLog ${APACHE_LOG_DIR}/access.log combined
      19. # For most configuration files from conf-available/, which are
      20. # enabled or disabled at a global level, it is possible to
      21. # include a line for only one particular virtual host. For example the
      22. # following line enables the CGI configuration for this host only
      23. # after it has been globally disabled with "a2disconf".
      24. #Include conf-available/serve-cgi-bin.conf
      25. </VirtualHost>
      26. # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
      Alles anzeigen
    • Wenn mit puty Werte angezeigt werden, stimmt schon mal die Sensor ID.

      Jetzt könnte ein Fehler mit der UUID vorliegen. Die bekommst Du vom Volkszähler und trägst sie in die PHP ein.

      Wenn die auch stimmt, kann nur noch was nicht am Pfad zur middleware stimmen.

      Vergleiche doch mal Deinen Inhalt von Volkszahler.org mit meinem.

      Wenn gleich, dann stimmt auch das
      $middleware = 'http://192.168.178.31/volkszaehler.org/htdocs/middleware.php';

      Nachtrag: Schau dich hier auch mal um:

      bitbastelei Archive - Adlerweb

      speziell Beitrag 44 und 99
      SHC Master B2+ WLAN sowie 1 Slave B2+, 2 Slave B+ und 2 Slave Raspi B. 5x Pi Cam; Imac mit OSX El Capitan; Iphone 6 plus; Ipad mini; Lenovo Android Tablet.

      Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von rmjspa ()

    • Nein, Du musst nur im PHP Script den richtigen Pfad angeben. Bei mir liegt er im /var/www/volkszaehler.org/

      Wie in meinem Post oben zu sehen.

      Im Prinzip ist das ganz einfach. Das Rootverzeichnis mit den WebSeiten vom Apache2 ist /var/www

      In dem Verzeichnis www geht es dann weiter zu den einzelnen Programmen / Seiten.

      Um dann auf die einzelnen Seiten zu kommen

      192.168.xxx.xxx/shc......
      192.168.xxx.xxx/volkszaehler.org/....
      usw.
      Das darf sich nicht beeinflussen.
      SHC Master B2+ WLAN sowie 1 Slave B2+, 2 Slave B+ und 2 Slave Raspi B. 5x Pi Cam; Imac mit OSX El Capitan; Iphone 6 plus; Ipad mini; Lenovo Android Tablet.
    • Verstehe ich Dich richtig, die Temperaturaufzeichnung im Volkszähler funktioniert, und Du kommst auch auf die Volkszähler Seite.

      Aber nicht mehr auf die Weboberfläche des SHC?

      Oder eben auf die Weboberfläche des SHC aber nicht mehr auf die des Volkszählers?

      Das kann ich nicht verstehen.

      Der Ordner /var/www mit Unterverzeichnisse sieht gut aus.
      SHC Master B2+ WLAN sowie 1 Slave B2+, 2 Slave B+ und 2 Slave Raspi B. 5x Pi Cam; Imac mit OSX El Capitan; Iphone 6 plus; Ipad mini; Lenovo Android Tablet.
    • @premo

      gug mal hier rein:

      Auszug aus Install Anleitung vom SHC.

      ... die Datei öffnen und in Zeile 12 das html nach /var/www/ löschen.

      sudo nano /etc/apache2/sites-enabled/000-default.conf

      Neustart ...


      ---

      <VirtualHost *:80>
      # The ServerName directive sets the request scheme, hostname and port that
      # the server uses to identify itself. This is used when creating
      # redirection URLs. In the context of virtual hosts, the ServerName
      # specifies what hostname must appear in the request's Host: header to
      # match this virtual host. For the default virtual host (this file) this
      # value is not decisive as it is used as a last resort host regardless.
      # However, you must set it for any further virtual host explicitly.
      #ServerName example.com


      ServerAdmin webmaster@localhost
      DocumentRoot /var/www


      # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
      # error, crit, alert, emerg.
      # It is also possible to configure the loglevel for particular
      # modules, e.g.
      #LogLevel info ssl:warn


      ErrorLog ${APACHE_LOG_DIR}/error.log
      CustomLog ${APACHE_LOG_DIR}/access.log combined


      # For most configuration files from conf-available/, which are
      # enabled or disabled at a global level, it is possible to
      # include a line for only one particular virtual host. For example the
      # following line enables the CGI configuration for this host only
      # after it has been globally disabled with "a2disconf".
      #Include conf-available/serve-cgi-bin.conf
      </VirtualHost>


      # vim: syntax=apache ts=4 sw=4 sts=4 sr noet

      ---

      nicht das Du dir diese Datei versaut hast.

      Ups: wurde ja schon mehrfach gesagt.
      habe SHC aufgegeben.

      Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von bin dann weg ()

    • C-3po schrieb:

      Apache unter Jessie konfigurieren
      • mod_rewrite aktivieren:
      sudo a2enmod rewrite
      • Default VirtualHost bearbeiten ( die Datei:“ 000-default.conf ” bearbeiten):
      sudo nano /etc/apache2/sites-enabled/000-default.conf
      • In der Datei, neben: < DocumentRoot > :
      /var/www/volkszaehler.org/htdocs/eintragen.

      Damit zerhaust Du dir den SHC Aufruf
      Moin C-3po
      , bei /var/www/ geht nur SHC, bei /var/www/volkszaehler.org/htdocs/ nur VZ.
    • Logo.

      Da muss n zuwätzlicher VHost angelegt werden. Wenn Du den so starten willst.

      mit diesen daten müsste es gehen.

      ServerAdmin webmaster@localhost
      DocumentRoot /var/www

      SHC geht

      willst du dann den volksz. aufrufen musst du 192..../volkszaehler.org/htdocs/index.php eintippen
      habe SHC aufgegeben.

      Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von bin dann weg ()

    • @rmjspa

      jetzt hänge ich grad fest:

      Installiert auf einem EisFair Server.

      nach /var/www/htdocs/volkszaehler

      Aufruf siehe Bild -> ok

      aber was muss ich jetzt da machen. (ok DS18x kommen an)

      Wie bekomme ich da DHT Werte rein ?

      und wo muss jetzt das Script hin um Daten aus dem SHC hier rein zu bekommen. (erledigt)

      Daten aus dem SHC (im SHC auflaufene Sensoren) lassen sich damit nicht übertragen ?
      Sehe ich das richtig ?
      Dateien
      • vz-1.jpg

        (152,11 kB, 8 mal heruntergeladen, zuletzt: )
      • vz-2.jpg

        (14,3 kB, 7 mal heruntergeladen, zuletzt: )
      habe SHC aufgegeben.

      Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von bin dann weg ()