bwssytems / ha-bridge

Home automation bridge that emulates a Philips Hue light system and can control other systems such as a Vera, Harmony Hub, Nest, MiLight bulbs or any other system that has an http/https/tcp/udp interface. This is a compact impl to run on small format computers. This is impl started from this project https://github.com/armzilla/amazon-echo-ha-bridge.
Apache License 2.0
1.45k stars 198 forks source link

Understanding Version reporting to SmartThings hub #1163

Open bluesubaru03 opened 4 years ago

bluesubaru03 commented 4 years ago

How is the HA-Bridge reporting it's version to devices trying to discover it? My Smartthings Hub (V2) is always trying to communicate to the bridge via port 80 even though the bridge is setup on port 443. I have had ST support manually update the port in my IDE to 443 and the integration works fine for awhile until something sets it back to 80. Looking at the description.xml file shows it is reporting the proper port 443. In issue #1107, ST developer posborne states that the ST hub is looking at the version the bridge is reporting and setting the port based on "uses the version of the bridge (1.24+ for TLS) as a marker for TLS support or, temporarily, just using port 80 as we have in the past." I also know there is a firmware version setting on the bridge. Where/how is this reported to ST hub? In the description.xml file there is a version section that is reporting 1.0, is this where it is providing the version to ST? Can the bridge version be modified?

audiofreak9 commented 4 years ago

Yes, you can update the version HA Bridge is reporting on the Bridge Control page per the Wiki here: https://github.com/bwssytems/ha-bridge/wiki/HA-Bridge-FAQs#huereleaseversion

bluesubaru03 commented 4 years ago

According to SmartThings staff the Hub is looking for APIVERSION to determine the port to use. "The SmartThings hub does not inspect the description.xml, but looks at the Hue API version that the bridge reports in a HTTP config response. If apiversion is greater of equal to 1.24, it will use TLS on 443. If the the version is less than 1.24 or the Hue bridge does not report apiversion, it will default to HTTP on port 80." Is this reported by HA-Bridge?

bwssytems commented 4 years ago

The Api version is set in the HueConstants.java and is 1.19. This would need to be updated in code to change it.

bluesubaru03 commented 4 years ago

Can this be requested as an enhancement? Set API to 1.24 to allow ST to communicate over 443 and set to 1.19 to allow communications over port 80? Update: I guess the first thing to consider is; is APIVERSION actually being sent to the ST hub in any responses? If it is, then the above is relevant; if not, then I guess it would not have any affect.

Some Info from Barry at SmartThings: "Ah ok I think I see what’s going on here. So the ST hub will initially hit the Hue bridge on port 80 to get initial config, which determines if it should switch to 443. Since you have a web server running on port 80 and not the HA bridge, the ST hub is getting 404 responses back from the web server so it can’t complete config and get the right port.

Unfortunately there is not much I can do at the moment to fix this permanently. What I can do is revisit why we don’t look at the port number from the mDNS response (I’m starting to recall it was initially for SSDP responses, and we carried the logic over to mDNS) and try to get an update into the next firmware release (eta late jan/early feb) to hit port 443 right away."

bwssytems commented 4 years ago

@bluesubaru03 This can be requested as an enhancement