GithubHelp home page GithubHelp logo

defcon-api's Introduction

DefCon API

Overview

A simple Flask-based API to expose the Rackspace DefCon lights.

Endpoints

The API currently supports the following calls:

  • /v1/status - Returns the currently set status on the unit.
  • /v1/status/ - Sets the DefCon status to a value between 1 and 5.
  • /v1/status/up - Increments the DefCon status from the current value.
  • /v1/status/down - Decrements the DefCon status from the current value.
  • /v1/party - Engage / disengage party mode.

Installation

Steps pending.

There are several standalon runtime solutions for Flask - See here. Using Twisted you can run the DefCon API with the following command:

twistd -n web --port 80 --wsgi defcon.app

Configuration

Configuration is handled in the config.yml file. Both pin_map and strobe_pin fields are specifically used to define the BCM pin locations associated with the various DefCon lights. The defcon_state field is only used to track the last known state of the defcon unit. This value is held in memory but written to file to ensure the defcon unit returns to the same state on restart.

Config example

defcon_state: 3
pin_map:
  1: 13
  2: 11
  3: 9
  4: 22
  5: 29
strobe_pin: 0

defcon-api's People

Contributors

nathan-d avatar seeafish avatar

Watchers

 avatar

defcon-api's Issues

Strobe support

We need to add some additional support for the red strobe. This should fire to alert people that a DefCon value is about to change.

Add call to disable changes to DefCon state

There will be times when we want to disable API calls to the API endpoints to avoid a value being unset.

We should expose as an additional API call along with a token to block certain API calls through a flag being set.

Sound output

We need to support a sound being played when a change of DefCon state is actioned.

Pin mode not being correctly set

Line 12 in gpio_interface.py is trying to set the GPIO mode using GPIO.mode('BCM') when it should be GPIO.mode(GPIO.BCM).

Fix in place under issue-13-gpio-mode branch (Old GitLab issue) but this needs to be set in the config going forward.

Party mode

Its the most requested feature. We need a party mode.

When set the DefCon unit should go into total disco mode with alternating lights flashing at a sensible (Read as non-fit inducing) rate.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.