Escape Room game for your own home with Smart Home devices. Create your own scenario with your Smart Home devices to play with your friends at home!
Alexa is used to communicate with the players. An Alexa Skill was created for this purpose. This skill receives instructions via our program, which was deployed on a pythonanywhere server. A Raspberry PI is connected to the Smart Home devices and asks the server for new events. If one occurs, it forwards the steps to the respective Smart Home devices. Previously, ceiling lamps and blinds were connected via KNX, Philips Hue lamps via Zigbee and a box via Modbus. This box serves to lock the room key at the beginning of the game and release it again at the end.
We deploy at Pythonanywhere in a free account. That make sometimes some struggle. Steps ToDo:
- start new bash console (console > oher: bash)
- start the virtualenv, after that you see the `(venv) at the beginning.
source .virtualenvs/venv/bin/activate
- set the pythonanywhere settings
export DJANGO_SETTINGS_MODULE=escapehome.settings.pythonanywhere
- get current data:
git pull
- migrate database - can take a few minutes
cd EscapeHome/escapehome/ python manage.py migrate
You can Setup the Project in two Ways:
- with Docker
- with a virtual env
Navigate to the root folder and just type:
make run
This can take a longer time so grab you a coffee ☕
If you do not want to use Docker you have to setup by your own
- create a virtual env and active
virtualenv venv --python=python3
. venv/bin/activate
# Your terminal should have (venv) in front
- install requirements
pip install -r requirements.txt
If you want to use docker type export USE=docker
in your terminal
Django always need a Server running so type:
make run
If the makefile is broke you can type in:
docker-compose up -d
or for your local installation
cd escapehome
python manage.py runserver
enviroment varibales to set the Alexa-Skill id go to the projectfolder (escapehome) and add the var ALEXA_APP_ID_escapehome to the new Alexa-Skill ID at the .env file (if you can not see it remember its a hidden file :D )
-
GET -
api/commands
-
POST -
api/cancel
Body:{"exit_game": "true", "user": "<user_id>"}
Alexa Skills Kit Command Line Interface
https://developer.amazon.com/docs/smapi/quick-start-alexa-skills-kit-command-line-interface.html
ask api get-skill -s amzn1.ask.skill.e5c0051e-6fcc-4c73-9a22-9487ee9b0d29 --stage development > escapehome/escapehome/static/skill.json
ask api update-skill -s amzn1.ask.skill.e5c0051e-6fcc-4c73-9a22-9487ee9b0d29 --file escapehome/escapehome/static/skill.json --stage development
ask api get-model -s amzn1.ask.skill.e5c0051e-6fcc-4c73-9a22-9487ee9b0d29 --stage development -l de-DE > escapehome/escapehome/static/model.json
ask api update-model -s amzn1.ask.skill.e5c0051e-6fcc-4c73-9a22-9487ee9b0d29 -f escapehome/escapehome/static/model.json -l de-DE --stage development
ask api get-skill-status -s amzn1.ask.skill.e5c0051e-6fcc-4c73-9a22-9487ee9b0d29
Copy Relevant Data from DB to Alexa Slot Types
The first time for authentication: ask init --no-browser
Get data from alexa: (only once at the beginning)
make get-model
make get-skill
Transfer data from Django to Alexa:
make update-model
make skill-status
set up NGROK
- download ngrok > https://ngrok.com/download
- start
./ngrok http 8000
- copy generated URL
- in Alexa Developer Console > customize endpoints
https://<nummer>.ngrok.io/alexa/
, note second checkbox - add
<nummer>.ngrok.io
(without https) toALLOWED_HOSTS
in settingscommon.py
- in Alexa Developer Console > customize endpoints
- start Django (with or without Docker)
transfer data from the dump
python manage.py migrate
python manage.py shell
- Enter the following in the shell
from django.contrib.contenttypes.models import ContentType ContentType.objects.all().delete()
python manage.py loaddata db_dump.json