mirror of https://github.com/simbaja/ha_gehome.git
Merge branch 'dev' of https://github.com/simbaja/ha_components into dev
This commit is contained in:
commit
fc5e962016
|
@ -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
|
||||
|
|
|
@ -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]
|
||||
|
||||
|
|
|
@ -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]:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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())
|
Loading…
Reference in New Issue