Can you pass this feature request on or if you’d like me to fill out a developer request form please let me know.
The documentation currently only allows for getting the internal local IP address of the hub (getLocalIP()). Often with many new devices needs the ability to contact the device through the router/home gateway and needs to get the public IP address. With the restriction that hubAction can no longer contact an external DNS address or IP address there’ no way to get that information and folks who are using dynamic IP’s can no longer use apps that require the public IP address without the hubAction workaround.
Can ST provide an API to get the hub’s public IP address similar to the local IP address. There should not be any security concern since the public IP address is useless without a port forwarding or a “hole” that is manually setup by the user in the router/gateway. Given so and the fact that most users have dynamic IP addresses this would be a great feature add.
@RBoy Normally, requests are made towards the hub using the ST cloud via a URL that contains an access token and an app installation id. No need to know any IP. But if you really need to contact the hub directly, you can use HubAction to find out what your IP is and then open a firewall “hole”. But be aware that the hub is lacking most SSL CA chains and will not be able to accept https connections. Which makes it highly unsafe. Look up SmartApp WebService and API endpoints to find out how to securely send requests to the hub via the ST cloud.
1 Like
RBoy
(www.rboyapps.com - Making SmartThings Easy!)
4
How can that be done, hubAction doesn’t accept public DNS/IP’s anymore (so whatsmyip won’t work). One doesn’t need to contact the hub, but needs to contact the local devices through the public IP (going through a public IP + port forwarding is much faster than going through a hubAction, see my other posts on this). Since the hub and local devices share the same public IP (behind the same firewall), if the hub can return it’s public IP the same would hold true for all devices on the local network.
@Brad_ST to clarify as @ady624 mentioned, one needs the public IP of the hub (i.e. home network) which can change since the home network is usually a dynamic IP. Currently there is an API to get the hub’s local IP, I’m requesting an API to get the hub’s public IP also
Fetch that website’s IP and see if they respond to the IP as well (default vhost) and if you can get that working?
2 Likes
RBoy
(www.rboyapps.com - Making SmartThings Easy!)
6
Hmm looks like hubAction has started working again with public IP addresses, so yes the workaround of getting to whatsmyip would still work but it would better to have a simple API since ST knows the public IP rather than overloading the platform/hub to get the same information.
2 Likes
RBoy
(www.rboyapps.com - Making SmartThings Easy!)
7
And just like that it’s stopped working with Public IP addresses again, and now that ST has blocked access to google DNS, we’re out of luck @ady624 . Thanks ST
@gausnes@Brad_ST what’s the solution here? How do we get the public IP of the hub or convert a hostname to IP?
Is there a strong reason to get this address from SmartThings? There are security implications related to allowing a SmartApp to make requests outside the LAN from hubs. Could you just use a dynamic dns service like duckdns to get the public IP?
I suppose the one downside of this is that each user would need to configure the app with the dns name and ensure it is synced (not hard to do with any router supporting ddns, see Duck DNS - install).
1 Like
RBoy
(www.rboyapps.com - Making SmartThings Easy!)
9
HubAction doesn’t support DNS resolution, so the only way to get it to work was to take the hostname, use google DNS to return the IP address and then use that IP address with HubAction
The alternative solution is to have HubAction resolve DNS names like httpGet (and hopefully also support HTTPS) and problem resolved.
RBoy
(www.rboyapps.com - Making SmartThings Easy!)
10
No, this was a different use case. We’re writing an app for a European WiFi Lock and want to do auto discover and installation of the locks. For that one needs the external IP address of the hub and use it to discovery the installed locks (they locks are identified using the external IP address).
Without the external IP address, the user will be asked to “find” and enter it and that’s just not something everyone known how to find out. Basically knowing the external IP address allows for a 0 touch discovery and installation.
Alternatively allow HubAction to resolve and contact a Hostname directly
Problem with HubAction contacting a host directly is its lack of HTTPS support which means comms would then be plain text for any middle man to see - I would stay away from that and have the SmartApp do that in a DTH method?
I’ll do some tests on HubAction DNS resolution when I get the chance.