Sensori BMP085 , DHT22 con systemd (Raspbian Jessie)

Discussioni relative all'uso di sensori vari (temperatura, umidità, ....)
Avatar utente
Flane
Messaggi: 2460
Iscritto il: 16/01/2016, 15:02

Re: Sensori BMP085 , DHT22 con systemd (Raspbian Jessie)

Messaggioda Flane » 29/05/2016, 18:07

Verifica se metern è attivo con il seguente comando da putty:

Codice: Seleziona tutto

ps aux | grep metern.php

Se attivo ti risponde con due righe, se non attivo solo con una (il comando grep che stai eseguendo)


alexf
Messaggi: 35
Iscritto il: 19/05/2016, 12:57

Re: Sensori BMP085 , DHT22 con systemd (Raspbian Jessie)

Messaggioda alexf » 29/05/2016, 18:31

per quanto riguarda Metern

Codice: Seleziona tutto

pi@raspberrypi:~ $ ps aux | grep metern.php
pi        3899  0.0  0.4   4528  2008 pts/1    S+   18:27   0:00 grep --color=auto metern.php


mentre per quanto riguarda la stringa ho aggiornato ma nulla da fare

Codice: Seleziona tutto

[Unit]
Description=bmp085

[Service]
Type=oneshot
ExecStart=/var/www/MyScripts/pa.py > /run/shm/metern7.txt

[Install]
WantedBy=multi-user.targe


Codice: Seleziona tutto

root@raspberrypi:/home/pi# insserv
le bmp085.serviceroot@raspberrypi:/home/pi# systemctl enable bmp085.service
Failed to execute operation: Invalid argument

Avatar utente
Flane
Messaggi: 2460
Iscritto il: 16/01/2016, 15:02

Re: Sensori BMP085 , DHT22 con systemd (Raspbian Jessie)

Messaggioda Flane » 29/05/2016, 18:58

Come vedi Metern non parte, pertanto devi aver combinato qualche problema.
Prova ad abilitare il debug dall'interfaccia di amministrazione e vedi che errori ti dà.
Dovresti trovare un file del debug nella cartella metern/data

Per il file bmp085.service è necessario approfondire che tipo di comandi accetta in ExecStart ....

alexf
Messaggi: 35
Iscritto il: 19/05/2016, 12:57

Re: Sensori BMP085 , DHT22 con systemd (Raspbian Jessie)

Messaggioda alexf » 29/05/2016, 19:06

sto provando gli aggiornamenti di metern..

pi@raspberrypi:~ $ sudo mkdir -m 777 /var/www/_NEW/

sudo chown -R www-data:www-data /var/www/_NEW/

# sudo mv /var/www/_NEW/metern/ /var/www/metern/

sudo mv /var/www/_NEW/metern/ /var/www/metern/
mv: impossibile spostare "/var/www/_NEW/metern/" in "/var/www/metern/metern": Directory non vuota

ma c'è qualche problema ...ora riprovo....

Avatar utente
Flane
Messaggi: 2460
Iscritto il: 16/01/2016, 15:02

Re: Sensori BMP085 , DHT22 con systemd (Raspbian Jessie)

Messaggioda Flane » 29/05/2016, 19:09

Per il file bmp085.service prova con:

Codice: Seleziona tutto

ExecStart=/usr/bin/python /var/www/MyScripts/pa.py > /run/shm/metern7.txt


QUI trovi una bella ed utile guida su systemd in italiano :D

alexf
Messaggi: 35
Iscritto il: 19/05/2016, 12:57

Re: Sensori BMP085 , DHT22 con systemd (Raspbian Jessie)

Messaggioda alexf » 29/05/2016, 21:38

ti riporto le info ma per togliere ogni dubbio
in serata se riesco riscrivo l'immagine sd...

...ho aggiornato meterN 0.8.2.7.1
ma rimane il problema ho attivato il debug
questo è l'errore

