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
|
||||
|
@ -69,4 +69,4 @@ Please click [here](CHANGELOG.md) for change information.
|
|||
[license-shield]: https://img.shields.io/github/license/simbaja/ha_gehome.svg?style=for-the-badge
|
||||
[maintenance-shield]: https://img.shields.io/badge/maintainer-Jack%20Simbach%20%40simbaja-blue.svg?style=for-the-badge
|
||||
[releases-shield]: https://img.shields.io/github/release/simbaja/ha_gehome.svg?style=for-the-badge
|
||||
[releases]: https://github.com/simbaja/ha_gehome/releases
|
||||
[releases]: https://github.com/simbaja/ha_gehome/releases
|
||||
|
|
|
@ -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]:
|
||||
|
@ -31,4 +32,4 @@ class BiacApi(ApplianceApi):
|
|||
|
||||
entities = base_entities + sac_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"
|
||||
|
|
Loading…
Reference in New Issue