The controller software is built on Node.js on the backend and Uses React.js for the frontend web UI. The software is also compatible with Apples HomeKit using HAP-NodeJS if you want to use an IOS based controller app rather than the built in scheduling functionality exposed by the web UI.
While it is possible to build the application on the Pi itself, it is much faster to install only the runtime dependancies on the Pi, and actually build the application on another OSX or Linux machine before rsyncing over the built assets.
- Install Node.js for your platform (OSX or Linux is recommended)
- Run
npm install -g yarn
- Run
yarn
- Run
cp keys.default.json keys.json
- Edit keys.js in your favourite text editor and add your Google Maps & OpenWeatherMap API keys. These keys are required and the web app will not work correctly without them
Go to openweathermap.org and sign up for a free account. Once signed up, go to home.openweathermap.org and copy the Api key from the setup tab into the OPEN_WEATHER_API_KEY
variable in keys.js
Go to console.developers.google.com and go to the Api manager page. Enable the 'Google Static Maps' API on the overview tab, then go to the credentials page and generate a new browser API key. Copy this key into the GOOGLE_MAPS_API_KEY
in keys.js
- clone or copy this repository to your Raspberry Pi
- cd into the web folder
- Run
sudo ./install_deps_on_pi.sh
- Run
./install_on_pi.sh
(This will most likely take a long time)
- run
yarn build
. To build the application locally - run
deploy_to_pi.sh user@raspberry-pi-ip:/path/to/web/app/folder/you/were/in/on/the/previous/step
. This will rsync the built application to the pi (it will also ask you for the pi users password a couple of times if you have not set up passwordless SSH).
- Run
sudo systemctl start itgetsthehose
(Note install_deps_on_pi will have set this service to auto start on boot)
- You should now be able to browse to https://<my-raspberry-pi-ip>/ and enter a valid Linux username/password for your Pi (by default pi/raspberry) and see the webUI
- If you want to register the Pi with a HomeKit controller app, you will need to enter a pin code - this can be seen on the settings page of the web UI
Development on the Raspberry Pi hardware can be somewhat painful, so this application has been built with having a development environment on OSX or Linux systems in mind. To facilitate this, the software can run in one of two modes - Development or Production. It is recommended to only use production mode when running on the Pi itself, as production mode enables a number of features which are inconvenient for development including HTTPS, authentication (using pwauth), and minified frontend resources. The mode can be controlled by setting the NODE_ENV
environment variable to either development/production (development is the default).
If you ran the install steps above, you should now have a working development environment set up. To build and run the application run
yarn dev
This command starts up the application server and watches for changes and restarts/hot-reloads as changes are detected. You should now be able to browse to the web UI on http://localhost:3001/.
To run the tests, run
yarn test
And to have the tests watch for file changes, run
yarn test --watch