From 1f755c5a9b97dbcde25a052d6e1826b64b7c9ff3 Mon Sep 17 00:00:00 2001 From: Jason Cheatham Date: Sun, 10 May 2020 22:42:24 -0400 Subject: [PATCH] Use host option when initializing hub --- custom_components/hubitat/device.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/custom_components/hubitat/device.py b/custom_components/hubitat/device.py index 947d571..e06c8be 100644 --- a/custom_components/hubitat/device.py +++ b/custom_components/hubitat/device.py @@ -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]: @@ -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: