This is a client project for a simple traffic light to tell your coworkers in the office when it is ok to interupt you.
The idea is a RaspberryPi runs a wb server that this Ember app connects to via socket.io. You then can control the traffic light and the corrisponding GPIO pins toggle on the RaspberryPi.
The setup uses the Pi-GPIO-Server project. A simple LED setup like this diagram:
And this project configured to point to the Pi-GPIO-Server.
To help facilitate a better server client relationship the important values that describe a bulb are configured on the server. And because of the design of the Pi-GPIO-Server there is only one configuration option we can use to send over: name.
The client expects the following data in the name property of the server
pins' config/pins.yml
. The format is expected to be a JSON string payload.
The name of the pin
A compatible CSS color value for this pin.
An optional number that can be used to order the lights when the client lists them (ascending).
An optional string that can be used to associate more then one pin with each other. All pins of the same group will only have one pin at a time on. If this is blank/null/undefined then it will not matter and function independently from any other groups.
Description of the meaning for this pin.
For example if you wanted a traffic light where red, yellow, and green can only
allow one light on at a time but also a warning light that can be turned on and
off independently from the traffic lights then the server's config/pins.yml
might look like this:
17:
name: '{"name":"Green Light","color":"#2ecc71","order":30,"group":"traffic","description:"Come on in and hang out. If the door is closed feel free to open it."}'
mode: OUT
initial: LOW
18:
name: '{"name":"Yellow Light","color":"#f1c40f","order":20,"group":"traffic","description":"Hard at work focusing. Inturupt if it is urgent or extreamly quick."}'
mode: OUT
initial: LOW
27:
name: '{"name":"Red Light","color":"#e74c3c","order":10,"group":"traffic","description":"In a meeting; do not disturb. Inturupt only if the site is down."}'
mode: OUT
initial: LOW
28:
name: '{"name":"Warning Light","color":"#e74c3c","order":40,"description":"Simple warning light"}'
mode: OUT
initial: LOW
Client side settings are stored in localStorage
. The initial defaults are
defined in config/environment.js
.
- Default:
true
- User customizable: NO
If you do not which to include the Konami code Easter eggs you can set this to false.
- Default:
standard
- User customizable: YES
Sets the hack.css theme.
- Default:
http://localhost:4200/
(dev) /http://10.0.0.100:5000/
(prod) - User customizable: YES
This is the socket.io URL to connect to. In development mode it is the same as
the ember server because there is a mock socket.io server that gets started
when you run ember serve
for demo / development purposes. This should point
to your RaspberryPi's IP address (Pi-GPIO-Server defaults to port 5000) in
production.
You will need the following things properly installed on your computer.
git clone <repository-url>
this repositorycd eng-traffic-pi
npm install
bower install
ember serve
- Visit your app at http://localhost:4200.
Make use of the many generators for code, try ember help generate
for more details
ember test
ember test --server
ember build
(development)ember build --environment production
(production)
Specify what it takes to deploy your app.