diff --git a/Dockerfile b/Dockerfile
index 5801fb6..4ffeab6 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -8,4 +8,4 @@ RUN mvn install
EXPOSE 8080
-CMD ["bash", "-c", "java -jar target/amazon-echo-bridge-*.jar --upnp.config.address=$(ip route get 8.8.8.8 | egrep -o '[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\s*$')"]
+CMD ["bash", "-c", "java -Xmx256M -jar target/amazon-echo-bridge-*.jar --upnp.config.address=$(ip route get 8.8.8.8 | egrep -o '[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\s*$')"]
diff --git a/README.md b/README.md
old mode 100755
new mode 100644
index cbd2e10..884f24c
--- a/README.md
+++ b/README.md
@@ -4,6 +4,17 @@ Amazon Echo Bridge allows you to quickly emulate a Phillips Hue bridge, bringing
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!
+## Release notes:
+v0.4.0
+change log:
+
+* require --upnp.config.address= to be specified during startup
+* support more than 25 emulated devices currently set to 75, can be increased at 25 device increments by specifying --emulator.portcount= default is 3 thus 3*25 = 75 total devices. Works by taking emulator.baseport and opening n number of ports sequentially from baseport to baseport+portcount
+* relaxed http response codes to anything in the 200 to less than 300 http response codes to support misbehaving resources
+
+other notes:
+Ive seen some folks able to run this but not able to discover devices. I would recommend checking for devices with duplicate names as i have seen this to cause the echo to reject all devices. The lazy way would be to delete the /data directory and start over.
+
## Quick Start
There are currently three different ways to run the pre-built jar file:
@@ -24,8 +35,13 @@ After the application is started and running, you can access the configurator by
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!
+Instruct your Amazon Echo to learn about your devices by saying "Alexa, discover my devices" and your all set!
+
+## Using
+
+You can now control devices with your Amazon Echo by saying "Alexa, Turn on the office light" or other names you have given your configured devices.
+To view or remove devices that Alexa knows about, you can use the mobile app Menu / Settings / Connected Home, This is needed if you remove a device from the Amazon Echo Bridge.
## Build
@@ -49,7 +65,7 @@ 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.
+Then locate the jar and start the server using the instructions above. By default maven will put the jar file in the target directory. ```java -jar target/amazon-echo-bridge-*.jar```
## POST/PUT REST API
diff --git a/pom.xml b/pom.xml
old mode 100644
new mode 100755
index 574a7c8..6950b74
--- a/pom.xml
+++ b/pom.xml
@@ -1,67 +1,70 @@
- 4.0.0
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ 4.0.0
- com.armzilla.ha
- amazon-echo-bridge
- 0.2.1
- jar
+ com.armzilla.ha
+ amazon-echo-bridge
+ 0.4.0
+ jar
- Amazon Echo Bridge
- Emulates a Philips Hue bridge to allow the Amazon Echo to integrate seamlessly into various home automation systems.
+ Amazon Echo Bridge
+ Emulates a Philips Hue bridge to allow the Amazon Echo to integrate seamlessly into various home
+ automation systems.
+
-
- org.springframework.boot
- spring-boot-starter-parent
- 1.2.3.RELEASE
-
-
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.2.6.RELEASE
+
+
+
-
- UTF-8
- com.armzilla.ha.SpringbootEntry
- 1.8
-
+
+ UTF-8
+ com.armzilla.ha.SpringbootEntry
+ 1.8
+ 4.5.1
+
-
-
- org.springframework.boot
- spring-boot-starter-actuator
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
- org.springframework.data
- spring-data-elasticsearch
-
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- org.apache.httpcomponents
- httpclient
- 4.3.6
-
-
-
-
-
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.apache.httpcomponents
+ httpclient
+ ${httpclient.version}
+
+
+ com.h2database
+ h2
+ runtime
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
diff --git a/src/main/java/com/armzilla/ha/ConfigChecker.java b/src/main/java/com/armzilla/ha/ConfigChecker.java
new file mode 100644
index 0000000..4fb2a5f
--- /dev/null
+++ b/src/main/java/com/armzilla/ha/ConfigChecker.java
@@ -0,0 +1,22 @@
+package com.armzilla.ha;
+
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+/**
+ * Created by arm on 9/16/16.
+ */
+@Component
+public class ConfigChecker implements InitializingBean {
+
+ @Value("${upnp.config.address}")
+ private String responseAddress;
+
+ @Override
+ public void afterPropertiesSet() throws Exception {
+ if(responseAddress == null || responseAddress.isEmpty() ){
+ throw new IllegalArgumentException("please provide the IP(v4) address of the interface you want the bridge to listen on using --upnp.config.address=");
+ }
+ }
+}
diff --git a/src/main/java/com/armzilla/ha/SpringbootEntry.java b/src/main/java/com/armzilla/ha/SpringbootEntry.java
index 304201e..c965ca5 100644
--- a/src/main/java/com/armzilla/ha/SpringbootEntry.java
+++ b/src/main/java/com/armzilla/ha/SpringbootEntry.java
@@ -2,15 +2,14 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@EnableScheduling
-@ComponentScan
public class SpringbootEntry {
public static void main(String[] args) {
SpringApplication.run(SpringbootEntry.class, args);
}
+
}
diff --git a/src/main/java/com/armzilla/ha/TomcatConnectorBean.java b/src/main/java/com/armzilla/ha/TomcatConnectorBean.java
new file mode 100644
index 0000000..2fc132f
--- /dev/null
+++ b/src/main/java/com/armzilla/ha/TomcatConnectorBean.java
@@ -0,0 +1,41 @@
+package com.armzilla.ha;
+
+import org.apache.catalina.connector.Connector;
+import org.apache.coyote.http11.Http11NioProtocol;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
+import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.stereotype.Component;
+
+/**
+ * Created by arm on 9/12/15.
+ */
+@Component
+
+public class TomcatConnectorBean {
+ @Value("${emulator.portbase}")
+ private int portBase;
+ @Value("${emulator.portcount}")
+ private int portCount;
+ @Bean
+ public EmbeddedServletContainerFactory servletContainer() {
+ TomcatEmbeddedServletContainerFactory tomcat = null;
+ for(int i = 0; i < portCount; i ++) {
+ if(tomcat == null){
+ tomcat = new TomcatEmbeddedServletContainerFactory(portBase + i);
+ }else{
+ tomcat.addAdditionalTomcatConnectors(createConnector(portBase + i));
+ }
+ }
+ return tomcat;
+ }
+
+ private Connector createConnector(int portNumber) {
+ Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
+ Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler();
+ connector.setScheme("http");
+ connector.setPort(portNumber);
+ return connector;
+ }
+}
diff --git a/src/main/java/com/armzilla/ha/api/hue/HueApiResponse.java b/src/main/java/com/armzilla/ha/api/hue/HueApiResponse.java
index 67e360e..d7d996b 100644
--- a/src/main/java/com/armzilla/ha/api/hue/HueApiResponse.java
+++ b/src/main/java/com/armzilla/ha/api/hue/HueApiResponse.java
@@ -1,7 +1,5 @@
package com.armzilla.ha.api.hue;
-import com.armzilla.ha.api.hue.DeviceResponse;
-
import java.util.Map;
/**
diff --git a/src/main/java/com/armzilla/ha/dao/DeviceDescriptor.java b/src/main/java/com/armzilla/ha/dao/DeviceDescriptor.java
index 30e0fb5..d92e31f 100644
--- a/src/main/java/com/armzilla/ha/dao/DeviceDescriptor.java
+++ b/src/main/java/com/armzilla/ha/dao/DeviceDescriptor.java
@@ -1,12 +1,15 @@
package com.armzilla.ha.dao;
-import org.springframework.data.annotation.Id;
-import org.springframework.data.elasticsearch.annotations.Document;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
/**
* Created by arm on 4/13/15.
*/
-@Document(indexName = "device", type = "devicedescriptor", shards = 1, replicas = 0, refreshInterval = "-1")
+@Entity
+@Table(name = "devices")
+
public class DeviceDescriptor{
@Id
private String id;
diff --git a/src/main/java/com/armzilla/ha/dao/DeviceRepository.java b/src/main/java/com/armzilla/ha/dao/DeviceRepository.java
index 3b0a80d..83d1f48 100644
--- a/src/main/java/com/armzilla/ha/dao/DeviceRepository.java
+++ b/src/main/java/com/armzilla/ha/dao/DeviceRepository.java
@@ -1,16 +1,15 @@
package com.armzilla.ha.dao;
import org.springframework.data.domain.Page;
-import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
-import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
+import org.springframework.data.repository.CrudRepository;
import java.util.List;
/**
* Created by arm on 4/13/15.
*/
-public interface DeviceRepository extends ElasticsearchRepository {
+public interface DeviceRepository extends CrudRepository {
Page findByDeviceType(String type, Pageable request);
List findAll();
DeviceDescriptor findOne(String id);
diff --git a/src/main/java/com/armzilla/ha/hue/HueMulator.java b/src/main/java/com/armzilla/ha/hue/HueMulator.java
index 35af355..5934c4c 100644
--- a/src/main/java/com/armzilla/ha/hue/HueMulator.java
+++ b/src/main/java/com/armzilla/ha/hue/HueMulator.java
@@ -19,6 +19,7 @@
import org.apache.http.util.EntityUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.HttpHeaders;
@@ -50,6 +51,10 @@ public class HueMulator {
private HttpClient httpClient;
private ObjectMapper mapper;
+ @Value("${emulator.portbase}")
+ private int portBase;
+ @Value("${emulator.portcount}")
+ private int portCount;
public HueMulator(){
httpClient = HttpClients.createDefault(); //patched for now, moving away from HueMulator doing work
@@ -60,8 +65,10 @@ public HueMulator(){
@RequestMapping(value = "/{userId}/lights", method = RequestMethod.GET, produces = "application/json")
public ResponseEntity