Welcome to the Smart Alarm Clock (SAC for short) craft ai application.
SAC is a small demo application built with craft ai. It demonstrates an application that will take care of managing your time based on your meetings on your google calendar. It will alert you when you should leave to your next meeting and will give you instruction on time to not miss it, based on realtime traffic informations.
- Install Python 2.7 on your computer,
- Install pip.
First, you will need to fork this GitHub repository of the app, so that you can manipulate the behaviors and actions.
To do so, go to github.com/craft-ai/SmartAlarmClock, log in with your GitHub account and click on the Fork button, in the top right corner of the page.
You can now clone your fork on your machine using your favorite GitHub client. We'll call <sac_dir>
the destination path of the local clone.
Before making any changes, let's make sure that the SAC application is running without any problem. A little bit of customization will be needed here.
Since the SAC application needs to communicate with the craft ai server, you must expose your localhost on the Internet. This is exactly what ngrok allows to do. We'll need at least ngrok v2.0.
Download ngrok and unzip the executable file (eg. ngrok.exe
on Windows) to <sac_dir>
.
Mac users can also install ngrok using homebrew, but as we need at least the 2.0 version that is not open source homebrew cask can install it using
brew cask install ngrok
.
The following information will be required to run the application:
- your GitHub username (more precisely, the namespace in which you forked the SAC GitHub project)
- the name of your fork (default: SmartAlarmClock)
- the branch of your fork you want to use (default: master)
You will also need to have an Application ID and an Application secret for your version of the SAC application.
Those are generated by craft ai, that's why you'll need to import your new fork in craft ai:
- go to the craft ai workbench
- sign-in with your GitHub account
- click on the add projects button and check the box on the right of the project corresponding to your fork of the project (something along the lines of /SmartAlarmClock)
- click on the "Add 1 project" button at the bottom of the list. The project will be added to your workspace and you can select it to start editing it
- in the project explorer that appears on the left of the page, open
craft_project.json
On the right side of the page, you can now retrieve the Application ID
and the Application secret
needed at the first run of the application.
Install the requirements by running pip install -r requirements.txt
from <sac_dir>
Launch the application by running the command python local_demo.py
from <sac_dir>
and fill in the fields with the data from the previous steps. These fields will be saved in a configuration file, you won't have to input everything the next time you run the application.
In your browser, go to http://localhost:8080. The Smart Alarm Clock should show up and ask you to log in with a Google Account.
You can edit the behaviors by logging into the craft ai workbench with your GitHub account and opening your SAC project.
In the project explorer, click on one of the behavior tree (*.bt
file) to open it in the editor.
The demo is configured using the following environment variables:
CRAFT_DEMO_SAC_URL
, the public URL of the web appCRAFT_DEMO_SAC_WS_URL
, the websocket URL of the web appCRAFT_DEMO_SAC_PORT
, the port to which the web app servers listensCRAFT_DEMO_SAC_USER
, the GitHub namespace hosting the GitHub project (either the GitHub username or the organization name to which the project belongs)CRAFT_DEMO_SAC_PROJECT
, the GitHub project containing the associated BT filesCRAFT_DEMO_SAC_VERSION
, the version branch of the GitHub projectCRAFT_DEMO_SAC_ACTIONS_URL
, the URL of the web appCRAFT_DEMO_SAC_DEPLOYMENT_DIR
, the path, in the runtime container, of the compiled BTsCRAFT_DEMO_SAC_APP_ID
, The SAC application IDCRAFT_DEMO_SAC_APP_SECRET
, The SAC application secret