This is a repository used as hub in custom smart home system. It requires raspberry pi zero with php 7.1+ and apache server.
- install apache using
sudo apt-get install apache2
- install php using
sudo apt-get install php libapache2-mod-php
- clone this repository to
var/www/html
- run
php composer.phar install
- copy
.env-sample
into.env
and change it's content for your purposes
You also need to edit sudoers file and grant sudo access without password to gpio-controller
file. You can do this in following steps:
- Type in terminal
sudo visudo
- At the bottom add
www-data ALL=NOPASSWD:path_to_gpio_controller_file/gpio-controller
This will allow www-data user to run gpio-controller file as sudo without typing the password.
url: /
method: GET
params: pin
This will return current state of the pin passed as param. 1 = ON, 0 = OFF
url: /
method: POST
params: pin, action
This will change state of pin passed in params based on action. There are 2 accepted actions: TURN_ON
and TURN_OFF
By specifying LOGS=1
in .env
file you can determine if you want to output logs into logs
directory. logs/logs.log
is a default log file and will be always contain logs from all files.