jason0x43 / hacs-hubitat

A Hubitat integration for Home Assistant
MIT License
196 stars 48 forks source link

Support for Hubitat cloud access #118

Open bezkod opened 3 years ago

bezkod commented 3 years ago

Hi, the local setup works perfectly, but now my Hubitat hub is moved to another place and there is no dynamic DNS setup, but Hubitat cloud access works fine. It would be great to be able to configure Hubitat HA component to use cloud access to Hubitat hub. Currently, the setup flow takes hub's IP as input, but it is not currently possible to configure cloud URL in setup flow.

jason0x43 commented 3 years ago

Hmmm...I'll have to turn on remote access and try that out. How easy it would be depends on how the Maker API works through remote access, like if authentication or some level of token management is required.

Desterly commented 3 years ago

Just as an FYI, unless something drastically changed the only two changes that are needed are

1) The URL points to the cloud URL instead of the local instance 2) The HUB UID (This can be classified as part of the URL actually)

For example:

http://[local_ip]/apps/api/[appid]/devices/[Device ID]?access_token=[access_token]

becomes:

https://cloud.hubitat.com/api/[hub_uid]/apps/[app_id]/devices/[Device ID]?access_token=[access_token]

Technically, all you would need to do is make the base URL the user enters instead of just the address.... so it either be:

http://[local_ip]/apps/api (for local) or https://cloud.hubitat.com/api/[hub_uid]/apps (for cloud)

jason0x43 commented 3 years ago

Thanks for the additional info! I thought that might be the case, but I hadn't gotten around to testing it yet. That should be easy enough to work with. The extension can treat a hostname or schemaless URL as local (as it does now), and otherwise use the given URL as is.