RigacciOrg / AirPi

A monitoring station for air quality based on Raspberry Pi
GNU General Public License v3.0
23 stars 15 forks source link

Web interface - Dispaly isn't shown #2

Open SRadiant opened 5 years ago

SRadiant commented 5 years ago

Hi, RigacciOrg. I installed the AirPi following Software setup step in website. It can read the data from BME280 (I don't get PMS5003 yet). But when I open the web interface, the "Display" site isn't shown any data, totally blank. And open the .csv form "Data Download" show "ERROR: airpi-data-export: Error reading the database: no such table: data". However the "Graphs" site work well. How can I fix it? Help me, please. Thank you.

RigacciOrg commented 5 years ago

The "Display" web page and the CSV export function get data from the SQLite database /var/lib/airpi/airpi-data.db. Everything is driven by the cronjob /etc/cron.d/airpi which runs every 5 minutes and launches the script /usr/local/lib/airpi/airpi-data-store. That script will, finally, execute the script /usr/local/lib/airpi/airpi-sql-insert which creates (or updateds, if it already exists) the SQLite database. Please check that every piece is in place, try also to execute every single script on the command line and check for error messages.

SRadiant commented 5 years ago

Thank you for your response. I'm trying find out the problem. When I run "sudo /usr/local/lib/airpi/airpi-data-store", ERROR:root:airpi-data-store: Reading PMS5003 status file: [Errno 2] No such file or directory: '/var/run/pms5003.status' ERROR:root:airpi-data-store: Parsing PMS5003 status file: name 'data' is not defined (I don't get PMS5003 yet) Is it fine? My RPi autologin user "pi" when start. I have to add sudo in front of executing any script. Is it possible permission problem?

RigacciOrg commented 5 years ago

The error reading PMS5003 status data is OK, since you don't have that sensor; this error should be non fatal. Check if the SQLite database is created: /var/lib/airpi/airpi-data.db. The file should be owned by root:root, permissions -rw-r--r-- Try the commands on the command line as root: execute sudo su - once and you don't need sudo anymore in that ssh session.

SRadiant commented 5 years ago

/var/lib/airpi/airpi-data.db was created, and permissions -rw-r--r--, too. I had executing some script separately... image image image image

SRadiant commented 5 years ago

Maybe snmp problem? I didn't set any configuration of snmp or snmpd, because I didn't know what should I do about "/example/snmpd.conf" and "make configuration to expose sensors values via SNMPD in More Software Setup".

happynitron commented 5 years ago

did you guys figure out it? i'm too facing like this problem. what can you suggest for the below error? root@john:/var/www/html# /usr/local/lib/airpi/airpi-data-http-post INFO:root:airpi-data-http-post: Communicating with post_data.php Traceback (most recent call last): File "/usr/local/lib/airpi/airpi-data-http-post", line 54, in <module> r = requests.post(HTTP_REQUEST_URL, verify=False, data={'login': HTTP_LOGIN, 'password': HTTP_PASSWORD}) File "/usr/lib/python2.7/dist-packages/requests/api.py", line 110, in post return request('post', url, data=data, json=json, **kwargs) File "/usr/lib/python2.7/dist-packages/requests/api.py", line 56, in request return session.request(method=method, url=url, **kwargs) File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 474, in request prep = self.prepare_request(req) File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 407, in prepare_request hooks=merge_hooks(request.hooks, self.hooks), File "/usr/lib/python2.7/dist-packages/requests/models.py", line 302, in prepare self.prepare_url(url, params) File "/usr/lib/python2.7/dist-packages/requests/models.py", line 366, in prepare_url raise MissingSchema(error) requests.exceptions.MissingSchema: Invalid URL 'localhost/airpi/post_data.php': No schema supplied. Perhaps you meant http://localhost/airpi/post_data.php?

root@john:/var/www/html# /usr/local/lib/airpi/airpi-data-mqtt-pub ERROR:root:airpi-data-mqtt-pub: Cannot get timestamp: [Errno 2] No such file or directory: '/var/lib/airpi/mqtt-timestamp' INFO:root:airpi-data-mqtt-pub: Latest upload: 1970-01-01T00:00:00Z ERROR:root:airpi-data-mqtt-pub: Error reading the database: no such table: data