Add support for Built-In AC Unit

Built-In AC unit operation and function is similar to a WAC.
`gehomesdk` version bumped from 0.4.25 to 0.4.27 to include latest
ErdApplianceType enum.
This commit is contained in:
Rob Schmidt 2022-07-10 16:36:26 -07:00
parent 6521021092
commit 207a82937a
7 changed files with 86 additions and 4 deletions

View File

@ -14,7 +14,7 @@ from .update_coordinator import GeHomeUpdateCoordinator
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: Callable): 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') _LOGGER.debug('Adding GE Climate Entities')
coordinator: GeHomeUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id] coordinator: GeHomeUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id]

View File

@ -15,6 +15,7 @@ from .advantium import AdvantiumApi
from .wac import WacApi from .wac import WacApi
from .sac import SacApi from .sac import SacApi
from .pac import PacApi from .pac import PacApi
from .biac import BiacApi
from .hood import HoodApi from .hood import HoodApi
from .microwave import MicrowaveApi from .microwave import MicrowaveApi
from .water_softener import WaterSoftenerApi from .water_softener import WaterSoftenerApi
@ -51,6 +52,8 @@ def get_appliance_api_type(appliance_type: ErdApplianceType) -> Type:
return SacApi return SacApi
if appliance_type == ErdApplianceType.PORTABLE_AIR_CONDITIONER: if appliance_type == ErdApplianceType.PORTABLE_AIR_CONDITIONER:
return PacApi return PacApi
if appliance_type == ErdApplianceType.BUILT_IN_AIR_CONDITIONER:
return BiacApi
if appliance_type == ErdApplianceType.HOOD: if appliance_type == ErdApplianceType.HOOD:
return HoodApi return HoodApi
if appliance_type == ErdApplianceType.MICROWAVE: if appliance_type == ErdApplianceType.MICROWAVE:

View File

@ -0,0 +1,33 @@
import logging
from typing import List
from homeassistant.helpers.entity import Entity
from gehomesdk.erd import ErdCode, ErdApplianceType
from .base import ApplianceApi
from ..entities import GeBiacClimate, GeErdSensor, GeErdBinarySensor, GeErdSwitch, ErdOnOffBoolConverter
_LOGGER = logging.getLogger(__name__)
class BiacApi(ApplianceApi):
"""API class for Built-In AC objects"""
APPLIANCE_TYPE = ErdApplianceType.BUILT_IN_AIR_CONDITIONER
def get_all_entities(self) -> List[Entity]:
base_entities = super().get_all_entities()
biac_entities = [
GeBiacClimate(self),
GeErdSensor(self, ErdCode.AC_TARGET_TEMPERATURE),
GeErdSensor(self, ErdCode.AC_AMBIENT_TEMPERATURE),
GeErdSensor(self, ErdCode.AC_FAN_SETTING, icon_override="mdi:fan"),
GeErdSensor(self, ErdCode.AC_OPERATION_MODE),
GeErdSwitch(self, ErdCode.AC_POWER_STATUS, bool_converter=ErdOnOffBoolConverter(), icon_on_override="mdi:power-on", icon_off_override="mdi:power-off"),
GeErdBinarySensor(self, ErdCode.AC_FILTER_STATUS, device_class_override="problem"),
GeErdSensor(self, ErdCode.WAC_DEMAND_RESPONSE_STATE),
GeErdSensor(self, ErdCode.WAC_DEMAND_RESPONSE_POWER, uom_override="kW"),
]
entities = base_entities + biac_entities
return entities

View File

@ -1,3 +1,4 @@
from .ge_wac_climate import GeWacClimate from .ge_wac_climate import GeWacClimate
from .ge_sac_climate import GeSacClimate from .ge_sac_climate import GeSacClimate
from .ge_pac_climate import GePacClimate 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())

View File

@ -3,7 +3,7 @@
"name": "GE Home (SmartHQ)", "name": "GE Home (SmartHQ)",
"config_flow": true, "config_flow": true,
"documentation": "https://github.com/simbaja/ha_gehome", "documentation": "https://github.com/simbaja/ha_gehome",
"requirements": ["gehomesdk==0.4.25","magicattr==0.1.5","slixmpp==1.7.1"], "requirements": ["gehomesdk==0.4.27","magicattr==0.1.6","slixmpp==1.8.2"],
"codeowners": ["@simbaja"], "codeowners": ["@simbaja"],
"version": "0.6.1" "version": "0.6.1"
} }