Automatic spider supported fan speed and hvac (#58308)

* Automatic fill of supported fan speed and hvac

Automatic fill of supported fan speed and hvac

* Update manifest of spiderpy to 1.5.0

Update manifest of spiderpy to 1.5.0

* Update spiderpy version to 1.5.0 in requirements files

* Code formatted using Black

* Move support fan and hvac values into a class variable

* Move convert to HA value to hvac_modes method

* Log a warning for any invalid operation mode

* Update homeassistant/components/spider/climate.py

Update as suggested by @mivn23

Co-authored-by: mvn23 <schopdiedwaas@gmail.com>

* PR feedback update + dependency update

* Remove logging

Co-authored-by: Bennert <info@bennert.nl>
Co-authored-by: mvn23 <schopdiedwaas@gmail.com>
This commit is contained in:
Peter Nijssen 2021-10-26 11:05:03 +02:00 committed by GitHub
parent 486866b576
commit fd45a07677
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 10 deletions

View file

@ -11,10 +11,6 @@ from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
from .const import DOMAIN
SUPPORT_FAN = ["Auto", "Low", "Medium", "High", "Boost 10", "Boost 20", "Boost 30"]
SUPPORT_HVAC = [HVAC_MODE_HEAT, HVAC_MODE_COOL]
HA_STATE_TO_SPIDER = {
HVAC_MODE_COOL: "Cool",
HVAC_MODE_HEAT: "Heat",
@ -43,6 +39,11 @@ class SpiderThermostat(ClimateEntity):
"""Initialize the thermostat."""
self.api = api
self.thermostat = thermostat
self.support_fan = thermostat.fan_speed_values
self.support_hvac = []
for operation_value in thermostat.operation_values:
if operation_value in SPIDER_STATE_TO_HA:
self.support_hvac.append(SPIDER_STATE_TO_HA[operation_value])
@property
def device_info(self):
@ -109,7 +110,7 @@ class SpiderThermostat(ClimateEntity):
@property
def hvac_modes(self):
"""Return the list of available operation modes."""
return SUPPORT_HVAC
return self.support_hvac
def set_temperature(self, **kwargs):
"""Set new target temperature."""
@ -134,7 +135,7 @@ class SpiderThermostat(ClimateEntity):
@property
def fan_modes(self):
"""List of available fan modes."""
return SUPPORT_FAN
return self.support_fan
def update(self):
"""Get the latest data."""

View file

@ -2,8 +2,8 @@
"domain": "spider",
"name": "Itho Daalderop Spider",
"documentation": "https://www.home-assistant.io/integrations/spider",
"requirements": ["spiderpy==1.4.3"],
"requirements": ["spiderpy==1.6.1"],
"codeowners": ["@peternijssen"],
"config_flow": true,
"iot_class": "cloud_polling"
}
}

View file

@ -2205,7 +2205,7 @@ speak2mary==1.4.0
speedtest-cli==2.1.3
# homeassistant.components.spider
spiderpy==1.4.3
spiderpy==1.6.1
# homeassistant.components.spotify
spotipy==2.18.0

View file

@ -1281,7 +1281,7 @@ speak2mary==1.4.0
speedtest-cli==2.1.3
# homeassistant.components.spider
spiderpy==1.4.3
spiderpy==1.6.1
# homeassistant.components.spotify
spotipy==2.18.0