Skip to content

Commit

Permalink
v0.6.8 Develop -> Main (#194)
Browse files Browse the repository at this point in the history
* - updated water heater naming

* - initial support for built-in AC units

* 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.

* Update README.md

Update README.md to include Built-In AC as supported device

* - updated zero serial number detection (resolves #89)

* - updated version
- updated changelog

* - hopefully fixed recursion bug with numbers

* - added cooktop support

* - fixed circular reference

* Add support for fridges with reduced support for ERD codes (no turbo mode, no current temperature reporting, no temperature setpoint limit reporting, no door status reporting). This change has been tested on a Fisher & Paykel RF610AA.

* - added dual dishwasher support
- updated documentation
- version bumps

* - added water heater support

* - added basic espresso maker device

* - bugfixes

* - rewrote initialization (resolves #99)

* - added logic to prevent double registration of entities

* - added correct min/max temps for water heaters

* Fix CoffeeMaker after the NumberEntity refactoring

* - added fix for CGY366P2TS1 (#116) to try to get the cooktop status, but fail more gracefully if it isn't supported

* - fixed region setting in update coordinator

* - version bump
- doc update
- string fixes

* - updated the temperature conversion to use non-deprecated HASS methods

* - updated documentation (@gleepwurp)

* - more documentation updates

* - updated dishwasher for new functionality
- updated documentation

* updated uom for liquid volume per HA specifications

* - fixed typo in oven (#149)

* - updated change log
- fixed oven light control (#144)

* - fixed issues with dishwasher (#155)
- added oim descaling sensor (#154)
- version bump

* - updated change log

* updated dual dishwasher for changes to gehomesdk (#161)

Co-authored-by: na4ma4 <[email protected]>

* await disconnect when unloading (#169)

Fixes #164.

* Check for upper oven light when there is a lower oven (#174)

Resolves issue #121

* - added oven warming drawers
- simplified oven entity logic

* - fixed issues with the new oven initialization logic

* - fixed bad type import for warming drawer

* -added iot class (#181)

* - updated the gehomesdk version requirement

* - gehomesdk version bump

* - added dehumidifier (#114)

* - dehumidifier appliance type fix

* - added oven state sensors (#175)

* - updated change logs
- updated sdk version requirement

* - removed target select
- added dehumidifier entity
- sdk version bump

* - updated dehumidifier icon

* - added humidifier platform

* - fixed typos in humidifier class

* - fixed copy/paste error

* - sdk version requirement bump

* - sdk version bump

* - updated dehumidifier to handle target precision
- updated dehumidifier sensor value conversion

* - missed a commit

* - SDK version bump

---------

Co-authored-by: Rob Schmidt <[email protected]>
Co-authored-by: Federico Sevilla <[email protected]>
Co-authored-by: alexanv1 <[email protected]>
Co-authored-by: na4ma4 <[email protected]>
Co-authored-by: na4ma4 <[email protected]>
Co-authored-by: Alex Peters <[email protected]>
Co-authored-by: Chris Petersen <[email protected]>
  • Loading branch information
8 people authored Sep 10, 2023
1 parent 3ad1350 commit 3b6e657
Show file tree
Hide file tree
Showing 21 changed files with 502 additions and 42 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@

# GE Home Appliances (SmartHQ) Changelog

## 0.6.8

- Added Dehumidifier [#114]
- Added oven drawer sensors
- Added oven current state sensors [#175]
- Added descriptors to manifest [#181]
- Bugfix: Fixed issue with oven lights [#174]
- Bugfix: Fixed issues with dual dishwasher [#161]
- Bugfix: Fixed disconnection issue [#169]


## 0.6.7

- Bugfix: fixed issues with dishwasher [#155]
Expand Down
4 changes: 3 additions & 1 deletion custom_components/ge_home/devices/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from .coffee_maker import CcmApi
from .dual_dishwasher import DualDishwasherApi
from .espresso_maker import EspressoMakerApi

from .dehumidifier import DehumidifierApi

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -77,6 +77,8 @@ def get_appliance_api_type(appliance_type: ErdApplianceType) -> Type:
return CcmApi
if appliance_type == ErdApplianceType.ESPRESSO_MAKER:
return EspressoMakerApi
if appliance_type == ErdApplianceType.DEHUMIDIFIER:
return DehumidifierApi

# Fallback
return ApplianceApi
44 changes: 44 additions & 0 deletions custom_components/ge_home/devices/dehumidifier.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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 (
GeErdSensor,
GeErdSelect,
GeErdPropertySensor,
GeErdSwitch,
ErdOnOffBoolConverter,
GeDehumidifierFanSpeedSensor,
GeDehumidifier
)

_LOGGER = logging.getLogger(__name__)


class DehumidifierApi(ApplianceApi):
"""API class for Dehumidifier objects"""
APPLIANCE_TYPE = ErdApplianceType.DEHUMIDIFIER

def get_all_entities(self) -> List[Entity]:
base_entities = super().get_all_entities()

dhum_entities = [
GeErdSwitch(self, ErdCode.AC_POWER_STATUS, bool_converter=ErdOnOffBoolConverter(), icon_on_override="mdi:power-on", icon_off_override="mdi:power-off"),
GeDehumidifierFanSpeedSensor(self, ErdCode.AC_FAN_SETTING, icon_override="mdi:fan"),
GeErdSensor(self, ErdCode.DHUM_CURRENT_HUMIDITY),
GeErdSensor(self, ErdCode.DHUM_TARGET_HUMIDITY),
GeErdPropertySensor(self, ErdCode.DHUM_MAINTENANCE, "empty_bucket", device_class_override="problem"),
GeErdPropertySensor(self, ErdCode.DHUM_MAINTENANCE, "clean_filter", device_class_override="problem"),
GeDehumidifier(self)
]

entities = base_entities + dhum_entities
return entities

18 changes: 14 additions & 4 deletions custom_components/ge_home/devices/dual_dishwasher.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,23 @@ def get_all_entities(self) -> List[Entity]:

lower_entities = [
GeErdSensor(self, ErdCode.DISHWASHER_CYCLE_STATE, erd_override="lower_cycle_state", icon_override="mdi:state-machine"),
GeErdSensor(self, ErdCode.DISHWASHER_RINSE_AGENT, erd_override="lower_rinse_agent", icon_override="mdi:shimmer"),
GeErdSensor(self, ErdCode.DISHWASHER_TIME_REMAINING, erd_override="lower_time_remaining"),
GeErdBinarySensor(self, ErdCode.DISHWASHER_DOOR_STATUS, erd_override="lower_door_status"),

#Reminders
GeErdPropertySensor(self, ErdCode.DISHWASHER_REMINDERS, "add_rinse_aid", erd_override="lower_reminder", icon_override="mdi:shimmer"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_REMINDERS, "clean_filter", erd_override="lower_reminder", icon_override="mdi:dishwasher-alert"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_REMINDERS, "sanitized", erd_override="lower_reminder", icon_override="mdi:silverware-clean"),

#User Setttings
GeErdPropertySensor(self, ErdCode.DISHWASHER_USER_SETTING, "sound", erd_override="lower_setting", icon_override="mdi:volume-high"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_USER_SETTING, "mute", erd_override="lower_setting", icon_override="mdi:volume-mute"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_USER_SETTING, "lock_control", erd_override="lower_setting", icon_override="mdi:lock"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_USER_SETTING, "sabbath", erd_override="lower_setting", icon_override="mdi:star-david"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_USER_SETTING, "cycle_mode", erd_override="lower_setting", icon_override="mdi:state-machine"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_USER_SETTING, "presoak", erd_override="lower_setting", icon_override="mdi:water"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_USER_SETTING, "bottle_jet", erd_override="lower_setting", icon_override="mdi:bottle-tonic-outline"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_USER_SETTING, "wash_temp", erd_override="lower_setting", icon_override="mdi:coolant-temperature"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_USER_SETTING, "rinse_aid", erd_override="lower_setting", icon_override="mdi:shimmer"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_USER_SETTING, "dry_option", erd_override="lower_setting", icon_override="mdi:fan"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_USER_SETTING, "wash_zone", erd_override="lower_setting", icon_override="mdi:dock-top"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_USER_SETTING, "delay_hours", erd_override="lower_setting", icon_override="mdi:clock-fast")
Expand All @@ -39,18 +44,23 @@ def get_all_entities(self) -> List[Entity]:
upper_entities = [
#GeDishwasherControlLockedSwitch(self, ErdCode.USER_INTERFACE_LOCKED),
GeErdSensor(self, ErdCode.DISHWASHER_UPPER_CYCLE_STATE, erd_override="upper_cycle_state", icon_override="mdi:state-machine"),
GeErdSensor(self, ErdCode.DISHWASHER_UPPER_RINSE_AGENT, erd_override="upper_rinse_agent", icon_override="mdi:shimmer"),
GeErdSensor(self, ErdCode.DISHWASHER_UPPER_TIME_REMAINING, erd_override="upper_time_remaining"),
GeErdBinarySensor(self, ErdCode.DISHWASHER_UPPER_DOOR_STATUS, erd_override="upper_door_status"),

#Reminders
GeErdPropertySensor(self, ErdCode.DISHWASHER_UPPER_REMINDERS, "add_rinse_aid", erd_override="upper_reminder", icon_override="mdi:shimmer"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_UPPER_REMINDERS, "clean_filter", erd_override="upper_reminder", icon_override="mdi:dishwasher-alert"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_UPPER_REMINDERS, "sanitized", erd_override="upper_reminder", icon_override="mdi:silverware-clean"),

#User Setttings
GeErdPropertySensor(self, ErdCode.DISHWASHER_UPPER_USER_SETTING, "sound", erd_override="upper_setting", icon_override="mdi:volume-high"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_UPPER_USER_SETTING, "mute", erd_override="upper_setting", icon_override="mdi:volume-mute"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_UPPER_USER_SETTING, "lock_control", erd_override="upper_setting", icon_override="mdi:lock"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_UPPER_USER_SETTING, "sabbath", erd_override="upper_setting", icon_override="mdi:star-david"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_UPPER_USER_SETTING, "cycle_mode", erd_override="upper_setting", icon_override="mdi:state-machine"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_UPPER_USER_SETTING, "presoak", erd_override="upper_setting", icon_override="mdi:water"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_UPPER_USER_SETTING, "bottle_jet", erd_override="upper_setting", icon_override="mdi:bottle-tonic-outline"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_UPPER_USER_SETTING, "wash_temp", erd_override="upper_setting", icon_override="mdi:coolant-temperature"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_UPPER_USER_SETTING, "rinse_aid", erd_override="upper_setting", icon_override="mdi:shimmer"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_UPPER_USER_SETTING, "dry_option", erd_override="upper_setting", icon_override="mdi:fan"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_UPPER_USER_SETTING, "wash_zone", erd_override="upper_setting", icon_override="mdi:dock-top"),
GeErdPropertySensor(self, ErdCode.DISHWASHER_UPPER_USER_SETTING, "delay_hours", erd_override="upper_setting", icon_override="mdi:clock-fast")
Expand Down
70 changes: 40 additions & 30 deletions custom_components/ge_home/devices/oven.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
ErdCooktopConfig,
CooktopStatus,
ErdOvenLightLevel,
ErdOvenLightLevelAvailability
ErdOvenLightLevelAvailability,
ErdOvenWarmingState
)

from .base import ApplianceApi
Expand All @@ -23,6 +24,7 @@
GeErdPropertyBinarySensor,
GeOven,
GeOvenLightLevelSelect,
GeOvenWarmingStateSelect,
UPPER_OVEN,
LOWER_OVEN
)
Expand All @@ -49,51 +51,54 @@ def get_all_entities(self) -> List[Entity]:
lower_light : ErdOvenLightLevel = self.try_get_erd_value(ErdCode.LOWER_OVEN_LIGHT)
lower_light_availability: ErdOvenLightLevelAvailability = self.try_get_erd_value(ErdCode.LOWER_OVEN_LIGHT_AVAILABILITY)

upper_warm_drawer : ErdOvenWarmingState = self.try_get_erd_value(ErdCode.UPPER_OVEN_WARMING_DRAWER_STATE)
lower_warm_drawer : ErdOvenWarmingState = self.try_get_erd_value(ErdCode.LOWER_OVEN_WARMING_DRAWER_STATE)
warm_drawer : ErdOvenWarmingState = self.try_get_erd_value(ErdCode.WARMING_DRAWER_STATE)

_LOGGER.debug(f"Oven Config: {oven_config}")
_LOGGER.debug(f"Cooktop Config: {cooktop_config}")
oven_entities = []
cooktop_entities = []

if oven_config.has_lower_oven:
oven_entities.extend([
GeErdSensor(self, ErdCode.UPPER_OVEN_COOK_MODE),
GeErdSensor(self, ErdCode.UPPER_OVEN_COOK_TIME_REMAINING),
GeErdTimerSensor(self, ErdCode.UPPER_OVEN_KITCHEN_TIMER),
GeErdSensor(self, ErdCode.UPPER_OVEN_USER_TEMP_OFFSET),
GeErdSensor(self, ErdCode.UPPER_OVEN_DISPLAY_TEMPERATURE),
GeErdBinarySensor(self, ErdCode.UPPER_OVEN_REMOTE_ENABLED),

GeErdSensor(self, ErdCode.LOWER_OVEN_COOK_MODE),
GeErdSensor(self, ErdCode.LOWER_OVEN_CURRENT_STATE),
GeErdSensor(self, ErdCode.LOWER_OVEN_COOK_TIME_REMAINING),
GeErdTimerSensor(self, ErdCode.LOWER_OVEN_KITCHEN_TIMER),
GeErdSensor(self, ErdCode.LOWER_OVEN_USER_TEMP_OFFSET),
GeErdSensor(self, ErdCode.LOWER_OVEN_DISPLAY_TEMPERATURE),
GeErdBinarySensor(self, ErdCode.LOWER_OVEN_REMOTE_ENABLED),

GeOven(self, LOWER_OVEN, True, self._temperature_code(has_lower_raw_temperature)),
GeOven(self, UPPER_OVEN, True, self._temperature_code(has_upper_raw_temperature)),
GeOven(self, LOWER_OVEN, True, self._temperature_code(has_lower_raw_temperature))
])
if has_upper_raw_temperature:
oven_entities.append(GeErdSensor(self, ErdCode.UPPER_OVEN_RAW_TEMPERATURE))
if has_lower_raw_temperature:
oven_entities.append(GeErdSensor(self, ErdCode.LOWER_OVEN_RAW_TEMPERATURE))
if lower_light_availability is None or lower_light_availability.is_available or lower_light is not None:
oven_entities.append(GeOvenLightLevelSelect(self, ErdCode.LOWER_OVEN_LIGHT))
else:
oven_entities.extend([
GeErdSensor(self, ErdCode.UPPER_OVEN_COOK_MODE, self._single_name(ErdCode.UPPER_OVEN_COOK_MODE)),
GeErdSensor(self, ErdCode.UPPER_OVEN_COOK_TIME_REMAINING, self._single_name(ErdCode.UPPER_OVEN_COOK_TIME_REMAINING)),
GeErdTimerSensor(self, ErdCode.UPPER_OVEN_KITCHEN_TIMER, self._single_name(ErdCode.UPPER_OVEN_KITCHEN_TIMER)),
GeErdSensor(self, ErdCode.UPPER_OVEN_USER_TEMP_OFFSET, self._single_name(ErdCode.UPPER_OVEN_USER_TEMP_OFFSET)),
GeErdSensor(self, ErdCode.UPPER_OVEN_DISPLAY_TEMPERATURE, self._single_name(ErdCode.UPPER_OVEN_DISPLAY_TEMPERATURE)),
GeErdBinarySensor(self, ErdCode.UPPER_OVEN_REMOTE_ENABLED, self._single_name(ErdCode.UPPER_OVEN_REMOTE_ENABLED)),
GeOven(self, UPPER_OVEN, False, self._temperature_code(has_upper_raw_temperature))
])
if has_upper_raw_temperature:
oven_entities.append(GeErdSensor(self, ErdCode.UPPER_OVEN_RAW_TEMPERATURE, self._single_name(ErdCode.UPPER_OVEN_RAW_TEMPERATURE)))
if upper_light_availability is None or upper_light_availability.is_available or upper_light is not None:
oven_entities.append(GeOvenLightLevelSelect(self, ErdCode.UPPER_OVEN_LIGHT, self._single_name(ErdCode.UPPER_OVEN_LIGHT)))

if lower_warm_drawer is not None:
oven_entities.append(GeOvenWarmingStateSelect(self, ErdCode.LOWER_OVEN_WARMING_DRAWER_STATE))

oven_entities.extend([
GeErdSensor(self, ErdCode.UPPER_OVEN_COOK_MODE, self._single_name(ErdCode.UPPER_OVEN_COOK_MODE, ~oven_config.has_lower_oven)),
GeErdSensor(self, ErdCode.UPPER_OVEN_CURRENT_STATE, self._single_name(ErdCode.UPPER_OVEN_CURRENT_STATE, ~oven_config.has_lower_oven)),
GeErdSensor(self, ErdCode.UPPER_OVEN_COOK_TIME_REMAINING, self._single_name(ErdCode.UPPER_OVEN_COOK_TIME_REMAINING, ~oven_config.has_lower_oven)),
GeErdTimerSensor(self, ErdCode.UPPER_OVEN_KITCHEN_TIMER, self._single_name(ErdCode.UPPER_OVEN_KITCHEN_TIMER, ~oven_config.has_lower_oven)),
GeErdSensor(self, ErdCode.UPPER_OVEN_USER_TEMP_OFFSET, self._single_name(ErdCode.UPPER_OVEN_USER_TEMP_OFFSET, ~oven_config.has_lower_oven)),
GeErdSensor(self, ErdCode.UPPER_OVEN_DISPLAY_TEMPERATURE, self._single_name(ErdCode.UPPER_OVEN_DISPLAY_TEMPERATURE, ~oven_config.has_lower_oven)),
GeErdBinarySensor(self, ErdCode.UPPER_OVEN_REMOTE_ENABLED, self._single_name(ErdCode.UPPER_OVEN_REMOTE_ENABLED, ~oven_config.has_lower_oven)),

GeOven(self, UPPER_OVEN, False, self._temperature_code(has_upper_raw_temperature))
])
if has_upper_raw_temperature:
oven_entities.append(GeErdSensor(self, ErdCode.UPPER_OVEN_RAW_TEMPERATURE, self._single_name(ErdCode.UPPER_OVEN_RAW_TEMPERATURE, ~oven_config.has_lower_oven)))
if upper_light_availability is None or upper_light_availability.is_available or upper_light is not None:
oven_entities.append(GeOvenLightLevelSelect(self, ErdCode.UPPER_OVEN_LIGHT, self._single_name(ErdCode.UPPER_OVEN_LIGHT, ~oven_config.has_lower_oven)))
if upper_warm_drawer is not None:
oven_entities.append(GeOvenWarmingStateSelect(self, ErdCode.UPPER_OVEN_WARMING_DRAWER_STATE, self._single_name(ErdCode.UPPER_OVEN_WARMING_DRAWER_STATE, ~oven_config.has_lower_oven)))

if oven_config.has_warming_drawer and warm_drawer is not None:
oven_entities.append(GeErdSensor(self, ErdCode.WARMING_DRAWER_STATE))

if cooktop_config == ErdCooktopConfig.PRESENT:
cooktop_status: CooktopStatus = self.try_get_erd_value(ErdCode.COOKTOP_STATUS)
Expand All @@ -110,11 +115,16 @@ def get_all_entities(self) -> List[Entity]:

return base_entities + oven_entities + cooktop_entities

def _single_name(self, erd_code: ErdCode):
return erd_code.name.replace(UPPER_OVEN+"_","").replace("_", " ").title()
def _single_name(self, erd_code: ErdCode, make_single: bool):
name = erd_code.name

if make_single:
name = name.replace(UPPER_OVEN+"_","")

return name.replace("_", " ").title()

def _camel_to_snake(self, s):
return ''.join(['_'+c.lower() if c.isupper() else c for c in s]).lstrip('_')

def _temperature_code(self, has_raw: bool):
return "RAW_TEMPERATURE" if has_raw else "DISPLAY_TEMPERATURE"
return "RAW_TEMPERATURE" if has_raw else "DISPLAY_TEMPERATURE"
3 changes: 2 additions & 1 deletion custom_components/ge_home/entities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
from .water_softener import *
from .water_heater import *
from .opal_ice_maker import *
from .ccm import *
from .ccm import *
from .dehumidifier import *
3 changes: 2 additions & 1 deletion custom_components/ge_home/entities/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
from .ge_erd_number import GeErdNumber
from .ge_water_heater import GeAbstractWaterHeater
from .ge_erd_select import GeErdSelect
from .ge_climate import GeClimate
from .ge_climate import GeClimate
from .ge_humidifier import GeHumidifier
4 changes: 4 additions & 0 deletions custom_components/ge_home/entities/common/ge_erd_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,9 @@ def _get_icon(self):
return "mdi:water"
if self.erd_code_class == ErdCodeClass.CCM_SENSOR:
return "mdi:coffee-maker"
if self.erd_code_class == ErdCodeClass.HUMIDITY:
return "mdi:water-percent"
if self.erd_code_class == ErdCodeClass.DEHUMIDIFIER_SENSOR:
return "mdi:air-humidifier"

return None
7 changes: 6 additions & 1 deletion custom_components/ge_home/entities/common/ge_erd_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
DEVICE_CLASS_TEMPERATURE,
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_POWER_FACTOR,
DEVICE_CLASS_HUMIDITY,
TEMP_FAHRENHEIT,
)
from gehomesdk import ErdCodeType, ErdCodeClass
Expand Down Expand Up @@ -111,6 +112,8 @@ def _get_uom(self):
return "%"
if self.device_class == DEVICE_CLASS_POWER_FACTOR:
return "%"
if self.erd_code_class == ErdCodeClass.HUMIDITY:
return "%"
if self.erd_code_class == ErdCodeClass.FLOW_RATE:
#if self._measurement_system == ErdMeasurementUnits.METRIC:
# return "lpm"
Expand All @@ -135,6 +138,8 @@ def _get_device_class(self) -> Optional[str]:
return DEVICE_CLASS_POWER
if self.erd_code_class == ErdCodeClass.ENERGY:
return DEVICE_CLASS_ENERGY
if self.erd_code_class == ErdCodeClass.HUMIDITY:
return DEVICE_CLASS_HUMIDITY

return None

Expand All @@ -144,7 +149,7 @@ def _get_state_class(self) -> Optional[str]:

if self.device_class in [DEVICE_CLASS_TEMPERATURE, DEVICE_CLASS_ENERGY]:
return SensorStateClass.MEASUREMENT
if self.erd_code_class in [ErdCodeClass.FLOW_RATE, ErdCodeClass.PERCENTAGE]:
if self.erd_code_class in [ErdCodeClass.FLOW_RATE, ErdCodeClass.PERCENTAGE, ErdCodeClass.HUMIDITY]:
return SensorStateClass.MEASUREMENT
if self.erd_code_class in [ErdCodeClass.LIQUID_VOLUME]:
return SensorStateClass.TOTAL_INCREASING
Expand Down
Loading

0 comments on commit 3b6e657

Please sign in to comment.