An open API service indexing awesome lists of open source software.

https://github.com/techgaun/xmart-things-demo

A demo app in Phoenix for https://github.com/techgaun/xmart-things
https://github.com/techgaun/xmart-things-demo

demo phoenix smartapp

Last synced: 2 months ago
JSON representation

A demo app in Phoenix for https://github.com/techgaun/xmart-things

Awesome Lists containing this project

README

        

# xmart-things-demo

This is a sample application that uses [xmart_things](https://github.com/techgaun/xmart-things) to interact with Web Services SmartApp.

![UI](priv/smartapp/ui.png)

- [Sample Web Services SmartApp groovy script](priv/smartapp/lock.groovy)
- [Auth Controller](web/controllers/auth_controller.ex) has callback route and stores smartthings access token and smartthings endpoint URI for SmartApp in user session.
- [Page Controller](web/controllers/page_controller.ex) has lock related routes and handles listing lock devices and also turning the locks on and off.

To start your Phoenix app:

* Install dependencies with `mix deps.get`
* Install Node.js dependencies with `npm install`
* Start Phoenix endpoint with `mix phoenix.server`

Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.

## Configuration

You have to configure `xmart_things` configuration by setting appropriate environment variables. Look at the [config](config/config.exs#L21-L25)

On the SmartThings side, configure a new app using [Sample Web Services SmartApp groovy script](priv/smartapp/lock.groovy).