Git Product home page Git Product logo

gtfo's Introduction

GitHub Release license

Build Status Coveralls

Known Vulnerabilities Dependencies Status DevDependencies Status

Gently Tell Folks Out (of meeting rooms)

Push reservation notifications to meeting rooms!

Using remote modules equipped with RGB LEDs, GTFO lets meeting room occupants know the status of their current reservation. For example, 5 minutes before a meeting ends and another is set to begin, the room's LED will light up orange to let occupants know it's time to begin wrapping up.

Getting started

Minimum requirements

Room notification lights

The hardware setup consists of a host server and n number of remote modules.

A Unix-based system is required to run the host server which will control each remote module. A Raspberry Pi is recommended for its small footprint and power consumption, but a spare computer running OSX or Linux can be used just as well.

A network with 802.11b/g/n WiFi hotspots is required for the remote modules to connect to. Particle Photons are headless devices, so note that the hotspot security must not require a browser-based login portal for authenticating. (Router passwords, however, can be entered through Particle's terminal setup application.) MAC address white-listing can also be used for additional security.

The host server must be on the same LAN as the remote modules.

Office map

The host server will serve a map of the office on http://[host-ip-or-name]:3000, with programmatically-generate tiles for each remote module declared in environment/devices.json.

For this map to be usable, you must provide your own background image(s) and the size and position of each room tile. See environment configuration documentation.

Minimum required hardware per each remote module:

Hardware Setup

Photograph of hardware wiring

Photon Boards

Photon boards communicate with the Particle cloud and receive updates through the Particle API for JS.

Connect each board to your WiFi network.

Flash each module with firmware/firmware.cpp. (npm run flash is a WIP script to flash every device listed in devices.json.)

Retrieve the access tokens and device ids for each Photon, and place them into environment/devices.json. See environment configuration documentation.

Wire a set of NeoPixels to each Photon board. Optionally, wire a motion and temperature sensor.

Note that the firmware is configured to run with 12 NeoPixels. I recommend this ring for the best effects, but other NeoPixel configurations can be used. Just be sure to update PIXEL_COUNT in firmware.cpp to the correct number of pixels.

LED pin configuration (required)

Hardware: NeoPixel Ring (or equivalent WS2812 LEDs)

Wire Pin
Data in D2
PWR 3v
GRN Ground
Temperature and humidity sensor pin configuration (optional, must be enabled in environment configuration)

Hardware: DHT11 (with breakout board)

Wire Pin
Out A4
+ 3v
- Ground
Motion sensor pin configuration (optional, must be enabled in environment configuration)

Motion sensors enable detecting presence of room occupants in unreserved rooms, and setting the room status to "squatted" on the office map. Hardware: HC-SR501

Wire Pin
Data A0
VCC 3v
GND Ground

Software Setup

git clone https://github.com/Nase00/gtfo.git && cd gtfo && npm install

Before the application can be run, read how to configure it to your specific office or run npm run demo to generate an example configuration. The application will not run otherwise.

# After environment files have been configured
npm run hot --mocks

This will start the application in development mode with mock data and hot-reloading. At this point, the application should find and connect to each Particle Photon, and light up the LEDs.

Gateway API

GTFO does not currently handle authentication, thus it does not query Outlook Web Acess, Exchange Web Services, or any other services containing reservation data directly. Instead, a "gateway" API must be used as middleware when running production mode or development mode with live data. (E.g., running yarn hot with the --mocks flag.)

GTFO was developed in tandem with ews-wrapper, but any service could be used in its place, so long as the output is an identical format.

Sample gateway API output consumed by GTFO

[
  {
    "name": "SomeRoom",
    "schedule": [
      {
        "subject": "Alice Murphy",
        "start": {
          dateTime: "2018-11-30T15:00:00.000Z"
        },
        "end": {
          "dateTime": "2018-11-30T15:30:00.000Z"
        }
      },
      {
        "subject": "Anders Holmvik",
        "start": {
          dateTime: "2018-11-30T16:00:00.000Z"
        },
        "end": {
          "dateTime": "2018-11-30T17:00:00.000Z"
        }
      },
      {
        "subject": "Alice Murphy",
        "start": {
          dateTime: "2018-11-30T17:00:00.000Z"
        },
        "end": {
          "dateTime": "2018-11-30T18:00:00.000Z"
        }
      }
  },
  {
  "name": "SomeOtherRoom",
  "schedule": [
    {
      "subject": "Jillian Belk",
      "start": {
        dateTime: "2018-11-30T15:00:00.000Z"
      },
      "end": {
        "dateTime": "2018-11-30T16:30:00.000Z"
      }
    }
  }
]

In production mode, it assumed the gateway API is deployed on another domain, defined in environment/config.json. See environment configuration documentation.

Production build and deploy
npm install --production # Several dev dependencies are not Raspberry Pi compatible.
npm run prod # Production mode with live data. ews-wrapper or an equivalent service must be deployed and defined in environment/config.json!

Ping API

Alexa, where is Kerbin?

Kerbin is on the east side of the office. I've highlighted it on map for you.

The Ping API allows external services to "ping" specific rooms on targetted clients. Clients can be targetted using "anchors." The anchor id used is completely arbitrary, but must be matched between the service making the ping and the client attempting to be pinged.

To anchor a client, simply add an anchor query paramter to its route. E.g., http://hostname:3000/sears-tower-251?anchor=east-lobby defines the client's anchor as east-lobby.

To ping this client from an external service, direct a POST request to http://hostname:3000/api/ping with the headers:

{
  "id": "foo", // Required only when using a proxy (see blow), must match the application ID set in config.json
  "targetId": "kerbin",
  "anchor": "east-lobby",
  "event": "NEW_ROOM_PING"
}

The result of this ping is that Kerbin lights up on the client anchored to the east lobby. An example use of this is anchoring a client on a display in the east lobby, and assigning a nearby Amazon Echo to highlight queried rooms on the TV.

Ping troubleshooting

Some internal office networks restrict exposing ports for making HTTP requests. This would make it impossible, for instance, for an Echo lamdba service hosted on AWS to send a ping request to a GTFO server hosted on the office intranet. For these restricted networks, Acheron was created to be hosted externally (e.g., on a cloud service) to accept and forward pings to GTFO via a WebSocket connection.

To avoid confusion, note that there are two distinct WebSocket services within GTFO. The socket controller exists to host a WebSocket server to which browser applications connect to as clients. The proxy controller controller exists to connect to the proxy host where GTFO itself is considered the sole client.

Development

Development mode with hot-module reloading
npm run hot
Tests
npm run test # Lints and tests client, server, and universal code.
CLI Options
# pipe flags with "--", e.g. "npm run hot -- --mocks --dhc"
--mocks # Disables Outlook api in favor of using mock reservation data.
--dhc # Disables consoleController's fancy terminal output, sometimes needed for debugging.
--dd # Disables devices, useful for client testing without room module hardware.

Troubleshooting

Meeting room reservations aren't accurate

Make sure your server's system timezone is set correctly. Reservation times are compared against the system time to determine room reservation statuses. Raspberry Pi defaults to GMT+0.

gtfo's People

Contributors

bithoundio avatar dependabot-preview[bot] avatar snyk-bot avatar sowiecki avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

akumayouji

gtfo's Issues

Chores

  • Fix font sizes in the responsive design. Specifically, room temperature on Firefox desktop.

  • Pass stalls host to stalls component, make clickable link to stalls site.

Remove filter on past meetings

Remove filter on past meetings, and update getRoomAlert to incorporate logic to only filter those while calculating the alert. This is so that the room modal on the webapp can show past events.

Dependabot can't resolve your JavaScript dependency files

Dependabot can't resolve your JavaScript dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Error whilst updating coveralls in /yarn.lock:
Couldn't find package "@yarnpkg/core@^2.0.0-rc.29" required by "[email protected]" on the "npm" registry.

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Normalize `clients` implementation in socket events

  • ROOM_STATUSES_UPDATE uses a clients object passed all the way from the initial dispatch

  • NEW_ROOM_PING also uses a clientsWithAnchor object passed from the initial dispatch, but attached to the payload just before it enters the socketController.

Neither of these are really clean, and require this awkward, verbose code attached to each dispatch: state.getState().clientsReducer.get('clients').toJS();. I should come up a better implementation for intuitively retrieving clients from the store whenever a redux action results in a socket event needing to fire.

Temperature UX

Temperatures look fugly on meeting room SVG blocks. Unsure if I can resolve how to display them on the smallest-sized rooms without overcrowding. For now, I'll leave temperatures displayed in the room tooltips.

Explore more accessibility features

Screen reader compatibility

Explore a method to make the application screen reader compatible. May be possible by inserting a hidden/layered text element for each room to verbally indicate the room status.

Additional

Explore implementing https://www.deque.com/axe/ or a similar service.

TODO - rework terminal dashboard

blessed-contrib doesn't seem to be maintained anymore, and is currently unusable due to it depending on the compromised event-stream library.

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.