nanowebcoder / NanoVeraHuesBridge

A C# version of a Philips Hues Bridge which allows Amazon Echo to speak to Vera and control lights, doors, stereos and more.
Apache License 2.0
14 stars 4 forks source link

Web server #8

Closed davidwallis closed 7 years ago

davidwallis commented 7 years ago

Hi,

Cheeky question I know as I have forked your bridge with a view to trying to get this to work within the homeautomation app that I use (homegenie) I thought I would start with a console app and try and get your app working, however I can't browse to the web server when it runs as a console application, but I can when it runs through your test application.

Don't suppose you have any suggestions, if have no experience of the owin stuff.. and never heard of it before this morning!

forked here: https://github.com/davidwallis3101/NanoVeraHuesBridge -- ps there is some crude hacks to try and limit the debug messages to just that of the alexa as my network is quite busy with multicast traffic it seems!

Cheers

David

davidwallis commented 7 years ago

hmm have fixed it by changing the base url from

Globals.BaseAddress = "http://" + Globals.IPAddress + ":" + Globals.Port + "/";

to

Globals.BaseAddress = "http://*:8080";

Then I decided to go look at the code, and some idiot had told it to listen on 8081 doh..

However the alexa doesn't seem to call the web server after the SSDP response, with either your app or my bodged version.. any suggestions?

If I navigate to /api/setup.xml then I get an xml response looking correct.. any other url gives me a json string and

2016-10-02 10:29:50.1471|INFO|VeraHuesBridge.SetupController|SetupController GET returned hue template. 2016-10-02 10:30:08.7024|INFO|VeraHuesBridge.Controllers.HueApiController|ApiController GET (api/userId) called with userid [1] 2016-10-02 10:30:08.8284|INFO|VeraHuesBridge.DeviceResponse|Creating a device response object with name[Family Room Sonos], id [98e9445d-5645-4d41-9edc-a7b3742a483a]. 2016-10-02 10:30:08.9006|INFO|VeraHuesBridge.DeviceResponse|Creating a device response object with name[Garage Sonos], id [74c9265a-a7b0-4ae8-bbac-d4fec68ddff7]. 2016-10-02 10:30:08.9246|INFO|VeraHuesBridge.DeviceResponse|Creating a device response object with name[Sonos ODK], id [4c89a2bf-1dc9-4429-b211-cc0d8141de3b]. 2016-10-02 10:30:08.9392|INFO|VeraHuesBridge.DeviceResponse|Creating a device response object with name[Bathroom Sonos], id [6dfe2994-83de-4b22-9580-cb0b625d62fc]. 2016-10-02 10:30:08.9597|INFO|VeraHuesBridge.DeviceResponse|Creating a device response object with name[Office Sonos], id [8510cf26-fef9-44ab-beba-7ac1f173d8bb]. 2016-10-02 10:30:08.9763|INFO|VeraHuesBridge.DeviceResponse|Creating a device response object with name[Small Garage Door Lock], id [2e42f7b9-b5c3-4c4b-bd11-1252e23c790b]. 2016-10-02 10:30:09.0022|INFO|VeraHuesBridge.DeviceResponse|Creating a device response object with name[Main Garage Door Lock], id [2ea9366f-8885-4b5b-b3e0-46a815979fe8]. 2016-10-02 10:30:09.0207|INFO|VeraHuesBridge.DeviceResponse|Creating a device response object with name[Laundry Room Lock], id [67928ce2-e157-4637-b98d-37b030de01e7]. 2016-10-02 10:30:09.0642|INFO|VeraHuesBridge.DeviceResponse|Creating a device response object with name[Kitchen Lights], id [b56c8efa-5a1a-4fd4-bf0e-c0ae3d8235a7]. 2016-10-02 10:30:09.0876|INFO|VeraHuesBridge.DeviceResponse|Creating a device response object with name[Office Lights], id [267b1192-981b-4b71-a5bf-898bb7d7a1aa]. 2016-10-02 10:30:09.1038|INFO|VeraHuesBridge.DeviceResponse|Creating a device response object with name[Foyer Lights], id [60aa4ff4-e2c0-4342-929f-befa4f0911f0]. 2016-10-02 10:30:09.1282|INFO|VeraHuesBridge.DeviceResponse|Creating a device response object with name[TV], id [0a0e68c6-848a-4270-b1f4-d8113640754b]. 2016-10-02 10:30:09.1433|INFO|VeraHuesBridge.DeviceResponse|Creating a device response object with name[Direct TV], id [dd131b88-1236-430a-b57b-11ad3770be30]. 2016-10-02 10:30:09.1721|INFO|VeraHuesBridge.DeviceResponse|Creating a device response object with name[Stairway Lights], id [2b44f25e-fbe8-4a36-9d56-3cb52449c853]. 2016-10-02 10:30:09.1956|INFO|VeraHuesBridge.DeviceResponse|Creating a device response object with name[Hallway Lights], id [60b2a047-a7f1-4278-a6ee-a2a6ccb742a8]. 2016-10-02 10:30:09.2205|INFO|VeraHuesBridge.Controllers.HueApiController|ApiController GET (api/userId) returned HueApi device with [15] light(s)

its just the echo/alexa doesn't find any smart home devices..

davidwallis commented 7 years ago

logs from your application, with some filtering to just debug the echo:

