Check for finite numbers before inserting the data into the database; Link against math library; Updated Readme

This commit is contained in:
2017-09-07 20:41:22 +02:00
parent e6ce8e49a3
commit 05415b98ff
4 changed files with 51 additions and 10 deletions

View File

@@ -1,7 +1,12 @@
# dht22 Temperature Stats
## Raspberry Pi
## mySQL
### Dependencies
`apt install mariadb-server mariadb-client libmariadbclient-dev libmariadbclient-dev-compat libconfig-dev wiringpi libcurl4-openssl-dev (-s)`
### mySQL
Login: `mysql --user=root --password=password`
@@ -13,14 +18,40 @@ Create database: `create database dhtstats;`
Use database: `use dhtstats`
Create new table: `CREATE TABLE stats (id MEDIUMINT NOT NULL AUTO_INCREMENT, node_id int not null, pin int not null, humidity FLOAT NOT NULL, temperature FLOAT NOT NULL, isoutside int not null, gm3 float not null, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id) );`
Create new table:
```
CREATE TABLE stats (id MEDIUMINT NOT NULL AUTO_INCREMENT, node_id int not null, pin int not null, humidity FLOAT NOT NULL, temperature FLOAT NOT NULL, isoutside int not null, gm3 float not null, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id) );
```
and
```
CREATE TABLE average_stats (id MEDIUMINT NOT NULL AUTO_INCREMENT, humidity FLOAT NOT NULL, temperature FLOAT NOT NULL, gm3 float not null, isoutside int not null, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id) );
```
Show all entries in table: `select * from stats;`
## Dependencies
### Compile & Install
To compile and install humidityPi use this oneliner: `make && make install`
### Configuration
#### Settings
The settings file ist located under `/etc/humiditypi/settings.cfg`
#### Cronjob
If you like to run humidityPi in a desired time intervall you can enable a cronjob by entering `crontab -e` and paste the following to the bottom of the text file:
``` bash
#Cronjob that will repeat every minute
#Pipe the output to /dev/null to suppress mails from cron
* * * * * humiditypi > /dev/null
```
### Raspberry Pi
`apt install mariadb-server mariadb-client libmariadbclient-dev libmariadbclient-dev-compat libconfig-dev wiringpi libcurl4-openssl-dev (-s)`
### ESP-8266
[aRest](https://github.com/marcoschwartz/aREST)