mirror of https://github.com/simbaja/ha_gehome.git
- sensor configuration updates
This commit is contained in:
parent
ebd50d10de
commit
1374b3629e
|
@ -22,7 +22,7 @@ class DishwasherApi(ApplianceApi):
|
|||
GeErdSensor(self, ErdCode.CYCLE_STATE),
|
||||
GeErdSensor(self, ErdCode.OPERATING_MODE),
|
||||
GeErdSensor(self, ErdCode.PODS_REMAINING_VALUE),
|
||||
GeErdSensor(self, ErdCode.RINSE_AGENT),
|
||||
GeErdSensor(self, ErdCode.RINSE_AGENT, icon_override="mdi:sparkle"),
|
||||
GeErdSensor(self, ErdCode.TIME_REMAINING),
|
||||
]
|
||||
entities = base_entities + dishwasher_entities
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from homeassistant.components.binary_sensor import DEVICE_CLASS_PROBLEM
|
||||
from homeassistant.const import DEVICE_CLASS_TEMPERATURE
|
||||
import logging
|
||||
from typing import List
|
||||
|
||||
|
@ -5,7 +7,15 @@ from homeassistant.helpers.entity import Entity
|
|||
from gekitchen.erd import ErdCode, ErdApplianceType
|
||||
|
||||
from .base import ApplianceApi
|
||||
from ..entities import GeErdSensor, GeErdSwitch, GeFridgeEntity, GeFreezerEntity
|
||||
from ..entities import (
|
||||
GeErdSensor,
|
||||
GeErdSwitch,
|
||||
GeFridge,
|
||||
GeFreezer,
|
||||
GeDispenser,
|
||||
GeErdPropertySensor,
|
||||
GeErdPropertyBinarySensor
|
||||
)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -15,17 +25,38 @@ class FridgeApi(ApplianceApi):
|
|||
|
||||
def get_all_entities(self) -> List[Entity]:
|
||||
base_entities = super().get_all_entities()
|
||||
|
||||
fridge_entities = []
|
||||
freezer_entities = []
|
||||
dispenser_entities = []
|
||||
|
||||
fridge_entities = [
|
||||
GeErdSensor(self, ErdCode.AIR_FILTER_STATUS),
|
||||
GeErdSensor(self, ErdCode.DOOR_STATUS),
|
||||
common_entities = [
|
||||
GeErdSensor(self, ErdCode.FRIDGE_MODEL_INFO),
|
||||
GeErdSwitch(self, ErdCode.SABBATH_MODE),
|
||||
GeErdSensor(self, ErdCode.DOOR_STATUS),
|
||||
GeErdPropertyBinarySensor(self, ErdCode.DOOR_STATUS, "any_open")
|
||||
]
|
||||
|
||||
fridge_entities.extend([
|
||||
GeErdSensor(self, ErdCode.WATER_FILTER_STATUS),
|
||||
GeErdPropertySensor(self, ErdCode.CURRENT_TEMPERATURE, "fridge"),
|
||||
GeFridge(self),
|
||||
])
|
||||
|
||||
freezer_entities.extend([
|
||||
GeErdPropertySensor(self, ErdCode.CURRENT_TEMPERATURE, "freezer"),
|
||||
GeFreezer(self),
|
||||
])
|
||||
|
||||
dispenser_entities.extend([
|
||||
GeErdSensor(self, ErdCode.HOT_WATER_IN_USE),
|
||||
GeErdSensor(self, ErdCode.HOT_WATER_SET_TEMP),
|
||||
GeErdSensor(self, ErdCode.HOT_WATER_STATUS),
|
||||
GeErdSwitch(self, ErdCode.SABBATH_MODE),
|
||||
GeFreezerEntity(self),
|
||||
GeFridgeEntity(self),
|
||||
]
|
||||
entities = base_entities + fridge_entities
|
||||
GeErdPropertySensor(self, ErdCode.HOT_WATER_STATUS, "status"),
|
||||
GeErdPropertySensor(self, ErdCode.HOT_WATER_STATUS, "time_remaining", icon_override="mdi:timer-outline"),
|
||||
GeErdPropertySensor(self, ErdCode.HOT_WATER_STATUS, "time_remaining", device_class_override=DEVICE_CLASS_TEMPERATURE),
|
||||
GeErdPropertyBinarySensor(self, ErdCode.HOT_WATER_STATUS, "faulted", device_class_override=DEVICE_CLASS_PROBLEM),
|
||||
GeDispenser(self)
|
||||
])
|
||||
|
||||
entities = base_entities + common_entities + fridge_entities + freezer_entities + dispenser_entities
|
||||
return entities
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import logging
|
||||
from typing import List
|
||||
|
||||
from homeassistant.const import DEVICE_CLASS_POWER_FACTOR
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from gekitchen import (
|
||||
ErdCode,
|
||||
|
@ -16,7 +17,6 @@ from ..entities import (
|
|||
GeErdBinarySensor,
|
||||
GeErdPropertyBinarySensor,
|
||||
GeOven,
|
||||
GeErdCooktopBurnerSensor,
|
||||
UPPER_OVEN,
|
||||
LOWER_OVEN
|
||||
)
|
||||
|
@ -76,7 +76,7 @@ class OvenApi(ApplianceApi):
|
|||
cooktop_entities.append(GeErdPropertyBinarySensor(self, ErdCode.COOKTOP_STATUS, k+".on"))
|
||||
cooktop_entities.append(GeErdPropertyBinarySensor(self, ErdCode.COOKTOP_STATUS, k+".synchronized"))
|
||||
if not v.on_off_only:
|
||||
cooktop_entities.append(GeErdCooktopBurnerSensor(self, ErdCode.COOKTOP_STATUS, k+".power_pct"))
|
||||
cooktop_entities.append(GeErdSensor(self, ErdCode.COOKTOP_STATUS, k+".power_pct", icon_override="mdi:fire", device_class_override=DEVICE_CLASS_POWER_FACTOR))
|
||||
|
||||
return base_entities + oven_entities + cooktop_entities
|
||||
|
||||
|
|
|
@ -81,6 +81,8 @@ class GeErdEntity(GeEntity):
|
|||
return None
|
||||
if self.erd_code_class == ErdCodeClass.CLOCK:
|
||||
return "mdi:clock"
|
||||
if self.erd_code_class == ErdCodeClass.COUNTER:
|
||||
return "mdi:counter"
|
||||
if self.erd_code_class == ErdCodeClass.DOOR:
|
||||
return "mdi:door"
|
||||
if self.erd_code_class == ErdCodeClass.TIMER:
|
||||
|
|
|
@ -47,3 +47,11 @@ class GeErdSensor(GeErdEntity, Entity):
|
|||
return DEVICE_CLASS_BATTERY
|
||||
|
||||
return None
|
||||
|
||||
def _get_icon(self):
|
||||
if self.erd_code_class == ErdCodeClass.DOOR:
|
||||
if self.state.lower().endswith("open"):
|
||||
return "mdi:door-open"
|
||||
if self.state.lower().endswith("closed"):
|
||||
return "mdi:door-closed"
|
||||
return super()._get_icon()
|
|
@ -1,3 +1,2 @@
|
|||
from .ge_oven import GeOven
|
||||
from .ge_erd_cooktop_burner_sensor import GeErdCooktopBurnerSensor
|
||||
from .const import UPPER_OVEN, LOWER_OVEN
|
|
@ -1,13 +0,0 @@
|
|||
from typing import Optional
|
||||
from ..common import GeErdPropertySensor
|
||||
|
||||
class GeErdCooktopBurnerSensor(GeErdPropertySensor):
|
||||
icon = "mdi:fire"
|
||||
|
||||
@property
|
||||
def units(self) -> Optional[str]:
|
||||
return "%"
|
||||
|
||||
@property
|
||||
def device_class(self) -> Optional[str]:
|
||||
return "power_factor"
|
Loading…
Reference in New Issue