mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 19:57:07 +00:00
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:
parent
486866b576
commit
fd45a07677
@ -11,10 +11,6 @@ from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
|
|||||||
|
|
||||||
from .const import DOMAIN
|
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 = {
|
HA_STATE_TO_SPIDER = {
|
||||||
HVAC_MODE_COOL: "Cool",
|
HVAC_MODE_COOL: "Cool",
|
||||||
HVAC_MODE_HEAT: "Heat",
|
HVAC_MODE_HEAT: "Heat",
|
||||||
@ -43,6 +39,11 @@ class SpiderThermostat(ClimateEntity):
|
|||||||
"""Initialize the thermostat."""
|
"""Initialize the thermostat."""
|
||||||
self.api = api
|
self.api = api
|
||||||
self.thermostat = thermostat
|
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
|
@property
|
||||||
def device_info(self):
|
def device_info(self):
|
||||||
@ -109,7 +110,7 @@ class SpiderThermostat(ClimateEntity):
|
|||||||
@property
|
@property
|
||||||
def hvac_modes(self):
|
def hvac_modes(self):
|
||||||
"""Return the list of available operation modes."""
|
"""Return the list of available operation modes."""
|
||||||
return SUPPORT_HVAC
|
return self.support_hvac
|
||||||
|
|
||||||
def set_temperature(self, **kwargs):
|
def set_temperature(self, **kwargs):
|
||||||
"""Set new target temperature."""
|
"""Set new target temperature."""
|
||||||
@ -134,7 +135,7 @@ class SpiderThermostat(ClimateEntity):
|
|||||||
@property
|
@property
|
||||||
def fan_modes(self):
|
def fan_modes(self):
|
||||||
"""List of available fan modes."""
|
"""List of available fan modes."""
|
||||||
return SUPPORT_FAN
|
return self.support_fan
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Get the latest data."""
|
"""Get the latest data."""
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"domain": "spider",
|
"domain": "spider",
|
||||||
"name": "Itho Daalderop Spider",
|
"name": "Itho Daalderop Spider",
|
||||||
"documentation": "https://www.home-assistant.io/integrations/spider",
|
"documentation": "https://www.home-assistant.io/integrations/spider",
|
||||||
"requirements": ["spiderpy==1.4.3"],
|
"requirements": ["spiderpy==1.6.1"],
|
||||||
"codeowners": ["@peternijssen"],
|
"codeowners": ["@peternijssen"],
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"iot_class": "cloud_polling"
|
"iot_class": "cloud_polling"
|
||||||
|
@ -2205,7 +2205,7 @@ speak2mary==1.4.0
|
|||||||
speedtest-cli==2.1.3
|
speedtest-cli==2.1.3
|
||||||
|
|
||||||
# homeassistant.components.spider
|
# homeassistant.components.spider
|
||||||
spiderpy==1.4.3
|
spiderpy==1.6.1
|
||||||
|
|
||||||
# homeassistant.components.spotify
|
# homeassistant.components.spotify
|
||||||
spotipy==2.18.0
|
spotipy==2.18.0
|
||||||
|
@ -1281,7 +1281,7 @@ speak2mary==1.4.0
|
|||||||
speedtest-cli==2.1.3
|
speedtest-cli==2.1.3
|
||||||
|
|
||||||
# homeassistant.components.spider
|
# homeassistant.components.spider
|
||||||
spiderpy==1.4.3
|
spiderpy==1.6.1
|
||||||
|
|
||||||
# homeassistant.components.spotify
|
# homeassistant.components.spotify
|
||||||
spotipy==2.18.0
|
spotipy==2.18.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user