mirror of https://github.com/simbaja/ha_gehome.git
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:
parent
6521021092
commit
207a82937a
|
@ -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]
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ from .advantium import AdvantiumApi
|
|||
from .wac import WacApi
|
||||
from .sac import SacApi
|
||||
from .pac import PacApi
|
||||
from .biac import BiacApi
|
||||
from .hood import HoodApi
|
||||
from .microwave import MicrowaveApi
|
||||
from .water_softener import WaterSoftenerApi
|
||||
|
@ -51,6 +52,8 @@ def get_appliance_api_type(appliance_type: ErdApplianceType) -> Type:
|
|||
return SacApi
|
||||
if appliance_type == ErdApplianceType.PORTABLE_AIR_CONDITIONER:
|
||||
return PacApi
|
||||
if appliance_type == ErdApplianceType.BUILT_IN_AIR_CONDITIONER:
|
||||
return BiacApi
|
||||
if appliance_type == ErdApplianceType.HOOD:
|
||||
return HoodApi
|
||||
if appliance_type == ErdApplianceType.MICROWAVE:
|
||||
|
|
|
@ -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
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
from .ge_wac_climate import GeWacClimate
|
||||
from .ge_sac_climate import GeSacClimate
|
||||
from .ge_pac_climate import GePacClimate
|
||||
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())
|
|
@ -191,4 +191,4 @@ class GeClimate(GeEntity, ClimateEntity):
|
|||
return (temperature_f - 32.0) * (5/9)
|
||||
|
||||
def _get_icon(self) -> Optional[str]:
|
||||
return "mdi:air-conditioner"
|
||||
return "mdi:air-conditioner"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"name": "GE Home (SmartHQ)",
|
||||
"config_flow": true,
|
||||
"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"],
|
||||
"version": "0.6.1"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue