Skip to content

sebastien-lb/alfred-brain

Repository files navigation

ALFRED BRAIN

Config Specification

You can find an example of the config.json file which will be return by the object in config.spec.json

Launch Alfred with Docker

git clone https://github.com/clement26695/alfred-docker.git
cd alfred-docker
docker-compose up

To launch the stack in detached mode, then see the logs:

docker-compose up -d
docker-compose logs -f

You can access the interface at localhost:5000. To log in you need to use the default test account: login: alfred, paswd: alfred. You can also add the SmartObjects with their ip and port (see below for their configurations). NB: ip is really chiros-lamp (due to docker local network).

Smart objects

Three objects are launched by Docker. Their ip and port are the following:

Lamp

{
  "ip": chiros-lamp,
  "port": 9800
}

Thermometer

{
  "ip": chiros-thermometer,
  "port": 9801
}

RGB LED

{
  "ip": chiros-rgb-led,
  "port": 9802
}

Launch alfred-brain without Docker

Project Setup

git clone
cd alfred-brain
python3 -m venv .
source ./bin/activate
pip install -r requirements.txt

Database Launch

cd docker
docker-compose up

Create superuser

python3 manage.py createsuperuser

Apply migrations

python3 manage.py migrate

Start App

HOST_IP=<YOUR_IP> python3 manage.py runserver 0.0.0.0:8000

Replace <YOUR_IP> by your real ip.

Test with Postman

Check that : https://stackoverflow.com/questions/50715237/how-to-test-django-rest-api-using-postman#answer-50715566

Troubleshooting

if mysqlclient not installing on MacOS, follow this :

  • remove TEMPORARY mysqlclient from requirement :
  • do :
LDFLAGS=-L/usr/local/opt/openssl/lib pip install mysqlclient 
# https://github.com/PyMySQL/mysqlclient-python/issues/13
pip install -r requirements.txt

API Documentation

From Swagger :

https://app.swaggerhub.com/apis-docs/clement26695/Alfred/1.0.0

This documentation is the visualisation of the alfred API

About

Brain of Alfred

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published