mirror of https://github.com/simbaja/ha_gehome.git
- initial support for opal ice makers
This commit is contained in:
parent
468a8496db
commit
8c64ef78ce
|
@ -6,6 +6,7 @@
|
|||
- Changed the sensors to use native value/uom
|
||||
- Changed the temperatures to always be natively fahrenheit (API appears to always use this system)
|
||||
- Initial support for Water Softeners (@npentell)
|
||||
- Initial support for Opal Ice Makers (@mbcomer, @knobunc)
|
||||
|
||||
## 0.5.0
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@ from typing import Type
|
|||
|
||||
from gehomesdk.erd import ErdApplianceType
|
||||
|
||||
from custom_components.ge_home.devices.water_softener import WaterSoftenerApi
|
||||
|
||||
from .base import ApplianceApi
|
||||
from .oven import OvenApi
|
||||
from .fridge import FridgeApi
|
||||
|
@ -18,6 +16,8 @@ from .wac import WacApi
|
|||
from .sac import SacApi
|
||||
from .pac import PacApi
|
||||
from .hood import HoodApi
|
||||
from .water_softener import WaterSoftenerApi
|
||||
from .oim import OimApi
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -51,6 +51,8 @@ def get_appliance_api_type(appliance_type: ErdApplianceType) -> Type:
|
|||
return PacApi
|
||||
if appliance_type == ErdApplianceType.HOOD:
|
||||
return HoodApi
|
||||
if appliance_type == ErdApplianceType.OPAL_ICE_MAKER:
|
||||
return OimApi
|
||||
|
||||
# Fallback
|
||||
return ApplianceApi
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
import logging
|
||||
from typing import List
|
||||
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from gehomesdk import (
|
||||
ErdCode,
|
||||
ErdApplianceType,
|
||||
ErdOnOff
|
||||
)
|
||||
|
||||
from .base import ApplianceApi
|
||||
from ..entities import (
|
||||
OimLightLevelOptionsConverter,
|
||||
GeErdSensor,
|
||||
GeErdSelect,
|
||||
GeErdSwitch,
|
||||
ErdOnOffBoolConverter
|
||||
)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class OimApi(ApplianceApi):
|
||||
"""API class for Oven Hood objects"""
|
||||
APPLIANCE_TYPE = ErdApplianceType.HOOD
|
||||
|
||||
def get_all_entities(self) -> List[Entity]:
|
||||
base_entities = super().get_all_entities()
|
||||
|
||||
oim_entities = [
|
||||
GeErdSensor(self, ErdCode.OIM_STATUS),
|
||||
GeErdSensor(self, ErdCode.OIM_FILTER_STATUS),
|
||||
GeErdSelect(self, ErdCode.OIM_LIGHT_LEVEL, OimLightLevelOptionsConverter()),
|
||||
GeErdSwitch(self, ErdCode.OIM_POWER, bool_converter=ErdOnOffBoolConverter(), icon_on_override="mdi:power-on", icon_off_override="mdi:power-off"),
|
||||
]
|
||||
|
||||
entities = base_entities + oim_entities
|
||||
return entities
|
||||
|
|
@ -6,4 +6,5 @@ from .water_filter import *
|
|||
from .advantium import *
|
||||
from .ac import *
|
||||
from .hood import *
|
||||
from .water_softener import *
|
||||
from .water_softener import *
|
||||
from .opal_ice_maker import *
|
|
@ -138,6 +138,10 @@ class GeErdEntity(GeEntity):
|
|||
if self.erd_code_class == ErdCodeClass.FAN:
|
||||
return "mdi:fan"
|
||||
if self.erd_code_class == ErdCodeClass.LIGHT:
|
||||
return "mdi:lightbulb"
|
||||
return "mdi:lightbulb"
|
||||
if self.erd_code_class == ErdCodeClass.OIM_SENSOR:
|
||||
return "mdi:snowflake"
|
||||
if self.erd_code_class == ErdCodeClass.WATERSOFTENER_SENSOR:
|
||||
return "mdi:water"
|
||||
|
||||
return None
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
from .oim_light_level_options import OimLightLevelOptionsConverter
|
|
@ -0,0 +1,26 @@
|
|||
import logging
|
||||
from typing import List, Any, Optional
|
||||
|
||||
from gehomesdk import ErdCodeType, ErdOimLightLevel, ErdCode
|
||||
from ...devices import ApplianceApi
|
||||
from ..common import GeErdSelect, OptionsConverter
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
class OimLightLevelOptionsConverter(OptionsConverter):
|
||||
@property
|
||||
def options(self) -> List[str]:
|
||||
return [i.stringify() for i in ErdOimLightLevel]
|
||||
def from_option_string(self, value: str) -> Any:
|
||||
try:
|
||||
return ErdOimLightLevel[value.upper()]
|
||||
except:
|
||||
_LOGGER.warn(f"Could not set hood light level to {value.upper()}")
|
||||
return ErdOimLightLevel.OFF
|
||||
def to_option_string(self, value: ErdOimLightLevel) -> Optional[str]:
|
||||
try:
|
||||
if value is not None:
|
||||
return value.stringify()
|
||||
except:
|
||||
pass
|
||||
return ErdOimLightLevel.OFF.stringify()
|
Loading…
Reference in New Issue