diff --git a/custom_components/airscape/__init__.py b/custom_components/airscape/__init__.py index 28d96a4..fcb79e4 100644 --- a/custom_components/airscape/__init__.py +++ b/custom_components/airscape/__init__.py @@ -1,3 +1,4 @@ """The Airscape component.""" DOMAIN = "airscape" +AIRSCAPE_DOMAIN = "airscape" \ No newline at end of file diff --git a/custom_components/airscape/const.py b/custom_components/airscape/const.py index d761813..c1e7b7b 100644 --- a/custom_components/airscape/const.py +++ b/custom_components/airscape/const.py @@ -4,7 +4,8 @@ "power": "Power", "inside": "Inside Temperature", "attic": "Attic Temperature", - "oa": "Ouside Temperature", + "oa": "Outside Temperature", "interlock1": "InterLock1", "interlock2": "InterLock2", + "timeremaining": "Shutoff Timer" } diff --git a/custom_components/airscape/fan.py b/custom_components/airscape/fan.py index a457f36..b6737aa 100644 --- a/custom_components/airscape/fan.py +++ b/custom_components/airscape/fan.py @@ -19,6 +19,7 @@ CONF_MINIMUM ) +from . import AIRSCAPE_DOMAIN from .const import fan_to_hass_attr DEFAULT_TIMEOUT = 5 @@ -75,8 +76,17 @@ def service_slow_down(call): entity = hass.data[DOMAIN].get_entity(entity_id) entity.slow_down() - hass.services.register(DOMAIN, "airscape_speed_up", service_speed_up) - hass.services.register(DOMAIN, "airscape_slow_down", service_slow_down) + def service_add_time(call): + """Handle slow_down service call.""" + entity_id = call.data.get("entity_id") + _LOGGER.debug("Calling add_time for %s", entity_id) + + entity = hass.data[DOMAIN].get_entity(entity_id) + entity.add_time() + + hass.services.register(AIRSCAPE_DOMAIN, "speed_up", service_speed_up) + hass.services.register(AIRSCAPE_DOMAIN, "slow_down", service_slow_down) + hass.services.register(AIRSCAPE_DOMAIN, "add_time", service_add_time) return True @@ -156,7 +166,7 @@ def speed_up(self): airscape.exceptions.Timeout ): self._available = False - + def slow_down(self): """Instruct fan to increment speed down by 1.""" try: @@ -167,6 +177,17 @@ def slow_down(self): airscape.exceptions.Timeout ): self._available = False + + def add_time(self): + """Add an hour to the shutoff timer.""" + try: + self._fan.add_time() + except ( + airscape.exceptions.ConnectionError, + airscape.exceptions.Timeout + ): + self._available = False + @property def speed_list(self): diff --git a/custom_components/airscape/manifest.json b/custom_components/airscape/manifest.json index 24b49cc..3472634 100644 --- a/custom_components/airscape/manifest.json +++ b/custom_components/airscape/manifest.json @@ -2,11 +2,12 @@ "domain": "airscape", "name": "Airscape Whole House Fan", "documentation": "https://www.home-assistant.io/components/fan.airscape", + "version": "0.1.1", "requirements": [ - "airscape==0.1.8" + "airscape==0.1.8.1" ], "dependencies": [], "codeowners": [ "@quielb" ] -} +} \ No newline at end of file diff --git a/custom_components/airscape/services.yaml b/custom_components/airscape/services.yaml index 8b13789..9510542 100644 --- a/custom_components/airscape/services.yaml +++ b/custom_components/airscape/services.yaml @@ -1 +1,24 @@ - +speed_up: + name: Speed Up + description: Bump the WHF speed up by 1. + fields: + entity_id: + name: Entity ID + description: Entity ID of the fan to change. + required: true +slow_down: + name: Slow Down + description: Bump the WHF speed down by 1. + fields: + entity_id: + name: Entity ID + description: Entity ID of the fan to change. + required: true +add_time: + name: Add Time + description: Add an hour to the automatic shutoff timer of the WHF. + fields: + entity_id: + name: Entity ID + description: Entity ID of the fan to change. + required: true \ No newline at end of file