diff --git a/README.md b/README.md new file mode 100644 index 0000000..9b6f678 --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +WeMo control +============ + +The plan: +--------- + +1. Use Fauxmo to create a virtual switch 'Movie Lights' recognized on the + NAS at port 20000 +2. Fauxmo will run in a docker file and be able to talk to another container, + which runs our golang executable. Other container name is 'movielights' +3. Our golang executable will then talk to the actual wemo switches + +TODO: +----- + +Figure out how to discover the IP addresses. Options are: + +* Do a discovery at startup +* ~~Do a discovery before an event~~ I don't like this one due to latency +* Do a discovery after an event +* Do a discovery on a time basis + +Discovery is currently via a node module. Would prefer to use go here diff --git a/fauxmo.py b/fauxmo/fauxmo.py old mode 100644 new mode 100755 similarity index 97% rename from fauxmo.py rename to fauxmo/fauxmo.py index 7358df5..f8e31e7 --- a/fauxmo.py +++ b/fauxmo/fauxmo.py @@ -114,7 +114,7 @@ class upnp_device(object): if not upnp_device.this_host_ip: temp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) try: - temp_socket.connect(('8.8.8.8', 53)) + temp_socket.connect(('1.1.1.1', 53)) upnp_device.this_host_ip = temp_socket.getsockname()[0] except: upnp_device.this_host_ip = '127.0.0.1' @@ -381,8 +381,14 @@ class rest_api_handler(object): # list will be used. FAUXMOS = [ - ['office lights', rest_api_handler('http://192.168.5.4/ha-api?cmd=on&a=office', 'http://192.168.5.4/ha-api?cmd=off&a=office')], - ['kitchen lights', rest_api_handler('http://192.168.5.4/ha-api?cmd=on&a=kitchen', 'http://192.168.5.4/ha-api?cmd=off&a=kitchen')], + [ + 'Movie Lights', + rest_api_handler( + 'http://movielights:8081/basement?moviemode=true', + 'http://movielights:8081/basement?moviemode=false' + ), + 20000 + ], ]