Smart Home This is a raspberry pi based smart-home that can be used get data from sensors & control devices e.g light bulbs, fans, air conditioner, humidity & temp sensors, home media system.
The main aim of the project was to create a smart home system thats lets you to easily add more devices to your home without having to rewrite your code or change your circuit design.
This project was created on a debian linux platform but should work on other unix based[not limited to] systems.
- Tested on Debian Linux
- Python3
- node 10.2.0 and npm 6.3.0
- angular cli 6.0.0
git clone https://github.com/jakhax/smart-home.git && cd smart-home
- This part should be preferably done on your PC and not on the Pi as it is painfully slow to compile angular packages on the raspberry pi.
cd front-end
npm install
ng serve
- Edit environment.ts(.prod.ts in production)
apiEndPoint
to your django-rest endpoint, in this case the IP address of your Raspberry Pi.
- Build your app with
npm run build:prod
- First clone the project to your Raspberry Pi
python3 -m virtualenv virtual
source virtual/bin/activate
pip3 install -r requirements
For this project you will need the following configurations.
DEBUG=True
SECRET_KEY=SECRET_KEY
ALLOWED_HOSTS=.localhost,.127.0.0.1,testserver,.ngrok.io
CORS_ORIGIN_WHITELIST=127.0.0.1:4200,localhost:4200
JWT_EXPIRATION_DAYS=7
DATABASE_URL=postgres://user:password@127.0.0.1:5432/database
IS_PI=False
WEATHER_API_KEY=WEATHER_API_KEY
python manage.py migrate
python manage.py runserver
python manage.py test
- Get a weather api key from Darksky
- Assuming you have android sdk(preferably through android studio), java and gradle installed.
- Install cordova with npm
npm install -g cordova
- Create a cordova project
cordova create mobile
- At this point you can copy contents of the
dist
folder created when you build the angular app and replace them with the contents of thewww
folder in the cordova project folder, you can also uses a system link. - Add or edit the
<base href>
tag inindex.html
to<base href="./">
since we will using a file path and not a url - Add android ,
cordova platform add android
- Connect your android device via usb, enable usb-debugging then run
cordova run android
, it should run the app in your device.
- Adding GPIO pins, devices and device types to the Database via django admin.
- Suggestions on physical connections and builds.
- https://jakhax.github.io/smart-home/
- Use this creds to login
- username:
testuser
- password:
testuser
- username:
- You really dont think am going give you creds this !!, but am pretty sure there is a bug somewhere so feel free to hack through and be nice :)
- Git clone https://github.com/jakhax/smart-home.git
- Make the changes.
- Write your tests.
- If everything is OK. push your changes and make a pull request.
License (MIT License)
This project is licensed under the MIT Open Source license, (c) Smart Home