GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - bugcrowd/double_red: API for collecting Double Red color sensor readings (Winter 2017 hackathon)

This repository was archived by the owner on Jan 19, 2023. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

55 Commits
55 Commits

Folders and files

NameName
Last commit message
Last commit date
config
config
 
 
lib
lib
 
 
priv
priv
 
 
test
test
 
 
web
web
 
 
.gitignore
.gitignore
 
 
Procfile
Procfile
 
 
README.md
README.md
 
 
elixir_buildpack.config
elixir_buildpack.config
 
 
mix.exs
mix.exs
 
 
mix.lock
mix.lock
 
 

Repository files navigation

DoubleRed

API for collecting Double Red color sensor readings and interacting with Slack.

Installation

  • Install dependencies with mix deps.get
  • Create and migrate your database with mix ecto.create && mix ecto.migrate
  • Start Phoenix endpoint with mix phoenix.server

Usage

Locations

A location represents a restroom or stall that can be occupied or unoccupied. Register a location with the API and you can begin updating the status of that location.

Create a location

curl -X POST \
  -H "Content-Type: application/json" \
  --data '{
            "location": {
              "name": "Left Bathroom",
              "zone": 0
            }
          }' \
  http://localhost:4000/api/locations

An example response from the locations index might be:

{
  "data": [
    {
      "zone": 0,
      "name": "Left Bathroom",
      "id": "33ac6da6-970e-4f3e-9be1-4189a3abd18b"
    },
    {
      "zone": 1,
      "name": "Right Bathroom",
      "id": "9901dbe5-2a1b-4abb-86d3-811a1a5abe26"
    }
  ]
}

Wafts

A waft represents a status update for the location. At the moment double-red supports a color sensor for determining whether or not the restroom is occupied. When the color of the door indicator is red, that means the restroom is occupied. When the color is green the restroom is free for use.

To update the status of the restroom, post the details from the color sensor to that endpoint.

Create a Waft

In this example we'll update the status of the left bathroom from the above list. This is a contrived example of a red reading from the sensor, where red is maxed out and all other filtered colors are zero.

curl -X POST \
  -H "Content-Type: application/json" \
  --data '{
            "waft": {
              "red": 65535,
              "green": 0,
              "blue": 0,
              "temperature": 0,
              "brightness": 0
            }
          }' \
  http://localhost:4000/api/locations/33ac6da6-970e-4f3e-9be1-4189a3abd18b/wafts

Query the Current Status

To get the current status of the locations, query the status endpoint.

curl http://localhost:4000/api/status

This example response displays the left bathroom as occupied and the right as unoccupied:

{
  "data": [
    {
      "occupied": true,
      "location": "33ac6da6-970e-4f3e-9be1-4189a3abd18b"
    },
    {
      "occupied": false,
      "location": "9901dbe5-2a1b-4abb-86d3-811a1a5abe26"
    }
  ]
}

About

API for collecting Double Red color sensor readings (Winter 2017 hackathon)

Topics

color-sensorrestroom

Resources

Readme
Activity
Custom properties

Stars

7 stars

Watchers

11 watching

Forks

2 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.