This commit is contained in:
Jack Simbach 2022-07-23 11:03:24 -04:00
commit fc5e962016
6 changed files with 54 additions and 7 deletions

View File

@ -13,7 +13,7 @@ Integration for GE WiFi-enabled appliances into Home Assistant. This integratio
- Laundry (Washer/Dryer)
- Whole Home Water Filter
- Whole Home Water Softener
- A/C (Portable, Split, Window)
- A/C (Portable, Split, Window, Built-In)
- Range Hood
- Advantium
- Microwave

View File

@ -14,7 +14,7 @@ from .update_coordinator import GeHomeUpdateCoordinator
_LOGGER = logging.getLogger(__name__)
async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: Callable):
"""GE Home Water Heaters."""
"""GE Climate Devices."""
_LOGGER.debug('Adding GE Climate Entities')
coordinator: GeHomeUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id]

View File

@ -7,11 +7,12 @@ from gehomesdk.erd import ErdCode, ErdApplianceType
from .base import ApplianceApi
from ..entities import GeSacClimate, GeErdSensor, GeErdSwitch, ErdOnOffBoolConverter, GeErdBinarySensor
_LOGGER = logging.getLogger(__name__)
class BiacApi(ApplianceApi):
"""API class for Built-in AC objects"""
"""API class for Built-In AC objects"""
APPLIANCE_TYPE = ErdApplianceType.BUILT_IN_AIR_CONDITIONER
def get_all_entities(self) -> List[Entity]:

View File

@ -1,3 +1,4 @@
from .ge_wac_climate import GeWacClimate
from .ge_sac_climate import GeSacClimate
from .ge_pac_climate import GePacClimate
from .ge_biac_climate import GeBiacClimate

View File

@ -0,0 +1,45 @@
import logging
from typing import Any, List, Optional
from homeassistant.components.climate.const import (
HVAC_MODE_AUTO,
HVAC_MODE_COOL,
HVAC_MODE_FAN_ONLY,
)
from gehomesdk import ErdAcOperationMode
from ...devices import ApplianceApi
from ..common import GeClimate, OptionsConverter
from .fan_mode_options import AcFanModeOptionsConverter, AcFanOnlyFanModeOptionsConverter
_LOGGER = logging.getLogger(__name__)
class BiacHvacModeOptionsConverter(OptionsConverter):
@property
def options(self) -> List[str]:
return [HVAC_MODE_AUTO, HVAC_MODE_COOL, HVAC_MODE_FAN_ONLY]
def from_option_string(self, value: str) -> Any:
try:
return {
HVAC_MODE_AUTO: ErdAcOperationMode.ENERGY_SAVER,
HVAC_MODE_COOL: ErdAcOperationMode.COOL,
HVAC_MODE_FAN_ONLY: ErdAcOperationMode.FAN_ONLY
}.get(value)
except:
_LOGGER.warn(f"Could not set HVAC mode to {value.upper()}")
return ErdAcOperationMode.COOL
def to_option_string(self, value: Any) -> Optional[str]:
try:
return {
ErdAcOperationMode.ENERGY_SAVER: HVAC_MODE_AUTO,
ErdAcOperationMode.AUTO: HVAC_MODE_AUTO,
ErdAcOperationMode.COOL: HVAC_MODE_COOL,
ErdAcOperationMode.FAN_ONLY: HVAC_MODE_FAN_ONLY
}.get(value)
except:
_LOGGER.warn(f"Could not determine operation mode mapping for {value}")
return HVAC_MODE_COOL
class GeBiacClimate(GeClimate):
"""Class for Built-In AC units"""
def __init__(self, api: ApplianceApi):
super().__init__(api, BiacHvacModeOptionsConverter(), AcFanModeOptionsConverter(), AcFanOnlyFanModeOptionsConverter())