From ace1ae85ddcf83a6fa56326d85e0190a6bca0b5d Mon Sep 17 00:00:00 2001 From: Peter Nijssen Date: Sun, 10 Feb 2019 14:54:30 +0100 Subject: [PATCH] add fan support for spider thermostats (#20897) * add fan support for spider thermostats * resolved feedback on pull request --- homeassistant/components/spider/__init__.py | 2 +- homeassistant/components/spider/climate.py | 32 +++++++++++++++++++-- requirements_all.txt | 2 +- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/spider/__init__.py b/homeassistant/components/spider/__init__.py index a10fa129fe5..5b991e0d3e2 100644 --- a/homeassistant/components/spider/__init__.py +++ b/homeassistant/components/spider/__init__.py @@ -14,7 +14,7 @@ from homeassistant.const import ( import homeassistant.helpers.config_validation as cv from homeassistant.helpers.discovery import load_platform -REQUIREMENTS = ['spiderpy==1.2.0'] +REQUIREMENTS = ['spiderpy==1.3.1'] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/spider/climate.py b/homeassistant/components/spider/climate.py index a9d966bd499..cfef50e8255 100644 --- a/homeassistant/components/spider/climate.py +++ b/homeassistant/components/spider/climate.py @@ -9,12 +9,23 @@ import logging from homeassistant.components.climate import ( ATTR_TEMPERATURE, STATE_COOL, STATE_HEAT, STATE_IDLE, - SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE, ClimateDevice) + SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE, + SUPPORT_FAN_MODE, ClimateDevice) from homeassistant.components.spider import DOMAIN as SPIDER_DOMAIN from homeassistant.const import TEMP_CELSIUS DEPENDENCIES = ['spider'] +FAN_LIST = [ + 'Auto', + 'Low', + 'Medium', + 'High', + 'Boost 10', + 'Boost 20', + 'Boost 30' +] + OPERATION_LIST = [ STATE_HEAT, STATE_COOL, @@ -55,7 +66,10 @@ class SpiderThermostat(ClimateDevice): supports = SUPPORT_TARGET_TEMPERATURE if self.thermostat.has_operation_mode: - supports = supports | SUPPORT_OPERATION_MODE + supports |= SUPPORT_OPERATION_MODE + + if self.thermostat.has_fan_mode: + supports |= SUPPORT_FAN_MODE return supports @@ -122,6 +136,20 @@ class SpiderThermostat(ClimateDevice): self.thermostat.set_operation_mode( HA_STATE_TO_SPIDER.get(operation_mode)) + @property + def current_fan_mode(self): + """Return the fan setting.""" + return self.thermostat.current_fan_speed + + def set_fan_mode(self, fan_mode): + """Set fan mode.""" + self.thermostat.set_fan_speed(fan_mode) + + @property + def fan_list(self): + """List of available fan modes.""" + return FAN_LIST + def update(self): """Get the latest data.""" self.thermostat = self.api.get_thermostat(self.unique_id) diff --git a/requirements_all.txt b/requirements_all.txt index c67bebac1a9..9f2f8ec6366 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1573,7 +1573,7 @@ somecomfort==0.5.2 speedtest-cli==2.0.2 # homeassistant.components.spider -spiderpy==1.2.0 +spiderpy==1.3.1 # homeassistant.components.sensor.spotcrime spotcrime==1.0.3