dht22 Temperature Stats

Raspberry Pi

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

Creating new user: create user 'dhtuser'@'localhost' IDENTIFIED BY 'raspberry';

Permissions: grant all privileges on *.* to 'dhtuser'@'localhost';

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) );

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; or select * from average_stats;

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:

#Cronjob that will repeat every minute
#Pipe the output to /dev/null to suppress mails from cron
* * * * * humiditypi > /dev/null

ESP-8266

aRest

Rest Server

sudo apt install php7.0 php7.0-curl php7.0-gd php7.0-intl php7.0-mbstring php7.0-mcrypt php7.0-bz2 php7.0-cli php7.0-json php7.0-mysql php7.0-opcache php7.0-readline php7.0-xml php7.0-zip

Used sources

cJSON

Description
Temperature statistics with the raspberry pi and dht22 sensor. The ESP-8266 can be used as sensor nodes.
Readme 9.6 MiB
Languages
C 30.5%
HTML 20.3%
PHP 19.6%
C++ 19.3%
CSS 6.7%
Other 3.6%