Codice: Seleziona tutto

29/05/2016 20:45:21   Starting meterN (8671)

Abording. Can't open config_met3.php.
29/05/2016 21:39:49   Starting meterN (23642)

Abording. Can't open config_met3.php.


Codice: Seleziona tutto

pi@raspberrypi:~ $ ls -l /var/www/
totale 28
drwxr-xr-x 11 www-data www-data 4096 apr 25 21:06 123solar
drwxr-xr-x  2 pi       pi       4096 apr 13 21:45 comapps
drwxr-xr-x  2 root     root     4096 gen 31 21:36 html
drwxr-xr-x 11 www-data www-data 4096 mag 29 19:58 metern
drwxrwxrwx  2 pi       pi       4096 mag 26 00:06 MyScripts
drwxrwxrwx  3 www-data www-data 4096 mag 29 19:01 _NEW
-rw-r--r--  1 root     root       19 gen 28 21:19 test.php


poi ho aggiornato il file pa.py
questo è lo stato attuale

Codice: Seleziona tutto

~ $ ls -l /var/www/MyScripts/pa.py
-rwxr-xr-x 1 pi pi 643 mag 26 00:20 /var/www/MyScripts/pa.py


ho aggiornato il file

Codice: Seleziona tutto

sudo nano /etc/systemd/system/bmp085.service
[Unit]
Description=bmp085

[Service]
Type=oneshot
ExecStart=/usr/bin/python /var/www/MyScripts/pa.py > /run/shm/metern7.txt

[Install]
WantedBy=multi-user.targe


root@raspberrypi:/home/pi# ls -l /etc/systemd/system/bmp085.service
-rw-r--r-- 1 root root 161 mag 29 20:04 /etc/systemd/system/bmp085.service


con al nuova sintassi le cose sono cambiate.....
restituisce un errore....

Codice: Seleziona tutto

ceroot@raspberrypi:/home/pi# insserv
root@raspberrypi:/home/pi# systemctl enable bmp085.service
Failed to execute operation: Invalid argument

ma verificando lo status sembra restituire un risultato
!!!!

Codice: Seleziona tutto

root@raspberrypi:/home/pi# systemctl status bmp085.service
● bmp085.service - bmp085
   Loaded: loaded (/etc/systemd/system/bmp085.service; enabled)
   Active: inactive (dead) since dom 2016-05-29 20:06:02 CEST; 1h 23min ago
  Process: 296 ExecStart=/usr/bin/python /var/www/MyScripts/pa.py > /run/shm/metern7.txt (code=exited, status=0/SUCCESS)
 Main PID: 296 (code=exited, status=0/SUCCESS)

mag 29 20:05:57 raspberrypi systemd[1]: Starting bmp085...
mag 29 20:06:02 raspberrypi python[296]: 7_1(25.50*C)
mag 29 20:06:02 raspberrypi python[296]: 7_2(985.72*Pa)
mag 29 20:06:02 raspberrypi python[296]: 7_3(231.17*m)
mag 29 20:06:02 raspberrypi python[296]: 7_4(985.76*Pm)
mag 29 20:06:02 raspberrypi systemd[1]: Started bmp085.

sa utente pi

Codice: Seleziona tutto

pi@raspberrypi:~ $ systemctl status bmp085.service
● bmp085.service - bmp085
   Loaded: loaded (/etc/systemd/system/bmp085.service; enabled)
   Active: inactive (dead) since dom 2016-05-29 20:06:02 CEST; 1h 36min ago
  Process: 296 ExecStart=/usr/bin/python /var/www/MyScripts/pa.py > /run/shm/metern7.txt (code=exited, status=0/SUCCESS)
 Main PID: 296 (code=exited, status=0/SUCCESS)


rimane il problema del Metern come faccio ad azzerare i valori dei sensori..
come si ripristina il default...

alexf
Messaggi: 35
Iscritto il: 19/05/2016, 12:57

