Use climate enums in fibaro (#70649)

pull/70658/head
epenet 2022-04-25 10:59:22 +02:00 committed by GitHub
parent 23c5bd9779
commit 1af7c26741
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 33 deletions

View File

@ -3,20 +3,12 @@ from __future__ import annotations
import logging
from homeassistant.components.climate import (
ENTITY_ID_FORMAT,
ClimateEntity,
ClimateEntityFeature,
)
from homeassistant.components.climate import ENTITY_ID_FORMAT, ClimateEntity
from homeassistant.components.climate.const import (
HVAC_MODE_AUTO,
HVAC_MODE_COOL,
HVAC_MODE_DRY,
HVAC_MODE_FAN_ONLY,
HVAC_MODE_HEAT,
HVAC_MODE_OFF,
PRESET_AWAY,
PRESET_BOOST,
ClimateEntityFeature,
HVACMode,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT
@ -73,30 +65,30 @@ OPMODES_PRESET = {
HA_OPMODES_PRESET = {v: k for k, v in OPMODES_PRESET.items()}
OPMODES_HVAC = {
0: HVAC_MODE_OFF,
1: HVAC_MODE_HEAT,
2: HVAC_MODE_COOL,
3: HVAC_MODE_AUTO,
4: HVAC_MODE_HEAT,
5: HVAC_MODE_AUTO,
6: HVAC_MODE_FAN_ONLY,
7: HVAC_MODE_HEAT,
8: HVAC_MODE_DRY,
9: HVAC_MODE_DRY,
10: HVAC_MODE_AUTO,
11: HVAC_MODE_HEAT,
12: HVAC_MODE_COOL,
13: HVAC_MODE_AUTO,
15: HVAC_MODE_AUTO,
31: HVAC_MODE_HEAT,
0: HVACMode.OFF,
1: HVACMode.HEAT,
2: HVACMode.COOL,
3: HVACMode.AUTO,
4: HVACMode.HEAT,
5: HVACMode.AUTO,
6: HVACMode.FAN_ONLY,
7: HVACMode.HEAT,
8: HVACMode.DRY,
9: HVACMode.DRY,
10: HVACMode.AUTO,
11: HVACMode.HEAT,
12: HVACMode.COOL,
13: HVACMode.AUTO,
15: HVACMode.AUTO,
31: HVACMode.HEAT,
}
HA_OPMODES_HVAC = {
HVAC_MODE_OFF: 0,
HVAC_MODE_HEAT: 1,
HVAC_MODE_COOL: 2,
HVAC_MODE_AUTO: 3,
HVAC_MODE_FAN_ONLY: 6,
HVACMode.OFF: 0,
HVACMode.HEAT: 1,
HVACMode.COOL: 2,
HVACMode.AUTO: 3,
HVACMode.FAN_ONLY: 6,
}
@ -268,7 +260,7 @@ class FibaroThermostat(FibaroDevice, ClimateEntity):
def hvac_modes(self):
"""Return the list of available operation modes."""
if not self._op_mode_device:
return [HVAC_MODE_AUTO] # Default to this
return [HVACMode.AUTO] # Default to this
return self._hvac_support
def set_hvac_mode(self, hvac_mode):