Skip to content

Commit

Permalink
Use host option when initializing hub
Browse files Browse the repository at this point in the history
  • Loading branch information
jason0x43 committed May 13, 2020
1 parent d2e7de4 commit 7f4049a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions custom_components/hubitat/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ def entity_id(self) -> str:
@property
def host(self) -> str:
"""The IP address of the associated Hubitat hub."""
return cast(str, self.config_entry.data.get(CONF_HOST))
return cast(
str,
self.config_entry.options.get(
CONF_HOST, self.config_entry.data.get(CONF_HOST)
),
)

@property
def mac(self) -> Optional[str]:
Expand Down Expand Up @@ -221,7 +226,9 @@ async def async_update_options(hass: HomeAssistant, entry: ConfigEntry) -> None:
_LOGGER.debug("Set temperature units to %s", temp_unit)

hass.states.async_set(
hub.entity_id, "connected", {CONF_TEMPERATURE_UNIT: hub.temperature_unit}
hub.entity_id,
"connected",
{CONF_HOST: hub.host, CONF_TEMPERATURE_UNIT: hub.temperature_unit},
)

async def check_config(self) -> None:
Expand Down

0 comments on commit 7f4049a

Please sign in to comment.