From 816a0025b14df0c3bade88617e549b7ff7cc67f3 Mon Sep 17 00:00:00 2001 From: Admin Date: Wed, 11 Nov 2015 15:16:42 -0600 Subject: [PATCH] Finished updating upnp for the readme --- README.md | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 90 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 42fb34d..84c4769 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ contentBody | string | This is the content body that you would like to send when contentBodyOff | string | This is the content body that you would like to send when executing an "off" request. ``` { -"id" : 12345, +"id" : "12345", "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", @@ -148,8 +148,8 @@ contentBodyOff | string | This is the content body that you would like to send w #### Basic Example ``` { -"id" : 6789, -"name" : "bedroom light", +"id" : "6789", +"name" : "table 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" @@ -158,7 +158,7 @@ contentBodyOff | string | This is the content body that you would like to send w #### Response ``` { -"id" : 6789, +"id" : "6789", "name" : "table 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", @@ -174,14 +174,14 @@ GET http://host:8080/api/devices Individual entries are the same as a single device but in json list format. ``` [{ -"id" : 12345, +"id" : "12345", "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" } { -"id" : 6789, +"id" : "6789", "name" : "table 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", @@ -197,7 +197,7 @@ GET http://host:8080/api/devices/ The response is the same layout as defined in the add device response. ``` { -"id" : 6789, +"id" : "6789", "name" : "table 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", @@ -648,6 +648,89 @@ rules | object | A collection of all rules and their attributes. This is not giv }, } ``` +## UPNP Emulation of HUE +This section will discuss the UPNP implementation of this bridge based as much as can be for the HUE. +### UPNP listening +The HA Bridge default UPNP listner is started on port 1900 on the upnp multicast address of 239.255.255.250. All ethernet interfaces that are active are bound to and the repsonse port is set to the one given on the command line above or the default of 50000. + +The listener will respond to the following body packet that contain the following minimal information: + +``` +M-SEARCH * HTTP/1.1\r\n +MAN: "ssdp:discover"\r\n +ST: urn:schemas-upnp-org:device:basic:1\r\n + OR +ST: upnp:rootdevice\r\n + OR +ST: ssdp:all\r\n +``` + +If this criteria is met, the following response is provided to the calling application: + +``` +HTTP/1.1 200 OK\r\n +CACHE-CONTROL: max-age=86400\r\n +EXT:\r\n +LOCATION: http://192.168.1.1:8080/description.xml\r\n +SERVER: FreeRTOS/6.0.5, UPnP/1.0, IpBridge/0.1\r\n +ST: urn:schemas-upnp-org:device:basic:1\r\n +"USN: uuid:Socket-1_0-221438K0100073::urn:schemas-upnp-org:device:basic:1\r\n\r\n +``` +### UPNP description service +The bridge provides the description service which is used by the calling app to interogate access details after it has decided the upnp multicast repsonse is the correct device. +#### Get Description +``` +GET http://host:8080/description.xml +``` +#### Response +``` +\n +\n + \n + 1\n + 0\n + \n + http://192.168.1.1:8080/\n + \n + urn:schemas-upnp-org:device:Basic:1\n + HA-Bridge (192.168.1.1)\n + Royal Philips Electronics\n + http://www.bwssystems.com\n + Hue Emulator for HA bridge\n + Philips hue bridge 2012\n + 929000226503\n + http://www.bwssystems.com/apps.html\n + 0017880ae670\n + uuid:88f6698f-2c83-4393-bd03-cd54a9f8595\n + \n + \n + (null)\n + (null)\n + (null)\n + (null)\n + (null)\n + \n + \n + index.html\n + \n + \n + image/png\n + 48\n + 48\n + 24\n + hue_logo_0.png\n + \n + \n + image/png\n + 120\n + 120\n + 24\n + hue_logo_3.png\n + \n + \n + \n +\n +``` ## Ask Alexa After this Tell Alexa: "Alexa, discover my devices"