From 7c662cdfd12e447688d755a643a720150c0f933a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Mind=C3=AAllo=20de=20Andrade?= Date: Wed, 26 Aug 2026 08:53:19 -0300 Subject: [PATCH] Add sensor platform to Midea (#177884) Co-authored-by: Simone Chemelli Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: J. Nick Koston --- homeassistant/components/midea/__init__.py | 1 + .../components/midea/device_catalog.py | 17 + homeassistant/components/midea/icons.json | 32 + homeassistant/components/midea/sensor.py | 822 +++++++ homeassistant/components/midea/strings.json | 325 +++ tests/components/midea/conftest.py | 2 + .../midea/snapshots/test_sensor.ambr | 2124 +++++++++++++++++ tests/components/midea/test_sensor.py | 247 ++ 8 files changed, 3570 insertions(+) create mode 100644 homeassistant/components/midea/sensor.py create mode 100644 tests/components/midea/snapshots/test_sensor.ambr create mode 100644 tests/components/midea/test_sensor.py diff --git a/homeassistant/components/midea/__init__.py b/homeassistant/components/midea/__init__.py index ca8df5895dba..1a08decc15c5 100644 --- a/homeassistant/components/midea/__init__.py +++ b/homeassistant/components/midea/__init__.py @@ -34,6 +34,7 @@ _PLATFORMS: list[Platform] = [ Platform.LIGHT, Platform.NUMBER, Platform.SELECT, + Platform.SENSOR, Platform.SWITCH, ] diff --git a/homeassistant/components/midea/device_catalog.py b/homeassistant/components/midea/device_catalog.py index b8c1deba8a99..abd276e67009 100644 --- a/homeassistant/components/midea/device_catalog.py +++ b/homeassistant/components/midea/device_catalog.py @@ -5,14 +5,30 @@ from midealocal.const import DeviceType MIDEA_DEVICE_NAMES: dict[DeviceType, str] = { DeviceType.A1: "Dehumidifier", DeviceType.AC: "Air Conditioner", + DeviceType.AD: "Air Detector", + DeviceType.B0: "Microwave Oven", + DeviceType.B1: "Electric Oven", + DeviceType.B3: "Dish Sterilizer", + DeviceType.B4: "Toaster", DeviceType.B6: "Range Hood", + DeviceType.BF: "Microwave Steam Oven", DeviceType.C2: "Toilet", DeviceType.C3: "Heat Pump Wi-Fi Controller", + DeviceType.CA: "Refrigerator", DeviceType.CC: "MDV Wi-Fi Controller", DeviceType.CD: "Heat Pump Water Heater", DeviceType.CE: "Fresh Air Appliance", DeviceType.CF: "Heat Pump", + DeviceType.DA: "Top Load Washer", + DeviceType.DB: "Front Load Washer", + DeviceType.DC: "Clothes Dryer", DeviceType.E1: "Dishwasher", + DeviceType.E2: "Electric Water Heater", + DeviceType.E3: "Gas Water Heater", + DeviceType.E6: "Gas Boiler", + DeviceType.E8: "Electric Slow Cooker", + DeviceType.EA: "Electric Rice Cooker", + DeviceType.EC: "Electric Pressure Cooker", DeviceType.ED: "Water Drinking Appliance", DeviceType.FA: "Fan", DeviceType.FB: "Electric Heater", @@ -20,5 +36,6 @@ MIDEA_DEVICE_NAMES: dict[DeviceType, str] = { DeviceType.FD: "Humidifier", DeviceType.X13: "Light", DeviceType.X26: "Bathroom Master", + DeviceType.X34: "Sink Dishwasher", DeviceType.X40: "Integrated Ceiling Fan", } diff --git a/homeassistant/components/midea/icons.json b/homeassistant/components/midea/icons.json index 282fe39870b1..e827ebe6c57e 100644 --- a/homeassistant/components/midea/icons.json +++ b/homeassistant/components/midea/icons.json @@ -27,6 +27,38 @@ } } } + }, + "sensor": { + "filter_life": { + "default": "mdi:air-filter" + }, + "filter_life_level": { + "default": "mdi:air-filter" + }, + "hcho": { + "default": "mdi:molecule" + }, + "in_tds": { + "default": "mdi:water" + }, + "indoor_fan_speed": { + "default": "mdi:fan" + }, + "mode": { + "default": "mdi:auto-mode" + }, + "out_tds": { + "default": "mdi:water-plus" + }, + "pmv": { + "default": "mdi:thermometer-lines" + }, + "tank_level": { + "default": "mdi:cup-water" + }, + "target_indoor_fan_speed": { + "default": "mdi:fan-clock" + } } } } diff --git a/homeassistant/components/midea/sensor.py b/homeassistant/components/midea/sensor.py new file mode 100644 index 000000000000..02793b4ff856 --- /dev/null +++ b/homeassistant/components/midea/sensor.py @@ -0,0 +1,822 @@ +"""Midea Sensor entities.""" + +from dataclasses import dataclass +from typing import cast, override + +from midealocal.const import DeviceType + +from homeassistant.components.sensor import ( + EntityCategory, + SensorDeviceClass, + SensorEntity, + SensorEntityDescription, + SensorStateClass, +) +from homeassistant.const import ( + REVOLUTIONS_PER_MINUTE, + UnitOfDensity, + UnitOfElectricCurrent, + UnitOfElectricPotential, + UnitOfEnergy, + UnitOfFrequency, + UnitOfPower, + UnitOfRatio, + UnitOfTemperature, + UnitOfTime, + UnitOfVolume, + UnitOfVolumeFlowRate, +) +from homeassistant.core import HomeAssistant +from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback +from homeassistant.helpers.typing import StateType + +from .entity import MideaConfigEntry, MideaEntity + +PARALLEL_UPDATES = 0 + + +@dataclass(kw_only=True, frozen=True) +class MideaSensorEntityDescription(SensorEntityDescription): + """Describes Midea sensor entity.""" + + models: list[DeviceType] | None = None + + +COOKER_MODES: list[str] = [ + "smart", + "reserve", + "cook_rice", + "fast_cook_rice", + "standard_cook_rice", + "gruel", + "cook_congee", + "stew_soup", + "stewing", + "heat_rice", + "make_cake", + "yoghourt", + "soup_rice", + "coarse_rice", + "five_ceeals_rice", + "eight_treasures_rice", + "crispy_rice", + "shelled_rice", + "eight_treasures_congee", + "infant_congee", + "older_rice", + "rice_soup", + "rice_paste", + "egg_custard", + "warm_milk", + "hot_spring_egg", + "millet_congee", + "firewood_rice", + "few_rice", + "red_potato", + "corn", + "quick_freeze_bun", + "steam_ribs", + "steam_egg", + "coarse_congee", + "steep_rice", + "appetizing_congee", + "corn_congee", + "sprout_rice", + "luscious_rice", + "luscious_boiled", + "fast_rice", + "fast_boil", + "bean_rice_congee", + "fast_congee", + "baby_congee", + "cook_soup", + "congee_coup", + "steam_corn", + "steam_red_potato", + "boil_congee", + "delicious_steam", + "boil_egg", + "rice_wine", + "fruit_vegetable_paste", + "vegetable_porridge", + "pork_porridge", + "fragrant_rice", + "assorte_rice", + "steame_fish", + "baby_rice", + "essence_rice", + "fragrant_dense_congee", + "one_two_cook", + "original_steame", + "hot_fast_rice", + "online_celebrity_rice", + "sushi_rice", + "stone_bowl_rice", + "no_water_treat", + "keep_fresh", + "low_sugar_rice", + "black_buckwheat_rice", + "resveratrol_rice", + "yellow_wheat_rice", + "green_buckwheat_rice", + "roughage_rice", + "millet_mixed_rice", + "iron_pan_rice", + "olla_pan_rice", + "vegetable_rice", + "baby_side", + "regimen_congee", + "earthen_pot_congee", + "regimen_soup", + "pottery_jar_soup", + "canton_soup", + "nutrition_stew", + "northeast_stew", + "uncap_boil", + "trichromatic_coarse_grain", + "four_color_vegetables", + "egg", + "chop", + "clean", + "keep_warm", +] + + +SENSOR_ENTITIES: list[MideaSensorEntityDescription] = [ + MideaSensorEntityDescription( + key="indoor_humidity", + translation_key="indoor_humidity", + device_class=SensorDeviceClass.HUMIDITY, + native_unit_of_measurement=UnitOfRatio.PERCENTAGE, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="indoor_temperature", + translation_key="indoor_temperature", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="outdoor_temperature", + translation_key="outdoor_temperature", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="total_energy_consumption", + translation_key="total_energy_consumption", + device_class=SensorDeviceClass.ENERGY, + native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, + state_class=SensorStateClass.TOTAL_INCREASING, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="current_energy_consumption", + translation_key="current_energy_consumption", + device_class=SensorDeviceClass.ENERGY, + native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, + state_class=SensorStateClass.TOTAL_INCREASING, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="realtime_power", + translation_key="realtime_power", + device_class=SensorDeviceClass.POWER, + native_unit_of_measurement=UnitOfPower.WATT, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="pmv", + translation_key="pmv", + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + entity_registry_enabled_default=False, + ), + MideaSensorEntityDescription( + key="compressor_frequency", + translation_key="compressor_frequency", + device_class=SensorDeviceClass.FREQUENCY, + native_unit_of_measurement=UnitOfFrequency.HERTZ, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="target_compressor_frequency", + translation_key="target_compressor_frequency", + device_class=SensorDeviceClass.FREQUENCY, + native_unit_of_measurement=UnitOfFrequency.HERTZ, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="compressor_current", + translation_key="compressor_current", + device_class=SensorDeviceClass.CURRENT, + native_unit_of_measurement=UnitOfElectricCurrent.AMPERE, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="compressor_voltage", + translation_key="compressor_voltage", + device_class=SensorDeviceClass.VOLTAGE, + native_unit_of_measurement=UnitOfElectricPotential.VOLT, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="indoor_coil_temperature", + translation_key="indoor_coil_temperature", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="evaporator_temperature", + translation_key="evaporator_temperature", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="condenser_temperature", + translation_key="condenser_temperature", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="outdoor_ambient_temperature", + translation_key="outdoor_temperature", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="discharge_pipe_temperature", + translation_key="discharge_pipe_temperature", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="indoor_fan_speed", + translation_key="indoor_fan_speed", + native_unit_of_measurement=REVOLUTIONS_PER_MINUTE, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="target_indoor_fan_speed", + translation_key="target_indoor_fan_speed", + native_unit_of_measurement=REVOLUTIONS_PER_MINUTE, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="compressor_power", + translation_key="compressor_power", + device_class=SensorDeviceClass.POWER, + native_unit_of_measurement=UnitOfPower.WATT, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="tank_actual_temperature", + translation_key="tank_actual_temperature", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="total_produced_energy", + translation_key="total_produced_energy", + device_class=SensorDeviceClass.ENERGY, + native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, + state_class=SensorStateClass.TOTAL_INCREASING, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="temp_tw_in", + translation_key="temp_tw_in", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="temp_tw_out", + translation_key="temp_tw_out", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="instant_power0", + device_class=SensorDeviceClass.POWER, + native_unit_of_measurement=UnitOfPower.WATT, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="compressor_temperature", + translation_key="compressor_temperature", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="current_temperature", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="current_humidity", + device_class=SensorDeviceClass.HUMIDITY, + native_unit_of_measurement=UnitOfRatio.PERCENTAGE, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="humidity", + device_class=SensorDeviceClass.HUMIDITY, + native_unit_of_measurement=UnitOfRatio.PERCENTAGE, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="temperature", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="mode", + translation_key="mode", + models=[DeviceType.DB], + device_class=SensorDeviceClass.ENUM, + options=["normal", "factory_test", "service", "normal_continus"], + ), + MideaSensorEntityDescription( + key="mode", + translation_key="mode", + models=[DeviceType.EA], + device_class=SensorDeviceClass.ENUM, + options=COOKER_MODES, + ), + MideaSensorEntityDescription( + key="mode", + translation_key="mode", + models=[DeviceType.EC], + device_class=SensorDeviceClass.ENUM, + options=[*COOKER_MODES, "diy"], + ), + MideaSensorEntityDescription( + key="tank", + translation_key="tank_level", + native_unit_of_measurement=UnitOfRatio.PERCENTAGE, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="temperature_raw", + translation_key="temperature_raw", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="humidity_raw", + translation_key="humidity_raw", + device_class=SensorDeviceClass.HUMIDITY, + native_unit_of_measurement=UnitOfRatio.PERCENTAGE, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="temperature_compensate", + translation_key="temperature_compensate", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="humidity_compensate", + translation_key="humidity_compensate", + device_class=SensorDeviceClass.HUMIDITY, + native_unit_of_measurement=UnitOfRatio.PERCENTAGE, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="tvoc", + translation_key="tvoc", + device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS_PARTS, + native_unit_of_measurement=UnitOfRatio.PARTS_PER_MILLION, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="co2", + device_class=SensorDeviceClass.CO2, + native_unit_of_measurement=UnitOfRatio.PARTS_PER_MILLION, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="pm25", + device_class=SensorDeviceClass.PM25, + native_unit_of_measurement=UnitOfDensity.MICROGRAMS_PER_CUBIC_METER, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="hcho", + translation_key="hcho", + device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS, + native_unit_of_measurement=UnitOfDensity.MICROGRAMS_PER_CUBIC_METER, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="top_compartment_temperature", + translation_key="top_compartment_temperature", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="middle_compartment_temperature", + translation_key="middle_compartment_temperature", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="bottom_compartment_temperature", + translation_key="bottom_compartment_temperature", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="water_temperature", + translation_key="water_temperature", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="seat_temperature", + translation_key="seat_temperature", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="filter_life", + translation_key="filter_life", + native_unit_of_measurement=UnitOfRatio.PERCENTAGE, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="flex_zone_actual_temp", + translation_key="flex_zone_actual_temp", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="flex_zone_setting_temp", + translation_key="flex_zone_setting_temp", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="freezer_actual_temp", + translation_key="freezer_actual_temp", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="freezer_setting_temp", + translation_key="freezer_setting_temp", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="energy_consumption", + translation_key="energy_consumption", + device_class=SensorDeviceClass.ENERGY, + native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, + state_class=SensorStateClass.TOTAL_INCREASING, + entity_category=EntityCategory.DIAGNOSTIC, + ), + MideaSensorEntityDescription( + key="refrigerator_actual_temp", + translation_key="refrigerator_actual_temp", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="refrigerator_setting_temp", + translation_key="refrigerator_setting_temp", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="right_flex_zone_actual_temp", + translation_key="right_flex_zone_actual_temp", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="right_flex_zone_setting_temp", + translation_key="right_flex_zone_setting_temp", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="variable_mode", + translation_key="variable_mode", + device_class=SensorDeviceClass.ENUM, + options=[ + "none", + "soft_freezing", + "zero_fresh", + "cold_drink", + "fresh_product", + "partial_freezing", + "dry_zone", + "freeze_warm", + ], + ), + MideaSensorEntityDescription( + key="wash_time", + translation_key="wash_time", + device_class=SensorDeviceClass.DURATION, + native_unit_of_measurement=UnitOfTime.MINUTES, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="soak_time", + translation_key="soak_time", + device_class=SensorDeviceClass.DURATION, + native_unit_of_measurement=UnitOfTime.MINUTES, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="dehydration_time", + translation_key="dehydration_time", + device_class=SensorDeviceClass.DURATION, + native_unit_of_measurement=UnitOfTime.MINUTES, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="dry_temperature", + translation_key="dry_temperature", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="heating_power", + translation_key="heating_power", + models=[DeviceType.E2], + device_class=SensorDeviceClass.POWER, + native_unit_of_measurement=UnitOfPower.WATT, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="water_consumption", + translation_key="water_consumption", + device_class=SensorDeviceClass.WATER, + native_unit_of_measurement=UnitOfVolume.LITERS, + state_class=SensorStateClass.TOTAL_INCREASING, + ), + MideaSensorEntityDescription( + key="heating_leaving_temperature", + translation_key="heating_leaving_temperature", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="bathing_leaving_temperature", + translation_key="bathing_leaving_temperature", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="target_temperature", + translation_key="target_temperature", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + models=[DeviceType.E8], + ), + MideaSensorEntityDescription( + key="bottom_temperature", + translation_key="bottom_temperature", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="keep_warm_time", + translation_key="keep_warm_time", + device_class=SensorDeviceClass.DURATION, + native_unit_of_measurement=UnitOfTime.MINUTES, + state_class=SensorStateClass.MEASUREMENT, + models=[DeviceType.EA, DeviceType.EC], + ), + MideaSensorEntityDescription( + key="keep_warm_time", + translation_key="keep_warm_time", + device_class=SensorDeviceClass.DURATION, + native_unit_of_measurement=UnitOfTime.HOURS, + state_class=SensorStateClass.MEASUREMENT, + models=[DeviceType.ED], + ), + MideaSensorEntityDescription( + key="top_temperature", + translation_key="top_temperature", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.CELSIUS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="filter1", + translation_key="filter_available_days", + translation_placeholders={"filter_number": "1"}, + device_class=SensorDeviceClass.DURATION, + native_unit_of_measurement=UnitOfTime.DAYS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="filter2", + translation_key="filter_available_days", + translation_placeholders={"filter_number": "2"}, + device_class=SensorDeviceClass.DURATION, + native_unit_of_measurement=UnitOfTime.DAYS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="filter3", + translation_key="filter_available_days", + translation_placeholders={"filter_number": "3"}, + device_class=SensorDeviceClass.DURATION, + native_unit_of_measurement=UnitOfTime.DAYS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="life1", + translation_key="filter_life_level", + translation_placeholders={"filter_number": "1"}, + native_unit_of_measurement=UnitOfRatio.PERCENTAGE, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="life2", + translation_key="filter_life_level", + translation_placeholders={"filter_number": "2"}, + native_unit_of_measurement=UnitOfRatio.PERCENTAGE, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="life3", + translation_key="filter_life_level", + translation_placeholders={"filter_number": "3"}, + native_unit_of_measurement=UnitOfRatio.PERCENTAGE, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="filter1_life", + translation_key="filter_life_level", + translation_placeholders={"filter_number": "1"}, + native_unit_of_measurement=UnitOfRatio.PERCENTAGE, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="filter2_life", + translation_key="filter_life_level", + translation_placeholders={"filter_number": "2"}, + native_unit_of_measurement=UnitOfRatio.PERCENTAGE, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="in_tds", + translation_key="in_tds", + native_unit_of_measurement=UnitOfRatio.PARTS_PER_MILLION, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="out_tds", + translation_key="out_tds", + native_unit_of_measurement=UnitOfRatio.PARTS_PER_MILLION, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="velocity", + translation_key="flow_rate", + device_class=SensorDeviceClass.VOLUME_FLOW_RATE, + native_unit_of_measurement=UnitOfVolumeFlowRate.LITERS_PER_SECOND, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="soft_available", + translation_key="softwater_available", + device_class=SensorDeviceClass.VOLUME_STORAGE, + native_unit_of_measurement=UnitOfVolume.LITERS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="left_salt", + translation_key="salt_available", + native_unit_of_measurement=UnitOfRatio.PERCENTAGE, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="remaining_days", + translation_key="remaining_days", + device_class=SensorDeviceClass.DURATION, + native_unit_of_measurement=UnitOfTime.DAYS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="use_days", + translation_key="use_days", + device_class=SensorDeviceClass.DURATION, + native_unit_of_measurement=UnitOfTime.DAYS, + state_class=SensorStateClass.MEASUREMENT, + ), + MideaSensorEntityDescription( + key="water_consumption_big", + translation_key="water_consumption_big", + device_class=SensorDeviceClass.WATER, + native_unit_of_measurement=UnitOfVolume.LITERS, + state_class=SensorStateClass.TOTAL_INCREASING, + suggested_display_precision=2, + ), + MideaSensorEntityDescription( + key="water_consumption_average", + translation_key="water_consumption_average", + device_class=SensorDeviceClass.VOLUME, + native_unit_of_measurement=UnitOfVolume.LITERS, + state_class=SensorStateClass.MEASUREMENT, + ), +] + + +async def async_setup_entry( + hass: HomeAssistant, + config_entry: MideaConfigEntry, + async_add_entities: AddConfigEntryEntitiesCallback, +) -> None: + """Set up sensors for device.""" + device = config_entry.runtime_data + + sensors: list[MideaSensor] = [ + MideaSensor(device, description) + for description in SENSOR_ENTITIES + if device.attributes.get(description.key) is not None + and (not description.models or device.device_type in description.models) + ] + + async_add_entities(sensors) + + +class MideaSensor(MideaEntity, SensorEntity): + """Represent a Midea sensor.""" + + @property + @override + def native_value(self) -> StateType: + """Native value of the sensor.""" + value = self._device.get_attribute(self.entity_description.key) + if ( + self.entity_description.key == "indoor_humidity" + and isinstance(value, (int, float)) + and value in {0, 0xFF} + ): + return None + if value == "unknown": + return None + return cast("StateType", value) diff --git a/homeassistant/components/midea/strings.json b/homeassistant/components/midea/strings.json index 8e9d6dbd5277..39661a3d0d48 100644 --- a/homeassistant/components/midea/strings.json +++ b/homeassistant/components/midea/strings.json @@ -319,6 +319,331 @@ } } }, + "sensor": { + "bathing_leaving_temperature": { + "name": "Bathing leaving temperature" + }, + "bottom_compartment_temperature": { + "name": "Bottom compartment temperature" + }, + "bottom_temperature": { + "name": "Bottom temperature" + }, + "compressor_current": { + "name": "Compressor current" + }, + "compressor_frequency": { + "name": "Compressor frequency" + }, + "compressor_power": { + "name": "Compressor power" + }, + "compressor_temperature": { + "name": "Compressor temperature" + }, + "compressor_voltage": { + "name": "Compressor voltage" + }, + "condenser_temperature": { + "name": "Condenser temperature" + }, + "current_energy_consumption": { + "name": "Current energy consumption" + }, + "dehydration_time": { + "name": "Dehydration time" + }, + "discharge_pipe_temperature": { + "name": "Discharge pipe temperature" + }, + "dry_temperature": { + "name": "Dry temperature" + }, + "energy_consumption": { + "name": "Energy consumption" + }, + "evaporator_temperature": { + "name": "Evaporator temperature" + }, + "filter_available_days": { + "name": "Filter {filter_number} available days" + }, + "filter_life": { + "name": "Filter life" + }, + "filter_life_level": { + "name": "Filter {filter_number} life level" + }, + "flex_zone_actual_temp": { + "name": "Flex zone actual temperature" + }, + "flex_zone_setting_temp": { + "name": "Flex zone setting temperature" + }, + "flow_rate": { + "name": "Flow rate" + }, + "freezer_actual_temp": { + "name": "Freezer actual temperature" + }, + "freezer_setting_temp": { + "name": "Freezer setting temperature" + }, + "hcho": { + "name": "Formaldehyde" + }, + "heating_leaving_temperature": { + "name": "Heating leaving temperature" + }, + "heating_power": { + "name": "Heating power" + }, + "humidity_compensate": { + "name": "Humidity compensation" + }, + "humidity_raw": { + "name": "Raw humidity" + }, + "in_tds": { + "name": "In TDS" + }, + "indoor_coil_temperature": { + "name": "Indoor coil temperature" + }, + "indoor_fan_speed": { + "name": "Indoor fan speed" + }, + "indoor_humidity": { + "name": "Indoor humidity" + }, + "indoor_temperature": { + "name": "Indoor temperature" + }, + "keep_warm_time": { + "name": "Keep warm time" + }, + "middle_compartment_temperature": { + "name": "Middle compartment temperature" + }, + "mode": { + "name": "Mode", + "state": { + "appetizing_congee": "Appetizing congee", + "assorte_rice": "Assorted rice", + "baby_congee": "Baby congee", + "baby_rice": "Baby rice", + "baby_side": "Baby side", + "bean_rice_congee": "Bean rice congee", + "black_buckwheat_rice": "Black buckwheat rice", + "boil_congee": "Boil congee", + "boil_egg": "Boil egg", + "canton_soup": "Canton soup", + "chop": "Chop", + "clean": "Clean", + "coarse_congee": "Coarse congee", + "coarse_rice": "Coarse rice", + "congee_coup": "Congee soup", + "cook_congee": "Cook congee", + "cook_rice": "Cook rice", + "cook_soup": "Cook soup", + "corn": "Corn", + "corn_congee": "Corn congee", + "crispy_rice": "Crispy rice", + "delicious_steam": "Delicious steam", + "diy": "DIY", + "earthen_pot_congee": "Earthen pot congee", + "egg": "Egg", + "egg_custard": "Egg custard", + "eight_treasures_congee": "Eight treasures congee", + "eight_treasures_rice": "Eight treasures rice", + "essence_rice": "Essence rice", + "factory_test": "Factory test", + "fast_boil": "Fast boil", + "fast_congee": "Fast congee", + "fast_cook_rice": "Fast cook rice", + "fast_rice": "Fast rice", + "few_rice": "Few rice", + "firewood_rice": "Firewood rice", + "five_ceeals_rice": "Five cereals rice", + "four_color_vegetables": "Four color vegetables", + "fragrant_dense_congee": "Fragrant dense congee", + "fragrant_rice": "Fragrant rice", + "fruit_vegetable_paste": "Fruit vegetable paste", + "green_buckwheat_rice": "Green buckwheat rice", + "gruel": "Gruel", + "heat_rice": "Heat rice", + "hot_fast_rice": "Hot fast rice", + "hot_spring_egg": "Hot spring egg", + "infant_congee": "Infant congee", + "iron_pan_rice": "Iron pan rice", + "keep_fresh": "Keep fresh", + "keep_warm": "Keep warm", + "low_sugar_rice": "Low sugar rice", + "luscious_boiled": "Luscious boiled", + "luscious_rice": "Luscious rice", + "make_cake": "Make cake", + "millet_congee": "Millet congee", + "millet_mixed_rice": "Millet mixed rice", + "no_water_treat": "No water treat", + "normal": "Normal", + "normal_continus": "Normal continuous", + "northeast_stew": "Northeast stew", + "nutrition_stew": "Nutrition stew", + "older_rice": "Older rice", + "olla_pan_rice": "Olla pan rice", + "one_two_cook": "One two cook", + "online_celebrity_rice": "Online celebrity rice", + "original_steame": "Original steam", + "pork_porridge": "Pork porridge", + "pottery_jar_soup": "Pottery jar soup", + "quick_freeze_bun": "Quick freeze bun", + "red_potato": "Red potato", + "regimen_congee": "Regimen congee", + "regimen_soup": "Regimen soup", + "reserve": "Reserve", + "resveratrol_rice": "Resveratrol rice", + "rice_paste": "Rice paste", + "rice_soup": "Rice soup", + "rice_wine": "Rice wine", + "roughage_rice": "Roughage rice", + "service": "Service", + "shelled_rice": "Shelled rice", + "smart": "Smart", + "soup_rice": "Soup rice", + "sprout_rice": "Sprout rice", + "standard_cook_rice": "Standard cook rice", + "steam_corn": "Steam corn", + "steam_egg": "Steam egg", + "steam_red_potato": "Steam red potato", + "steam_ribs": "Steam ribs", + "steame_fish": "Steamed fish", + "steep_rice": "Steep rice", + "stew_soup": "Stew soup", + "stewing": "Stewing", + "stone_bowl_rice": "Stone bowl rice", + "sushi_rice": "Sushi rice", + "trichromatic_coarse_grain": "Trichromatic coarse grain", + "uncap_boil": "Uncap boil", + "vegetable_porridge": "Vegetable porridge", + "vegetable_rice": "Vegetable rice", + "warm_milk": "Warm milk", + "yellow_wheat_rice": "Yellow wheat rice", + "yoghourt": "Yoghourt" + } + }, + "out_tds": { + "name": "Out TDS" + }, + "outdoor_temperature": { + "name": "Outdoor temperature" + }, + "pmv": { + "name": "Predicted mean vote" + }, + "realtime_power": { + "name": "Real-time power" + }, + "refrigerator_actual_temp": { + "name": "Refrigerator actual temperature" + }, + "refrigerator_setting_temp": { + "name": "Refrigerator setting temperature" + }, + "remaining_days": { + "name": "Remaining days" + }, + "right_flex_zone_actual_temp": { + "name": "Right flex zone actual temperature" + }, + "right_flex_zone_setting_temp": { + "name": "Right flex zone setting temperature" + }, + "salt_available": { + "name": "Salt available" + }, + "seat_temperature": { + "name": "Seat temperature" + }, + "soak_time": { + "name": "Soak time" + }, + "softwater_available": { + "name": "Soft water available" + }, + "tank_actual_temperature": { + "name": "Tank temperature" + }, + "tank_level": { + "name": "Tank level" + }, + "target_compressor_frequency": { + "name": "Target compressor frequency" + }, + "target_indoor_fan_speed": { + "name": "Target indoor fan speed" + }, + "target_temperature": { + "name": "Target temperature" + }, + "temp_tw_in": { + "name": "Water inlet temperature" + }, + "temp_tw_out": { + "name": "Water outlet temperature" + }, + "temperature_compensate": { + "name": "Temperature compensation" + }, + "temperature_raw": { + "name": "Raw temperature" + }, + "top_compartment_temperature": { + "name": "Top compartment temperature" + }, + "top_temperature": { + "name": "Top temperature" + }, + "total_energy_consumption": { + "name": "Total energy consumption" + }, + "total_produced_energy": { + "name": "Total produced energy" + }, + "tvoc": { + "name": "TVOC" + }, + "use_days": { + "name": "Days of use" + }, + "variable_mode": { + "name": "Variable mode", + "state": { + "cold_drink": "Cold drink", + "dry_zone": "Dry zone", + "freeze_warm": "Freeze warm", + "fresh_product": "Fresh product", + "none": "None", + "partial_freezing": "Partial freezing", + "soft_freezing": "Soft freezing", + "zero_fresh": "Zero fresh" + } + }, + "wash_time": { + "name": "Wash time" + }, + "water_consumption": { + "name": "Water consumption" + }, + "water_consumption_average": { + "name": "Water consumption average" + }, + "water_consumption_big": { + "name": "Water consumption aggregated" + }, + "water_temperature": { + "name": "Water temperature" + } + }, "switch": { "anion": { "name": "Anion" diff --git a/tests/components/midea/conftest.py b/tests/components/midea/conftest.py index 79512ab818d3..f187f95db699 100644 --- a/tests/components/midea/conftest.py +++ b/tests/components/midea/conftest.py @@ -83,6 +83,8 @@ class DummyDevice: def set_attribute(self, attr: str, value: Any) -> None: """Record set attribute call.""" + self.attributes[attr] = value + self.notify_update({attr: value}) self.calls.append(("set_attribute", attr, value)) def set_target_temperature(self, **kwargs: Any) -> None: diff --git a/tests/components/midea/snapshots/test_sensor.ambr b/tests/components/midea/snapshots/test_sensor.ambr new file mode 100644 index 000000000000..aa201b3c68e6 --- /dev/null +++ b/tests/components/midea/snapshots/test_sensor.ambr @@ -0,0 +1,2124 @@ +# serializer version: 1 +# name: test_all_entities[ac][sensor.air_conditioner_indoor_humidity-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.air_conditioner_indoor_humidity', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Indoor humidity', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Indoor humidity', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'indoor_humidity', + 'unique_id': '12345678_indoor_humidity', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[ac][sensor.air_conditioner_indoor_humidity-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'humidity', + : 'Air Conditioner Indoor humidity', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.air_conditioner_indoor_humidity', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '50', + }) +# --- +# name: test_all_entities[ac][sensor.air_conditioner_indoor_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.air_conditioner_indoor_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Indoor temperature', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 1, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Indoor temperature', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'indoor_temperature', + 'unique_id': '12345678_indoor_temperature', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[ac][sensor.air_conditioner_indoor_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'temperature', + : 'Air Conditioner Indoor temperature', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.air_conditioner_indoor_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '21.0', + }) +# --- +# name: test_all_entities[c3][sensor.heat_pump_wi_fi_controller_water_outlet_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.heat_pump_wi_fi_controller_water_outlet_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Water outlet temperature', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 1, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Water outlet temperature', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'temp_tw_out', + 'unique_id': '12345678_temp_tw_out', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[c3][sensor.heat_pump_wi_fi_controller_water_outlet_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'temperature', + : 'Heat Pump Wi-Fi Controller Water outlet temperature', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.heat_pump_wi_fi_controller_water_outlet_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '21.5', + }) +# --- +# name: test_all_entities[db][sensor.front_load_washer_dehydration_time-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.front_load_washer_dehydration_time', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Dehydration time', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 2, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Dehydration time', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'dehydration_time', + 'unique_id': '12345678_dehydration_time', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[db][sensor.front_load_washer_dehydration_time-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'duration', + : 'Front Load Washer Dehydration time', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.front_load_washer_dehydration_time', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '30', + }) +# --- +# name: test_all_entities[db][sensor.front_load_washer_mode-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + 'normal', + 'factory_test', + 'service', + 'normal_continus', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.front_load_washer_mode', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Mode', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Mode', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'mode', + 'unique_id': '12345678_mode', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[db][sensor.front_load_washer_mode-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'enum', + : 'Front Load Washer Mode', + : list([ + 'normal', + 'factory_test', + 'service', + 'normal_continus', + ]), + }), + 'context': , + 'entity_id': 'sensor.front_load_washer_mode', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'normal', + }) +# --- +# name: test_all_entities[db][sensor.front_load_washer_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.front_load_washer_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Temperature', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 1, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Temperature', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '12345678_temperature', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[db][sensor.front_load_washer_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'temperature', + : 'Front Load Washer Temperature', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.front_load_washer_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '22.0', + }) +# --- +# name: test_all_entities[db][sensor.front_load_washer_wash_time-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.front_load_washer_wash_time', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Wash time', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 2, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Wash time', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'wash_time', + 'unique_id': '12345678_wash_time', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[db][sensor.front_load_washer_wash_time-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'duration', + : 'Front Load Washer Wash time', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.front_load_washer_wash_time', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '65', + }) +# --- +# name: test_all_entities[db_unknown_attributes][sensor.front_load_washer_dehydration_time-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.front_load_washer_dehydration_time', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Dehydration time', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 2, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Dehydration time', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'dehydration_time', + 'unique_id': '12345678_dehydration_time', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[db_unknown_attributes][sensor.front_load_washer_dehydration_time-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'duration', + : 'Front Load Washer Dehydration time', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.front_load_washer_dehydration_time', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '30', + }) +# --- +# name: test_all_entities[db_unknown_attributes][sensor.front_load_washer_mode-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + 'normal', + 'factory_test', + 'service', + 'normal_continus', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.front_load_washer_mode', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Mode', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Mode', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'mode', + 'unique_id': '12345678_mode', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[db_unknown_attributes][sensor.front_load_washer_mode-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'enum', + : 'Front Load Washer Mode', + : list([ + 'normal', + 'factory_test', + 'service', + 'normal_continus', + ]), + }), + 'context': , + 'entity_id': 'sensor.front_load_washer_mode', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_all_entities[db_unknown_attributes][sensor.front_load_washer_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.front_load_washer_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Temperature', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 1, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Temperature', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '12345678_temperature', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[db_unknown_attributes][sensor.front_load_washer_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'temperature', + : 'Front Load Washer Temperature', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.front_load_washer_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '22.0', + }) +# --- +# name: test_all_entities[db_unknown_attributes][sensor.front_load_washer_wash_time-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.front_load_washer_wash_time', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Wash time', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 2, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Wash time', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'wash_time', + 'unique_id': '12345678_wash_time', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[db_unknown_attributes][sensor.front_load_washer_wash_time-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'duration', + : 'Front Load Washer Wash time', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.front_load_washer_wash_time', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '65', + }) +# --- +# name: test_all_entities[e8][sensor.electric_slow_cooker_target_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.electric_slow_cooker_target_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Target temperature', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 1, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Target temperature', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'target_temperature', + 'unique_id': '12345678_target_temperature', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[e8][sensor.electric_slow_cooker_target_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'temperature', + : 'Electric Slow Cooker Target temperature', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.electric_slow_cooker_target_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '22.0', + }) +# --- +# name: test_all_entities[e8][sensor.electric_slow_cooker_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.electric_slow_cooker_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Temperature', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 1, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Temperature', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '12345678_current_temperature', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[e8][sensor.electric_slow_cooker_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'temperature', + : 'Electric Slow Cooker Temperature', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.electric_slow_cooker_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '21.0', + }) +# --- +# name: test_all_entities[ea][sensor.electric_rice_cooker_bottom_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.electric_rice_cooker_bottom_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Bottom temperature', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 1, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Bottom temperature', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'bottom_temperature', + 'unique_id': '12345678_bottom_temperature', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[ea][sensor.electric_rice_cooker_bottom_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'temperature', + : 'Electric Rice Cooker Bottom temperature', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.electric_rice_cooker_bottom_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '180', + }) +# --- +# name: test_all_entities[ea][sensor.electric_rice_cooker_keep_warm_time-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.electric_rice_cooker_keep_warm_time', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Keep warm time', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 2, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Keep warm time', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'keep_warm_time', + 'unique_id': '12345678_keep_warm_time', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[ea][sensor.electric_rice_cooker_keep_warm_time-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'duration', + : 'Electric Rice Cooker Keep warm time', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.electric_rice_cooker_keep_warm_time', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '30', + }) +# --- +# name: test_all_entities[ea][sensor.electric_rice_cooker_mode-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + 'smart', + 'reserve', + 'cook_rice', + 'fast_cook_rice', + 'standard_cook_rice', + 'gruel', + 'cook_congee', + 'stew_soup', + 'stewing', + 'heat_rice', + 'make_cake', + 'yoghourt', + 'soup_rice', + 'coarse_rice', + 'five_ceeals_rice', + 'eight_treasures_rice', + 'crispy_rice', + 'shelled_rice', + 'eight_treasures_congee', + 'infant_congee', + 'older_rice', + 'rice_soup', + 'rice_paste', + 'egg_custard', + 'warm_milk', + 'hot_spring_egg', + 'millet_congee', + 'firewood_rice', + 'few_rice', + 'red_potato', + 'corn', + 'quick_freeze_bun', + 'steam_ribs', + 'steam_egg', + 'coarse_congee', + 'steep_rice', + 'appetizing_congee', + 'corn_congee', + 'sprout_rice', + 'luscious_rice', + 'luscious_boiled', + 'fast_rice', + 'fast_boil', + 'bean_rice_congee', + 'fast_congee', + 'baby_congee', + 'cook_soup', + 'congee_coup', + 'steam_corn', + 'steam_red_potato', + 'boil_congee', + 'delicious_steam', + 'boil_egg', + 'rice_wine', + 'fruit_vegetable_paste', + 'vegetable_porridge', + 'pork_porridge', + 'fragrant_rice', + 'assorte_rice', + 'steame_fish', + 'baby_rice', + 'essence_rice', + 'fragrant_dense_congee', + 'one_two_cook', + 'original_steame', + 'hot_fast_rice', + 'online_celebrity_rice', + 'sushi_rice', + 'stone_bowl_rice', + 'no_water_treat', + 'keep_fresh', + 'low_sugar_rice', + 'black_buckwheat_rice', + 'resveratrol_rice', + 'yellow_wheat_rice', + 'green_buckwheat_rice', + 'roughage_rice', + 'millet_mixed_rice', + 'iron_pan_rice', + 'olla_pan_rice', + 'vegetable_rice', + 'baby_side', + 'regimen_congee', + 'earthen_pot_congee', + 'regimen_soup', + 'pottery_jar_soup', + 'canton_soup', + 'nutrition_stew', + 'northeast_stew', + 'uncap_boil', + 'trichromatic_coarse_grain', + 'four_color_vegetables', + 'egg', + 'chop', + 'clean', + 'keep_warm', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.electric_rice_cooker_mode', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Mode', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Mode', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'mode', + 'unique_id': '12345678_mode', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[ea][sensor.electric_rice_cooker_mode-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'enum', + : 'Electric Rice Cooker Mode', + : list([ + 'smart', + 'reserve', + 'cook_rice', + 'fast_cook_rice', + 'standard_cook_rice', + 'gruel', + 'cook_congee', + 'stew_soup', + 'stewing', + 'heat_rice', + 'make_cake', + 'yoghourt', + 'soup_rice', + 'coarse_rice', + 'five_ceeals_rice', + 'eight_treasures_rice', + 'crispy_rice', + 'shelled_rice', + 'eight_treasures_congee', + 'infant_congee', + 'older_rice', + 'rice_soup', + 'rice_paste', + 'egg_custard', + 'warm_milk', + 'hot_spring_egg', + 'millet_congee', + 'firewood_rice', + 'few_rice', + 'red_potato', + 'corn', + 'quick_freeze_bun', + 'steam_ribs', + 'steam_egg', + 'coarse_congee', + 'steep_rice', + 'appetizing_congee', + 'corn_congee', + 'sprout_rice', + 'luscious_rice', + 'luscious_boiled', + 'fast_rice', + 'fast_boil', + 'bean_rice_congee', + 'fast_congee', + 'baby_congee', + 'cook_soup', + 'congee_coup', + 'steam_corn', + 'steam_red_potato', + 'boil_congee', + 'delicious_steam', + 'boil_egg', + 'rice_wine', + 'fruit_vegetable_paste', + 'vegetable_porridge', + 'pork_porridge', + 'fragrant_rice', + 'assorte_rice', + 'steame_fish', + 'baby_rice', + 'essence_rice', + 'fragrant_dense_congee', + 'one_two_cook', + 'original_steame', + 'hot_fast_rice', + 'online_celebrity_rice', + 'sushi_rice', + 'stone_bowl_rice', + 'no_water_treat', + 'keep_fresh', + 'low_sugar_rice', + 'black_buckwheat_rice', + 'resveratrol_rice', + 'yellow_wheat_rice', + 'green_buckwheat_rice', + 'roughage_rice', + 'millet_mixed_rice', + 'iron_pan_rice', + 'olla_pan_rice', + 'vegetable_rice', + 'baby_side', + 'regimen_congee', + 'earthen_pot_congee', + 'regimen_soup', + 'pottery_jar_soup', + 'canton_soup', + 'nutrition_stew', + 'northeast_stew', + 'uncap_boil', + 'trichromatic_coarse_grain', + 'four_color_vegetables', + 'egg', + 'chop', + 'clean', + 'keep_warm', + ]), + }), + 'context': , + 'entity_id': 'sensor.electric_rice_cooker_mode', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'heat_rice', + }) +# --- +# name: test_all_entities[ea][sensor.electric_rice_cooker_top_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.electric_rice_cooker_top_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Top temperature', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 1, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Top temperature', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'top_temperature', + 'unique_id': '12345678_top_temperature', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[ea][sensor.electric_rice_cooker_top_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'temperature', + : 'Electric Rice Cooker Top temperature', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.electric_rice_cooker_top_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '200', + }) +# --- +# name: test_all_entities[ec][sensor.electric_pressure_cooker_keep_warm_time-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.electric_pressure_cooker_keep_warm_time', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Keep warm time', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 2, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Keep warm time', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'keep_warm_time', + 'unique_id': '12345678_keep_warm_time', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[ec][sensor.electric_pressure_cooker_keep_warm_time-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'duration', + : 'Electric Pressure Cooker Keep warm time', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.electric_pressure_cooker_keep_warm_time', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '30', + }) +# --- +# name: test_all_entities[ec][sensor.electric_pressure_cooker_mode-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + 'smart', + 'reserve', + 'cook_rice', + 'fast_cook_rice', + 'standard_cook_rice', + 'gruel', + 'cook_congee', + 'stew_soup', + 'stewing', + 'heat_rice', + 'make_cake', + 'yoghourt', + 'soup_rice', + 'coarse_rice', + 'five_ceeals_rice', + 'eight_treasures_rice', + 'crispy_rice', + 'shelled_rice', + 'eight_treasures_congee', + 'infant_congee', + 'older_rice', + 'rice_soup', + 'rice_paste', + 'egg_custard', + 'warm_milk', + 'hot_spring_egg', + 'millet_congee', + 'firewood_rice', + 'few_rice', + 'red_potato', + 'corn', + 'quick_freeze_bun', + 'steam_ribs', + 'steam_egg', + 'coarse_congee', + 'steep_rice', + 'appetizing_congee', + 'corn_congee', + 'sprout_rice', + 'luscious_rice', + 'luscious_boiled', + 'fast_rice', + 'fast_boil', + 'bean_rice_congee', + 'fast_congee', + 'baby_congee', + 'cook_soup', + 'congee_coup', + 'steam_corn', + 'steam_red_potato', + 'boil_congee', + 'delicious_steam', + 'boil_egg', + 'rice_wine', + 'fruit_vegetable_paste', + 'vegetable_porridge', + 'pork_porridge', + 'fragrant_rice', + 'assorte_rice', + 'steame_fish', + 'baby_rice', + 'essence_rice', + 'fragrant_dense_congee', + 'one_two_cook', + 'original_steame', + 'hot_fast_rice', + 'online_celebrity_rice', + 'sushi_rice', + 'stone_bowl_rice', + 'no_water_treat', + 'keep_fresh', + 'low_sugar_rice', + 'black_buckwheat_rice', + 'resveratrol_rice', + 'yellow_wheat_rice', + 'green_buckwheat_rice', + 'roughage_rice', + 'millet_mixed_rice', + 'iron_pan_rice', + 'olla_pan_rice', + 'vegetable_rice', + 'baby_side', + 'regimen_congee', + 'earthen_pot_congee', + 'regimen_soup', + 'pottery_jar_soup', + 'canton_soup', + 'nutrition_stew', + 'northeast_stew', + 'uncap_boil', + 'trichromatic_coarse_grain', + 'four_color_vegetables', + 'egg', + 'chop', + 'clean', + 'keep_warm', + 'diy', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.electric_pressure_cooker_mode', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Mode', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Mode', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'mode', + 'unique_id': '12345678_mode', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[ec][sensor.electric_pressure_cooker_mode-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'enum', + : 'Electric Pressure Cooker Mode', + : list([ + 'smart', + 'reserve', + 'cook_rice', + 'fast_cook_rice', + 'standard_cook_rice', + 'gruel', + 'cook_congee', + 'stew_soup', + 'stewing', + 'heat_rice', + 'make_cake', + 'yoghourt', + 'soup_rice', + 'coarse_rice', + 'five_ceeals_rice', + 'eight_treasures_rice', + 'crispy_rice', + 'shelled_rice', + 'eight_treasures_congee', + 'infant_congee', + 'older_rice', + 'rice_soup', + 'rice_paste', + 'egg_custard', + 'warm_milk', + 'hot_spring_egg', + 'millet_congee', + 'firewood_rice', + 'few_rice', + 'red_potato', + 'corn', + 'quick_freeze_bun', + 'steam_ribs', + 'steam_egg', + 'coarse_congee', + 'steep_rice', + 'appetizing_congee', + 'corn_congee', + 'sprout_rice', + 'luscious_rice', + 'luscious_boiled', + 'fast_rice', + 'fast_boil', + 'bean_rice_congee', + 'fast_congee', + 'baby_congee', + 'cook_soup', + 'congee_coup', + 'steam_corn', + 'steam_red_potato', + 'boil_congee', + 'delicious_steam', + 'boil_egg', + 'rice_wine', + 'fruit_vegetable_paste', + 'vegetable_porridge', + 'pork_porridge', + 'fragrant_rice', + 'assorte_rice', + 'steame_fish', + 'baby_rice', + 'essence_rice', + 'fragrant_dense_congee', + 'one_two_cook', + 'original_steame', + 'hot_fast_rice', + 'online_celebrity_rice', + 'sushi_rice', + 'stone_bowl_rice', + 'no_water_treat', + 'keep_fresh', + 'low_sugar_rice', + 'black_buckwheat_rice', + 'resveratrol_rice', + 'yellow_wheat_rice', + 'green_buckwheat_rice', + 'roughage_rice', + 'millet_mixed_rice', + 'iron_pan_rice', + 'olla_pan_rice', + 'vegetable_rice', + 'baby_side', + 'regimen_congee', + 'earthen_pot_congee', + 'regimen_soup', + 'pottery_jar_soup', + 'canton_soup', + 'nutrition_stew', + 'northeast_stew', + 'uncap_boil', + 'trichromatic_coarse_grain', + 'four_color_vegetables', + 'egg', + 'chop', + 'clean', + 'keep_warm', + 'diy', + ]), + }), + 'context': , + 'entity_id': 'sensor.electric_pressure_cooker_mode', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'diy', + }) +# --- +# name: test_all_entities[ec][sensor.electric_pressure_cooker_top_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.electric_pressure_cooker_top_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Top temperature', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 1, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Top temperature', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'top_temperature', + 'unique_id': '12345678_top_temperature', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[ec][sensor.electric_pressure_cooker_top_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'temperature', + : 'Electric Pressure Cooker Top temperature', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.electric_pressure_cooker_top_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '200', + }) +# --- +# name: test_all_entities[ed][sensor.water_drinking_appliance_filter_1_available_days-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.water_drinking_appliance_filter_1_available_days', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Filter 1 available days', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 2, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Filter 1 available days', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'filter_available_days', + 'unique_id': '12345678_filter1', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[ed][sensor.water_drinking_appliance_filter_1_available_days-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'duration', + : 'Water Drinking Appliance Filter 1 available days', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.water_drinking_appliance_filter_1_available_days', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '30', + }) +# --- +# name: test_all_entities[ed][sensor.water_drinking_appliance_filter_2_available_days-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.water_drinking_appliance_filter_2_available_days', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Filter 2 available days', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 2, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Filter 2 available days', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'filter_available_days', + 'unique_id': '12345678_filter2', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[ed][sensor.water_drinking_appliance_filter_2_available_days-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'duration', + : 'Water Drinking Appliance Filter 2 available days', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.water_drinking_appliance_filter_2_available_days', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '20', + }) +# --- +# name: test_all_entities[ed][sensor.water_drinking_appliance_filter_3_available_days-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.water_drinking_appliance_filter_3_available_days', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Filter 3 available days', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 2, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Filter 3 available days', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'filter_available_days', + 'unique_id': '12345678_filter3', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[ed][sensor.water_drinking_appliance_filter_3_available_days-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'duration', + : 'Water Drinking Appliance Filter 3 available days', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.water_drinking_appliance_filter_3_available_days', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '100', + }) +# --- +# name: test_all_entities[ed][sensor.water_drinking_appliance_in_tds-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.water_drinking_appliance_in_tds', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'In TDS', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'In TDS', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'in_tds', + 'unique_id': '12345678_in_tds', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[ed][sensor.water_drinking_appliance_in_tds-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Water Drinking Appliance In TDS', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.water_drinking_appliance_in_tds', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '200', + }) +# --- +# name: test_all_entities[ed][sensor.water_drinking_appliance_keep_warm_time-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.water_drinking_appliance_keep_warm_time', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Keep warm time', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 2, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Keep warm time', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'keep_warm_time', + 'unique_id': '12345678_keep_warm_time', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[ed][sensor.water_drinking_appliance_keep_warm_time-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'duration', + : 'Water Drinking Appliance Keep warm time', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.water_drinking_appliance_keep_warm_time', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '30', + }) +# --- +# name: test_all_entities[ed][sensor.water_drinking_appliance_out_tds-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.water_drinking_appliance_out_tds', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Out TDS', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Out TDS', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'out_tds', + 'unique_id': '12345678_out_tds', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[ed][sensor.water_drinking_appliance_out_tds-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Water Drinking Appliance Out TDS', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.water_drinking_appliance_out_tds', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '100', + }) +# --- +# name: test_all_entities[ed][sensor.water_drinking_appliance_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.water_drinking_appliance_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Temperature', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 1, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Temperature', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '12345678_current_temperature', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[ed][sensor.water_drinking_appliance_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'temperature', + : 'Water Drinking Appliance Temperature', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.water_drinking_appliance_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '150', + }) +# --- +# name: test_all_entities[ed][sensor.water_drinking_appliance_water_consumption-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.water_drinking_appliance_water_consumption', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Water consumption', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 2, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Water consumption', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'water_consumption', + 'unique_id': '12345678_water_consumption', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[ed][sensor.water_drinking_appliance_water_consumption-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'water', + : 'Water Drinking Appliance Water consumption', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.water_drinking_appliance_water_consumption', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '500', + }) +# --- +# name: test_all_entities[ed][sensor.water_drinking_appliance_water_consumption_aggregated-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.water_drinking_appliance_water_consumption_aggregated', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Water consumption aggregated', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 2, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Water consumption aggregated', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'water_consumption_big', + 'unique_id': '12345678_water_consumption_big', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[ed][sensor.water_drinking_appliance_water_consumption_aggregated-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'water', + : 'Water Drinking Appliance Water consumption aggregated', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.water_drinking_appliance_water_consumption_aggregated', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '6000', + }) +# --- +# name: test_all_entities[ed][sensor.water_drinking_appliance_water_consumption_average-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.water_drinking_appliance_water_consumption_average', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Water consumption average', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 2, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Water consumption average', + 'platform': 'midea', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'water_consumption_average', + 'unique_id': '12345678_water_consumption_average', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[ed][sensor.water_drinking_appliance_water_consumption_average-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'volume', + : 'Water Drinking Appliance Water consumption average', + : , + : , + }), + 'context': , + 'entity_id': 'sensor.water_drinking_appliance_water_consumption_average', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '30', + }) +# --- diff --git a/tests/components/midea/test_sensor.py b/tests/components/midea/test_sensor.py new file mode 100644 index 000000000000..0bf4143abdb2 --- /dev/null +++ b/tests/components/midea/test_sensor.py @@ -0,0 +1,247 @@ +"""Tests for Midea sensor.py.""" + +from collections.abc import Callable +from unittest.mock import patch + +from midealocal.const import DeviceType +from midealocal.devices.ac import DeviceAttributes as ACAttributes +from midealocal.devices.c3 import DeviceAttributes as C3Attributes +from midealocal.devices.db import DeviceAttributes as DBAttributes +from midealocal.devices.e8 import DeviceAttributes as E8Attributes +from midealocal.devices.ea import DeviceAttributes as EAAttributes +from midealocal.devices.ec import DeviceAttributes as ECAttributes +from midealocal.devices.ed import DeviceAttributes as EDAttributes +import pytest +from syrupy.assertion import SnapshotAssertion + +from homeassistant.const import Platform +from homeassistant.core import HomeAssistant +from homeassistant.helpers import entity_registry as er + +from . import setup_integration +from .conftest import DummyDevice, SetDeviceAttribute, entity_entries +from .const import TEST_DEVICE_ID + +from tests.common import MockConfigEntry, snapshot_platform + + +@pytest.mark.parametrize( + "device", + [ + pytest.param( + DummyDevice( + DeviceType.AC, + attributes={ + ACAttributes.power: True, + ACAttributes.mode: 1, + ACAttributes.target_temperature: 22.0, + ACAttributes.indoor_temperature: 21.0, + ACAttributes.comfort_mode: False, + ACAttributes.eco_mode: False, + ACAttributes.boost_mode: False, + ACAttributes.sleep_mode: False, + ACAttributes.frost_protect: False, + ACAttributes.fan_speed: 103, + ACAttributes.swing_vertical: True, + ACAttributes.swing_horizontal: True, + ACAttributes.indoor_humidity: 50, + }, + ), + id="ac", + ), + pytest.param( + DummyDevice( + DeviceType.C3, + attributes={ + C3Attributes.zone_temp_type: [True, False], + C3Attributes.temperature_min: [16, 17], + C3Attributes.temperature_max: [30, 29], + C3Attributes.mode: 1, + C3Attributes.zone1_power: True, + C3Attributes.zone2_power: False, + C3Attributes.target_temperature: [22, 23], + C3Attributes.temp_tw_out: 21.5, + }, + ), + id="c3", + ), + pytest.param( + DummyDevice( + DeviceType.E8, + attributes={ + E8Attributes.status: 1, + E8Attributes.time_remaining: 3600, + E8Attributes.keep_warm_remaining: 1800, + E8Attributes.working_time: 7200, + E8Attributes.target_temperature: 22.0, + E8Attributes.current_temperature: 21.0, + E8Attributes.finished: False, + E8Attributes.water_shortage: False, + }, + ), + id="e8", + ), + pytest.param( + DummyDevice( + DeviceType.DB, + attributes={ + DBAttributes.power: True, + DBAttributes.mode: "normal", + DBAttributes.temperature: 22.0, + DBAttributes.wash_time: 65, + DBAttributes.dehydration_time: 30, + DBAttributes.program: "cotton", + }, + ), + id="db", + ), + pytest.param( + DummyDevice( + DeviceType.DB, + attributes={ + DBAttributes.power: False, + DBAttributes.mode: "unknown", + DBAttributes.temperature: 22.0, + DBAttributes.wash_time: 65, + DBAttributes.dehydration_time: 30, + DBAttributes.program: "unknown", + }, + ), + id="db_unknown_attributes", + ), + pytest.param( + DummyDevice( + DeviceType.EA, + attributes={ + EAAttributes.bottom_temperature: 180, + EAAttributes.cooking: 1, + EAAttributes.keep_warm: True, + EAAttributes.mode: "heat_rice", + EAAttributes.progress: 50, + EAAttributes.keep_warm_time: 30, + EAAttributes.time_remaining: 5, + EAAttributes.top_temperature: 200, + }, + ), + id="ea", + ), + pytest.param( + DummyDevice( + DeviceType.EC, + attributes={ + ECAttributes.cooking: 1, + ECAttributes.mode: "diy", + ECAttributes.progress: 50, + ECAttributes.keep_warm_time: 30, + ECAttributes.time_remaining: 5, + ECAttributes.top_temperature: 200, + ECAttributes.with_pressure: True, + }, + ), + id="ec", + ), + pytest.param( + DummyDevice( + DeviceType.ED, + attributes={ + EDAttributes.keep_warm: True, + EDAttributes.boil_temperature: 100, + EDAttributes.boiling: True, + EDAttributes.keep_warm_time: 30, + EDAttributes.child_lock: True, + EDAttributes.cl_sterilization: True, + EDAttributes.cooling: True, + EDAttributes.current_temperature: 150, + EDAttributes.dispensing: True, + EDAttributes.error: 3, + EDAttributes.filter1: 30, + EDAttributes.filter2: 20, + EDAttributes.filter3: 100, + EDAttributes.flushing_days: 50, + EDAttributes.heating: True, + EDAttributes.hot_water_dispensing: True, + EDAttributes.in_tds: 200, + EDAttributes.keep_warm_remaining: 20, + EDAttributes.lack_water: True, + EDAttributes.leak_water: True, + EDAttributes.out_tds: 100, + EDAttributes.power: True, + EDAttributes.water_consumption: 500, + EDAttributes.water_consumption_big: 6000, + EDAttributes.water_consumption_average: 30, + }, + ), + id="ed", + ), + ], +) +async def test_all_entities( + hass: HomeAssistant, + device: DummyDevice, + mock_config_entry: Callable[[DummyDevice], MockConfigEntry], + snapshot: SnapshotAssertion, + entity_registry: er.EntityRegistry, +) -> None: + """Test sensor entities are created.""" + config_entry = mock_config_entry(device) + with patch("homeassistant.components.midea._PLATFORMS", [Platform.SENSOR]): + await setup_integration(hass, config_entry, device) + + await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id) + + +async def test_sensor_state_update( + hass: HomeAssistant, + set_device_attribute: SetDeviceAttribute, + mock_config_entry: Callable[[DummyDevice], MockConfigEntry], +) -> None: + """Test sensor state follows push updates from the device.""" + device = DummyDevice( + DeviceType.AC, + attributes={ + ACAttributes.power: True, + ACAttributes.mode: 1, + ACAttributes.target_temperature: 22.0, + ACAttributes.indoor_temperature: 21.0, + ACAttributes.indoor_humidity: 0, + ACAttributes.full_dust: False, + ACAttributes.outdoor_temperature: "unknown", + }, + ) + config_entry = mock_config_entry(device) + with patch("homeassistant.components.midea._PLATFORMS", [Platform.SENSOR]): + await setup_integration(hass, config_entry, device) + + assert len(entity_entries(hass, config_entry)) == 3 + entity_entry = entity_entries(hass, config_entry)[ + f"{TEST_DEVICE_ID}_indoor_temperature" + ] + + state = hass.states.get(entity_entry.entity_id) + assert state is not None + assert state.state == "21.0" + + await set_device_attribute(device, ACAttributes.indoor_temperature, 19.5) + + state = hass.states.get(entity_entry.entity_id) + assert state is not None + assert state.state == "19.5" + + entity_entry = entity_entries(hass, config_entry)[ + f"{TEST_DEVICE_ID}_outdoor_temperature" + ] + state = hass.states.get(entity_entry.entity_id) + assert state is not None + assert state.state == "unknown" + + entity_entry = entity_entries(hass, config_entry)[ + f"{TEST_DEVICE_ID}_indoor_humidity" + ] + state = hass.states.get(entity_entry.entity_id) + assert state is not None + assert state.state == "unknown" + + await set_device_attribute(device, ACAttributes.indoor_humidity, 255) + state = hass.states.get(entity_entry.entity_id) + assert state is not None + assert state.state == "unknown"