Skip to content

kenlane33/SmartAlarmClock

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smart Alarm Clock - craft ai app

Welcome to the Smart Alarm Clock (SAC for short) craft ai application.

What is it ?

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.

Requirements

  1. Install Python 2.7 on your computer,
  2. Install pip.

Forking the GitHub repository

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.

Run the application locally

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.

Exposing your localhost on the Internet

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.

User configuration

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)

App configuration

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.

Launch the Smart Alarm Clock

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.

Edit the behavior trees

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.

Details

Environment Variables

The demo is configured using the following environment variables:

  • CRAFT_DEMO_SAC_URL, the public URL of the web app
  • CRAFT_DEMO_SAC_WS_URL, the websocket URL of the web app
  • CRAFT_DEMO_SAC_PORT, the port to which the web app servers listens
  • CRAFT_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 files
  • CRAFT_DEMO_SAC_VERSION, the version branch of the GitHub project
  • CRAFT_DEMO_SAC_ACTIONS_URL, the URL of the web app
  • CRAFT_DEMO_SAC_DEPLOYMENT_DIR, the path, in the runtime container, of the compiled BTs
  • CRAFT_DEMO_SAC_APP_ID, The SAC application ID
  • CRAFT_DEMO_SAC_APP_SECRET, The SAC application secret

About

craft ai getting started example

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 81.6%
  • CSS 8.0%
  • Python 7.9%
  • HTML 2.5%