Re: Sensori BMP085 , DHT22 con systemd (Raspbian Jessie)

Messaggioda alexf » 29/05/2016, 22:20

ok ho ripristinato semplicemente , cancellando
config_met3.php

ora faccio qualche test , e poi riporto
i passaggi necessari attivare per systemd

alexf
Messaggi: 35
Iscritto il: 19/05/2016, 12:57

Re: Sensori BMP085 , DHT22 con systemd (Raspbian Jessie)

Messaggioda alexf » 23/06/2016, 21:16

.

dottorniù
Messaggi: 36
Iscritto il: 16/03/2016, 23:49

Re: Sensori BMP085 , DHT22 con systemd (Raspbian Jessie)

Messaggioda dottorniù » 16/11/2016, 9:08

Buongiorno, sto provando ad utilizzare systemd per la lettura del dht22 ma all'avvio del servizio mi viene restituito un'errore, di seguito incollo una schermata di patty dove si vede che il sensore eseguendo una lettura manuale funziona correttamente però all'avvio del servizio restituisce failed.

Codice: Seleziona tutto

root@raspberrypi:~# sudo ADHT_metern.py 22 4 6
6_1(19.1*C)
6_2(43.6*%)
root@raspberrypi:~# insserv
root@raspberrypi:~# systemctl enable dht22.service
root@raspberrypi:~# systemctl start dht22.service
Job for dht22.service failed. See 'systemctl status dht22.service' and 'journalctl -xn' for details.
root@raspberrypi:~# sudo systemctl status dht22.service
● dht22.service - dht22
   Loaded: loaded (/etc/systemd/system/dht22.service; enabled)
   Active: failed (Result: exit-code) since mer 2016-11-16 08:55:20 CET; 24s ago
  Process: 20706 ExecStart=/usr/local/bin/dht22.sh 22 4 6 (code=exited, status=1/FAILURE)
 Main PID: 20706 (code=exited, status=1/FAILURE)

nov 16 08:55:20 raspberrypi dht22.sh[20706]: [40B blob data]
nov 16 08:55:20 raspberrypi dht22.sh[20706]: [40B blob data]
nov 16 08:55:20 raspberrypi systemd[1]: dht22.service: main process exited, ...E
nov 16 08:55:20 raspberrypi systemd[1]: Failed to start dht22.
nov 16 08:55:20 raspberrypi systemd[1]: Unit dht22.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.
root@raspberrypi:~# sudo journalctl -xn
-- Logs begin at mer 2016-11-16 08:45:13 CET, end at mer 2016-11-16 08:56:14 CET
nov 16 08:55:20 raspberrypi dht22.sh[20706]: [40B blob data]
nov 16 08:55:20 raspberrypi systemd[1]: dht22.service: main process exited, code
nov 16 08:55:20 raspberrypi systemd[1]: Failed to start dht22.
-- Subject: L'unità dht22.service è fallita
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- L'unità dht22.service è fallita.
--
-- Il risultato è failed.
nov 16 08:55:20 raspberrypi systemd[1]: Unit dht22.service entered failed state.
nov 16 08:55:44 raspberrypi sudo[21811]: root : TTY=pts/0 ; PWD=/root ; USER=roo
nov 16 08:55:44 raspberrypi sudo[21811]: pam_unix(sudo:session): session opened
nov 16 08:55:44 raspberrypi sudo[21811]: pam_unix(sudo:session): session closed
nov 16 08:55:46 raspberrypi sshd[20773]: Did not receive identification string f
nov 16 08:56:14 raspberrypi sudo[22869]: root : TTY=pts/0 ; PWD=/root ; USER=roo
nov 16 08:56:14 raspberrypi sudo[22869]: pam_unix(sudo:session): session opened
root@raspberrypi:~#


dove sto sbagliando?



Torna a “Meters hardware”

Chi c’è in linea

Visitano il forum: Nessuno e 2 ospiti