`016-10-02 10:34:38.5365 | VeraHuesBridge.WebServer | INFO | Webserver created. DeviceConfig holds [15] device(s) |
2016-10-02 10:34:38.5809 | VeraHuesBridge.WebServer | INFO | Webserver starting up, listening on http://192.168.0.176:8080/ |
2016-10-02 10:34:39.1998 | VeraHuesBridge.WebServerStartup | INFO | Webserver configuration initiated... |
2016-10-02 10:34:39.4772 | VeraHuesBridge.WebServer | INFO | Webserver started. |
2016-10-02 10:34:48.1472 | VeraHuesBridge.SSDPService | DEBUG | Multicast From: 192.168.0.193:50000 Data: M-SEARCH * HTTP/1.1 HOST: 239.255.255.250:1900 MAN: "ssdp:discover" MX: 15 ST: urn:Belkin:device:**

|
2016-10-02 10:34:48.1472 | VeraHuesBridge.SSDPService | INFO | SSDP Discovery Packet detected. |
2016-10-02 10:34:48.1721 | VeraHuesBridge.SSDPService | INFO | Sending SSDP setup information... |
2016-10-02 10:34:48.1914 | VeraHuesBridge.SSDPService | DEBUG | Sent Response To: 192.168.0.193:50000 Data: HTTP/1.1 200 OK CACHE-CONTROL: max-age=86400 EXT: LOCATION: http://192.168.0.176:8080/api/setup.xml OPT: "http://schemas.upnp.org/upnp/1/0/"; ns=01 01-NLS: aef85303-330a-4eab-b28d-038ac90416ab ST: urn:schemas-upnp-org:device:basic:1 USN: uuid:Socket-1_0-221438K0100073::urn:Belkin:device:**

|
2016-10-02 10:34:48.2509 | VeraHuesBridge.SSDPService | DEBUG | Multicast From: 192.168.0.193:50000 Data: M-SEARCH * HTTP/1.1 HOST: 239.255.255.250:1900 MAN: "ssdp:discover" MX: 15 ST: urn:Belkin:device:**

|
2016-10-02 10:34:48.2749 | VeraHuesBridge.SSDPService | INFO | SSDP Discovery Packet detected. |
2016-10-02 10:34:48.2998 | VeraHuesBridge.SSDPService | INFO | Sending SSDP setup information... |
2016-10-02 10:34:48.3222 | VeraHuesBridge.SSDPService | DEBUG | Sent Response To: 192.168.0.193:50000 Data: HTTP/1.1 200 OK CACHE-CONTROL: max-age=86400 EXT: LOCATION: http://192.168.0.176:8080/api/setup.xml OPT: "http://schemas.upnp.org/upnp/1/0/"; ns=01 01-NLS: aef85303-330a-4eab-b28d-038ac90416ab ST: urn:schemas-upnp-org:device:basic:1 USN: uuid:Socket-1_0-221438K0100073::urn:Belkin:device:**

|
2016-10-02 10:34:48.3813 | VeraHuesBridge.SSDPService | DEBUG | Multicast From: 192.168.0.193:50000 Data: M-SEARCH * HTTP/1.1 HOST: 239.255.255.250:1900 MAN: "ssdp:discover" MX: 15 ST: urn:schemas-upnp-org:device:basic:1

|
2016-10-02 10:34:48.3940 | VeraHuesBridge.SSDPService | INFO | SSDP Discovery Packet detected. |
2016-10-02 10:34:48.4160 | VeraHuesBridge.SSDPService | INFO | Sending SSDP setup information... |
2016-10-02 10:34:48.4409 | VeraHuesBridge.SSDPService | DEBUG | Sent Response To: 192.168.0.193:50000 Data: HTTP/1.1 200 OK CACHE-CONTROL: max-age=86400 EXT: LOCATION: http://192.168.0.176:8080/api/setup.xml OPT: "http://schemas.upnp.org/upnp/1/0/"; ns=01 01-NLS: aef85303-330a-4eab-b28d-038ac90416ab ST: urn:schemas-upnp-org:device:basic:1 USN: uuid:Socket-1_0-221438K0100073::urn:Belkin:device:**

|
2016-10-02 10:34:48.6059 | VeraHuesBridge.SSDPService | DEBUG | Multicast From: 192.168.0.193:50000 Data: M-SEARCH * HTTP/1.1 HOST: 239.255.255.250:1900 MAN: "ssdp:discover" MX: 15 ST: urn:schemas-upnp-org:device:basic:1

|
2016-10-02 10:34:48.6357 | VeraHuesBridge.SSDPService | INFO | SSDP Discovery Packet detected. |
2016-10-02 10:34:48.6513 | VeraHuesBridge.SSDPService | INFO | Sending SSDP setup information... |
2016-10-02 10:34:48.6682 | VeraHuesBridge.SSDPService | DEBUG | Sent Response To: 192.168.0.193:50000 Data: HTTP/1.1 200 OK CACHE-CONTROL: max-age=86400 EXT: LOCATION: http://192.168.0.176:8080/api/setup.xml OPT: "http://schemas.upnp.org/upnp/1/0/"; ns=01 01-NLS: aef85303-330a-4eab-b28d-038ac90416ab ST: urn:schemas-upnp-org:device:basic:1 USN: uuid:Socket-1_0-221438K0100073::urn:Belkin:device:**

|
2016-10-02 10:34:55.4673 | VeraHuesBridge.SSDPService | INFO | SSDP Discovery Packet detected. |
2016-10-02 10:34:55.4849 | VeraHuesBridge.SSDPService | INFO | SSDP Discovery Packet detected. |
2016-10-02 10:34:57.5103 | VeraHuesBridge.SSDPService | INFO | SSDP Discovery Packet detected. | `

davidwallis commented 7 years ago

All sorted, user error.. (Firewall! doh)

nanowebcoder commented 7 years ago

Sorry, was out of it for awhile... but back in the saddle. I'm glad you got it sorted out... if there's anything I can do to help you out... just let me know.