Permalink
Browse files

Inital Code Commit

  • Loading branch information...
jerproffitt committed Aug 20, 2017
1 parent c708237 commit c58c6b0df6f7bc7d5bda92a0cc3ab7021e1f9f8f
Showing with 936 additions and 1 deletion.
  1. +33 −0 LICENSE.md
  2. +70 −1 README.md
  3. +23 −0 examples/light_on_off.ino
  4. +23 −0 examples/usage/usage.ino
  5. +11 −0 library.properties
  6. +1 −0 project.properties
  7. +569 −0 src/EchoPhotonBridge.cpp
  8. +206 −0 src/EchoPhotonBridge.h
@@ -0,0 +1,33 @@
[Attribution-NonCommercial-ShareAlike 4.0 International CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)
You are free to:
Share — copy and redistribute the material in any medium or format
Adapt — remix, transform, and build upon the material
The licensor cannot revoke these freedoms as long as you follow the license terms.
Under the following terms:
Attribution — You must give appropriate credit, provide a link to the license,
and indicate if changes were made. You may do so in any reasonable manner,
but not in any way that suggests the licensor endorses you or your use.
NonCommercial — You may not use the material for commercial purposes.
ShareAlike — If you remix, transform, or build upon the material,
you must distribute your contributions under the same license as the original.
No additional restrictions — You may not apply legal terms or technological measures
that legally restrict others from doing anything the license permits.
Notices:
You do not have to comply with the license for elements of the material in the public
domain or where your use is permitted by an applicable exception or limitation.
No warranties are given. The license may not give you all of the permissions
necessary for your intended use. For example, other rights such as publicity,
privacy, or moral rights may limit how you use the material.
https://creativecommons.org/licenses/by-nc-sa/4.0/
@@ -1,2 +1,71 @@
# EchoPhotonBridge
Amazon Echo Home Automation (Alexa) to Particle.IO Photon device bridge
### How it works
It's Simple. An Alexa Skill interfaces to a Library on the Particle device which abstracts away all the calls and communication required to implement Amazon Home Automation Skills. So now you can concentrate on bringing your devices to life instead of writting Lambdas, oAuth Servers and interfaces.
Using the EchoPhotonBridge, you'll be able to use phrases like:
```Alexa, Turn Photon Light On```, ```Alexa, Make Photon Light Red```,
```Alexa, Lock File Cabinet```, ```Alexa, what is the temperture of the blanket```
### What can it do?
The EchoPhotonBridge supports
- Turn On & Off (like a Light or Fan)
- Change a Device's Color (like a Light)
- Set, Increase or Decrease a Percentage on a Device (like a Light Dimmer or Fan Speed)
- Set, Increase or Decrease a Target Temperature (like for a Thermostat)
- Ask for the Current Temperature of a Device (like how cold a room is)
- Ask for the Target Temperature of a Device (like what the Thermostat is set to)
- Lock a Device (like a door lock) - Alexa does not support unlocking
- Ask for the Status of a Lock (locked or unlocked)
- Set, Increase or Decrease a Color Temperature (like a light bulb)
### What you need?
- [Purchase a Particle Photon](https://www.amazon.com/Particle-PHOTON-Comprehensive-Development-Access/dp/B016YNU1A0/ref=sr_1_fkmr0_1?ie=UTF8&qid=1501629481&sr=8-1-fkmr0&keywords=particle.io+photon) when you get it, Create a Particle IO Account then add your Photon to your Account using your smart phone.
- Program your Photon, in the Particle.io IDE, click on Libraries, search for EchoPhotonBridge and click on EchoPhotonBridge, then under examples, choose your what example to try. Then flash your device.
- Add the [EchoPhotonBridge Particle IO Bridge Alexa Skill](https://www.amazon.com/Particle-IO-Bridge-IOT-Pimp/dp/B074M1SLKY/ref=sr_1_1?s=digital-skills&ie=UTF8&qid=1503176563&sr=1-1&keywords=particle) to your Amazon Echo. You will be asked for your Particle.IO Bridge login, so login - this will give the skill access to your devices. The bridge will scan your particle account for devices running the EchoPhotonBridge Library and interface them to Amazon.
- Ask "Alexa Discover Devices" to trigger scanning for new devices and find your new Photon.
### Got a Code Example?
You just define the name of the device and attach a function to call - it's easy - how easy? 5 Lines of code easy!
```
//Line 1 - Add the EchoPhontonBridge Library to your code
#include "EchoPhotonBridge.h"
//Line 2 - Create a new EchoPhotonBridge instance
EchoPhotonBridge epb;
//Line 3 - Create a function to call when you tell Alexa to turn something on or off
int functionOnOff(int device, bool onOff, String rawParameters) {
//Line 4 - Do something when you turn something on or off, like turn on a light.
digitalWrite(D7, (onOff) ? HIGH : LOW);
}
void setup() {
pinMode(D7, OUTPUT);
//Line 5 - This line adds "Photon Light" to your Alexa,
// when you say "Alexa Photon Light On" the functionOnOff is called.
epb.addEchoDeviceV2OnOff("Photon Light", &functionOnOff); //Line 5 - Add the Photon Light to your Alexa.
}
void loop() {
}
```
### Need More Code?
Check out the examples!
### Need Help?
The Particle IO Bridge is available free. Should you need assistance, our suggestion is to visit the [Particle.IO Community Site](https://community.particle.io/). Should you require professional assistance at our standard hourly rate, please feel free to contact [Jeremy](mailto:proffitt.jeremy@gmail.com) directly using the contact form on the home page.
If you found a bug, please document it and open an issue on github.
### Demo Video
[![EchoPhotonBridge](https://i.ytimg.com/vi/eNSgS2_YVjQ/hqdefault.jpg?sqp=-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLBODEUqFiHbcKjYdSeF34wuJOe7yA)](https://www.youtube.com/watch?v=eNSgS2_YVjQ "EchoPhotonBridge")
### License
[ttribution-NonCommercial-ShareAlike 4.0 International CC BY-NC-SA 4.0](ttps://creativecommons.org/licenses/by-nc-sa/4.0/)
@@ -0,0 +1,23 @@
// This #include statement was automatically added by the Particle IDE.
#include "EchoPhotonBridge.h"
EchoPhotonBridge epb;
//function OnOff - this turns a device on or off
int functionOnOff(int device, bool onOff, String rawParameters)
{
digitalWrite(D7, (onOff) ? HIGH : LOW);
}
// REMINDER: Tell your echo, "Alexa, Discover Devices" after you program your photon so Amazon picks it up.
void setup()
{
pinMode(D7, OUTPUT);
epb.addEchoDeviceV2OnOff("Photon Light", &functionOnOff);
}
void loop()
{
}
@@ -0,0 +1,23 @@
// This #include statement was automatically added by the Particle IDE.
#include "EchoPhotonBridge.h"
EchoPhotonBridge epb;
//function OnOff - this turns a device on or off
int functionOnOff(int device, bool onOff, String rawParameters)
{
digitalWrite(D7, (onOff) ? HIGH : LOW);
}
// REMINDER: Tell your echo, "Alexa, Discover Devices" after you program your photon so Amazon picks it up.
void setup()
{
pinMode(D7, OUTPUT);
epb.addEchoDeviceV2OnOff("Photon Light", &functionOnOff);
}
void loop()
{
}
@@ -0,0 +1,11 @@
# Fill in information about your library then remove # from the start of lines
# https://docs.particle.io/guide/tools-and-features/libraries/#library-properties-fields
name=EchoPhotonBridge
version=0.5.0
author=Jeremy Proffitt <jeremy@IOTPimp.com>
# license=insert your choice of license here
# sentence=one sentence description of this library
# paragraph=a longer description of this library, always prepended with sentence when shown
# url=the URL of the project, like https://github.com/mygithub_user/my_repo
# repository=git repository for the project, like https://github.com/mygithub_user/my_repo.git
# architectures=a list of supported boards if this library is hardware dependent, like particle-photon,particle-electron
@@ -0,0 +1 @@
name=EchoPhotonBridge
Oops, something went wrong.

0 comments on commit c58c6b0

Please sign in to comment.