Coder Social home page Coder Social logo

dgoverde / amazon-echo-ha-bridge Goto Github PK

View Code? Open in Web Editor NEW

This project forked from armzilla/amazon-echo-ha-bridge

0.0 2.0 0.0 33.33 MB

emulates philips hue api to other home automation gateways

License: Apache License 2.0

Java 69.57% JavaScript 12.07% HTML 18.35%

amazon-echo-ha-bridge's Introduction

Amazon Echo Bridge        codeship status

Amazon Echo Bridge allows you to quickly emulate a Phillips Hue bridge, bringing the ability to seamlessly integrate an Amazon Echo into various home automation systems.

Also, with an easy to use POST/PUT REST API, it's never been easier before to get your devices up and running with the Amazon Echo with your own embedded applications!

Quick Start

There are currently three different ways to run the pre-built jar file:

Java - java -jar amazon-echo-bridge-*.jar

Maven - mvn spring-boot:run

Docker - docker build -t amazon-echo-ha-bridge . docker run -ti --rm --net=host amazon-echo-ha-bridge

Additionally, it's also recommended you pass the command line arguments --upnp.config.address and --server.port to override the hardcoded values currently implemented.

Examples: --upnp.config.address=192.168.1.240 --server.port=8081

After the application is started and running, you can access the configurator by accessing http://YOURIP:PORT/configurator.html.

Input your devices using the form at the bottom of the page, add command URLs to parse (useful if you use a system like OpenHAB), and save.

Instruct your Amazon Echo to take control of your devices by saying "Alexa, discover my devices" and your all set!

Build

In case you would like to internally configure your own build of the Amazon Echo Bridge, a few requisites are required.

Install Maven:

       Ubuntu/Linux - sudo apt-get install maven

       OS X - Install Homebrew and run brew install maven

Make Changes:

For instance, the server defaults to running on port 8080. If you're already running a server (like openHAB) on 8080, you could edit server.port in src/main/resources/application.properties to your desired port before building the jar.

Alternatively you could also pass in a command line argument to override server.port.

Compile:

To build the jar file yourself, make your changes and simply run Maven like this:

mvn install

Then locate the jar and start the server using the instructions above.

POST/PUT REST API

Along with registering devices via the Configurator page, you can also push device information via REST to the Amazon Echo Bridge like so:

POST http://host:port/api/devices
{
"name" : "bedroom light",
"deviceType" : "switch",
  "onUrl" : "http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=1&DeviceNum=41",
  "offUrl" : "http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&DeviceNum=41"
}

Dimming is also supported by using the expression ${intensity.percent} with a value of 0-100 or ${intensity.byte} with a value 0-255, respectively.

Example:

{
    "name": "entry light",
    "deviceType": "switch",
    "offUrl": "http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&DeviceNum=31",
    "onUrl": "http://192.168.1.201:3480/data_request?id=action&output_format=json&DeviceNum=31&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=${intensity.percent}"
}

You can also push additional optional fields, such as:

  • contentType, which currently isn't validated

  • httpVerb, Only POST/PUT/GET supported

  • contentBody: Your POST/PUT body

Like so:

{
    "name": "test device",
    "deviceType": "switch",
    "offUrl": "http://192.168.1.201:3480/data_request?id=action&output_format=json&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue=0&DeviceNum=31",
    "onUrl": "http://192.168.1.201:3480/data_request?id=action&output_format=json&DeviceNum=31&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=${intensity.percent}",
  "contentType" : "application/json",
  "httpVerb":"POST",
  "contentBody" : "{\"fooBar\":\"baz\"}"
}

amazon-echo-ha-bridge's People

Contributors

2bitoperations avatar armzilla avatar brysonreece avatar duanemay avatar dvankley-sfdc avatar hackworth avatar markfalk avatar olegk-hybrid avatar

Watchers

 avatar  avatar

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.