Aufzeichnung der Temperaturwerte und Graphische Darstellung von DS18x20 Sensoren
This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.
Your browser (%browser%) is out of date. It has known security flaws and may not display all features of this and other websites. \
Learn how to update your browser'.
-
-
-
-
-
Da wird ja schon was umgeleitet. Denke schon das es hinhaut. Das sieht eher so aus als stimmt da ein Pfad in der volkzähler Soft nicht.
Die kenne ich aber nicht, was man beim einrichten alles machen muss @rmjspa . Sieht so aus
composer es setztProduktiv: RPi 2 B SHC 2.2.8 -- Netzwerk BananaPi R1 ipFire -
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 Source Code
- #!/usr/bin/php
- <?php
- if (! function_exists('pcntl_fork')) die('PCNTL functions not available on this PHP installation');
- $mapping = array(
- '000005cc9836' => '500ceb00-39e9-11e6-b0bb-8fa5b05fc1a2', // Wintergarten
- );
- $middleware = 'http://192.168.178.31/volkszaehler.org/htdocs/middleware.php';
- $maxforks = 10;
- $forks = 0;
- while(true) {
- foreach($mapping as $s_1w => $s_uuid) {
- if($forks >= $maxforks) {
- pcntl_wait($status);
- $forks--;
- }
- $pid[$s_1w] = pcntl_fork();
- if($pid[$s_1w] == -1) trigger_error('Could not fork', E_USER_WARNING);
- if($pid[$s_1w] == 0) {
- readSensor($s_1w, $s_uuid);
- exit(0);
- }
- if($pid[$s_1w] > 0) {
- $forks++;
- }
- }
- foreach($mapping as $s_1w => $s_uuid) {
- pcntl_waitpid($pid[$s_1w], $status);
- }
- $forks = 0;
- sleep(10);
- }
- function readSensor($s_1w, $s_uuid) {
- global $middleware;
- if(!file_exists('/sys/bus/w1/devices/28-'.$s_1w.'/w1_slave')) {
- echo 'Sensor 28-'.$s_1w.' not found'."\n";
- return -2;
- }
- $s_wert = file_get_contents('/sys/bus/w1/devices/28-'.$s_1w.'/w1_slave');
- if(strpos($s_wert, ' YES') === false) {
- echo 'Sensor 28-'.$s_1w.' - checksum incorrect'."\n";
- return -1;
- }
- if(preg_match('/t=(\-?\d+)$/', $s_wert, $match)) {
- $temp = $match[1]/1000;
- echo 'Sensor 28-'.$s_1w.' @ '.$temp.'°C'."\n";
- if($temp == 85) {
- echo 'Oops… Looks like a read error - ignoring value…'."\n";
- }else{
- file_get_contents($middleware.'/data/'.$s_uuid.'.json?operation=add&value='.$temp);
- }
- unset($temp);
- }else{
- echo 'Sensor 28-'.$s_1w.' - can not interpret data'."\n";
- return -3;
- }
- }
- ?>
Source Code
- <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 www.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
-
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 99SHC 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.The post was edited 1 time, last by rmjspa ().
-
-
rmjspa wrote:
Nachtrag: Nachdem ich umgezogen bin auf dem Slave, habe ich für den Volkszähler einen Ordner im www Verzeichnis angelegt.
Diesen müsste ich dann anlegen und Volkszaehler.org dorthin verschieben. -
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.The post was edited 1 time, last by bin dann weg ().
-
Apache unter Jessie konfigurieren
- mod_rewrite aktivieren:
- Default VirtualHost bearbeiten ( die Datei:“ 000-default.conf ” bearbeiten):
- In der Datei, neben: < DocumentRoot > :
Damit zerhaust Du dir den SHC Aufrufhabe SHC aufgegeben. - mod_rewrite aktivieren:
-
C-3po wrote:
Apache unter Jessie konfigurieren
- mod_rewrite aktivieren:
- Default VirtualHost bearbeiten ( die Datei:“ 000-default.conf ” bearbeiten):
- In der Datei, neben: < DocumentRoot > :
Damit zerhaust Du dir den SHC Aufruf
, bei /var/www/ geht nur SHC, bei /var/www/volkszaehler.org/htdocs/ nur VZ. - mod_rewrite aktivieren:
-
-
@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 ?habe SHC aufgegeben.The post was edited 2 times, last by bin dann weg ().
-
C-3po wrote:
Für DHT22 habe ich nur den ESP Sketch.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.
-
Share
- Facebook 0
- Twitter 0
- Google Plus 0
- Reddit 0
-
Users Online 1
1 Guest