diff --git a/custom_components/kumo/__init__.py b/custom_components/kumo/__init__.py index fb36887..5aa0178 100644 --- a/custom_components/kumo/__init__.py +++ b/custom_components/kumo/__init__.py @@ -10,7 +10,7 @@ _LOGGER = logging.getLogger(__name__) -REQUIREMENTS = ["pykumo==0.1.6"] +REQUIREMENTS = ["pykumo==0.1.7"] DOMAIN = "kumo" KUMO_DATA = "kumo_data" KUMO_CONFIG_CACHE = "kumo_cache.json" @@ -83,7 +83,8 @@ async def async_setup(hass, config): else: # Try to load from server account = pykumo.KumoCloudAccount(username, password) - if account.try_setup(): + setup_success = await hass.async_add_executor_job(account.try_setup) + if setup_success: if prefer_cache: _LOGGER.info("Loaded config from local cache") success = True @@ -104,7 +105,8 @@ async def async_setup(hass, config): load_json, hass.config.path(KUMO_CONFIG_CACHE) ) or {"fetched": False} account = pykumo.KumoCloudAccount(username, password, kumo_dict=cached_json) - if account.try_setup(): + setup_success = await hass.async_add_executor_job(account.try_setup) + if setup_success: if prefer_cache: await hass.async_add_executor_job( save_json, diff --git a/custom_components/kumo/climate.py b/custom_components/kumo/climate.py index b602b86..2b4bd87 100644 --- a/custom_components/kumo/climate.py +++ b/custom_components/kumo/climate.py @@ -1,6 +1,7 @@ """HomeAssistant climate component for KumoCloud connected HVAC units.""" import logging import pprint +from datetime import timedelta import voluptuous as vol @@ -103,7 +104,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= kumo_api = pykumo.PyKumo(name, address, credentials, (connect_timeout, response_timeout)) await hass.async_add_executor_job(kumo_api.update_status) - devices.append(KumoThermostat(kumo_api)) + kumo_thermostat = KumoThermostat(kumo_api) + await hass.async_add_executor_job(kumo_thermostat.update) + devices.append(kumo_thermostat) _LOGGER.debug("Kumo adding entity: %s", name) async_add_entities(devices) @@ -170,13 +173,14 @@ def __init__(self, kumo_api): prop, str(err), ) + self._available = False - self._available = True def update(self): """Call from HA to trigger a refresh of cached state.""" for prop in KumoThermostat._update_properties: self._update_property(prop) + self._available = True def _update_property(self, prop): """Call to refresh the value of a property -- may block on I/O.""" @@ -426,7 +430,7 @@ def set_temperature(self, **kwargs): response = self._pykumo.set_heat_setpoint(target["heat"]) response += " " + self._pykumo.set_cool_setpoint(["cool"]) _LOGGER.debug("Kumo %s set temp: %s C", self._name, target) - _LOGGER.info("Kumo %s set temp response: %s", self._name, response) + _LOGGER.debug("Kumo %s set temp response: %s", self._name, response) def set_hvac_mode(self, hvac_mode): """Set new target operation mode.""" @@ -436,14 +440,14 @@ def set_hvac_mode(self, hvac_mode): mode = "off" response = self._pykumo.set_mode(mode) - _LOGGER.info("Kumo %s set mode response: %s", self._name, response) + _LOGGER.debug("Kumo %s set mode %s response: %s", self._name, hvac_mode, response) def set_swing_mode(self, swing_mode): """Set new vane swing mode.""" response = self._pykumo.set_vane_direction(swing_mode) - _LOGGER.info("Kumo %s set swing mode response: %s", self._name, response) + _LOGGER.debug("Kumo %s set swing mode response: %s", self._name, response) def set_fan_mode(self, fan_mode): """Set new fan speed mode.""" response = self._pykumo.set_fan_speed(fan_mode) - _LOGGER.info("Kumo %s set fan speed response: %s", self._name, response) + _LOGGER.debug("Kumo %s set fan speed response: %s", self._name, response) diff --git a/custom_components/kumo/manifest.json b/custom_components/kumo/manifest.json index c447a4f..fe4333c 100644 --- a/custom_components/kumo/manifest.json +++ b/custom_components/kumo/manifest.json @@ -4,6 +4,6 @@ "documentation": "https://github.com/dlarrick/hass-kumo", "dependencies": [], "codeowners": [ "@dlarrick" ], - "requirements": ["pykumo==0.1.6"], + "requirements": ["pykumo==0.1.7"], "homeassistant": "0.96.0" }