Просмотр исходного кода

Eliminate configuration of non-deprecated entities.

Home Assistant now has the ability to disable unwanted entities from the UI, and most non-essential entities are already marked as config or diagnostic so should not be cluttering up auto-generated dashboards or voice assistant entity lists.

Removing the ability to disable entities from the integration config simplifies the translations file, which is of much bigger benefit for maintenance than the benefit this feature brought.

Fixes #177, and a number of other comments that contributors have had about the same problem in the past.
Jason Rumney 3 лет назад
Родитель
Сommit
62e3b725cf

+ 15 - 13
README.md

@@ -240,17 +240,14 @@ it up again.
 
 ### Stage Three
 
-The final stage is to choose a name for the device in Home Assistant,
-and select which entities you want to enable.  The options availble
-will depend on the capabilities of the device you selected in the
-previous step.
-
-Usually you will want to accept the defaults at this step.  Entities
-are selected by default, unless they are a deprecated alternative way
-of controlling the device (such as a climate entity for dehumidifiers
-as an alternative to humidifier and fan entities).  If you have
-multiple devices of the same type, you may want to change the name to
-make it easier to distinguish them.
+The final stage is to choose a name for the device in Home Assistant.
+
+If you have multiple devices of the same type, you may want to change
+the name to make it easier to distinguish them.
+
+Besides the name, usually you will want to accept the defaults at this
+step, as any checkboxes are for backwards compatibility deprecated entities
+that will be removed in future, alternatives should be available.
 
 #### name
 
@@ -262,12 +259,17 @@ the entities.
 
 #### (entities)
 
-    _(boolean) (Optional)_ A number of options
-will be available for each of the entities exposed by the device.
+    _(boolean) (Optional)_ Additional options
+may be available for deprecated entities exposed by the device.
 They will be named for the platform type and an optional name for
 the entity as a suffix (eg `climate`, `humidifier`, `lock_child_lock`)
 Setting them to True will expose the entity in Home Assistant.
 
+It is strongly recommended that you do not enable deprecated entities when
+setting up a new device.  They are only retained for users who set up the
+device before support was added for the actual entity matching the device,
+or when a function was misunderstood, and will not be retained forever.
+
 ## Offline operation gotchas
 
 Many Tuya devices will stop responding if unable to connect to the Tuya servers for an extended period.  Reportedly, some devices act better offline if DNS as well as TCP connections is blocked.

+ 14 - 2
custom_components/tuya_local/__init__.py

@@ -187,6 +187,18 @@ async def async_migrate_entry(hass, entry: ConfigEntry):
         entry.options = {**newopts}
         entry.version = 7
 
+    if entry.version == 7:
+        # Non-deprecated entities are now always enabled, remove the config
+        conf_file = get_config(entry.data[CONF_TYPE])
+        opts = {**entry.options}
+        e = conf_file.primary_entity
+        if not e.deprecated:
+            opts.pop(e.config_id, None)
+        for e in conf_file.secondary_entities():
+            if not e.deprecated:
+                opts.pop(e.config_id, None)
+        entry.options = {**opts}
+        entry.version = 8
     return True
 
 
@@ -201,10 +213,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
 
     entities = {}
     e = device_conf.primary_entity
-    if config.get(e.config_id, False):
+    if config.get(e.config_id, False) or not e.deprecated:
         entities[e.entity] = True
     for e in device_conf.secondary_entities():
-        if config.get(e.config_id, False):
+        if config.get(e.config_id, False) or not e.deprecated:
             entities[e.entity] = True
 
     for e in entities:

+ 8 - 4
custom_components/tuya_local/binary_sensor.py

@@ -24,20 +24,24 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
     if cfg is None:
         raise ValueError(f"No device config found for {discovery_info}")
     ecfg = cfg.primary_entity
-    if ecfg.entity == "binary_sensor" and discovery_info.get(ecfg.config_id, False):
+    if ecfg.entity == "binary_sensor" and (
+        discovery_info.get(ecfg.config_id, False) or not ecfg.deprecated
+    ):
         data[ecfg.config_id] = TuyaLocalBinarySensor(device, ecfg)
         sensors.append(data[ecfg.config_id])
         if ecfg.deprecated:
             _LOGGER.warning(ecfg.deprecation_message)
-        _LOGGER.debug(f"Adding binary_sensor for {discovery_info[ecfg.config_id]}")
+        _LOGGER.debug(f"Adding binary_sensor for {ecfg.config_id}")
 
     for ecfg in cfg.secondary_entities():
-        if ecfg.entity == "binary_sensor" and discovery_info.get(ecfg.config_id, False):
+        if ecfg.entity == "binary_sensor" and (
+            discovery_info.get(ecfg.config_id, False) or not ecfg.deprecated
+        ):
             data[ecfg.config_id] = TuyaLocalBinarySensor(device, ecfg)
             sensors.append(data[ecfg.config_id])
             if ecfg.deprecated:
                 _LOGGER.warning(ecfg.deprecation_message)
-            _LOGGER.debug(f"Adding binary_sensor for {discovery_info[ecfg.config_id]}")
+            _LOGGER.debug(f"Adding binary_sensor for {ecfg.config_id}")
     if not sensors:
         raise ValueError(
             f"{device.name} does not support use as a binary_sensor device."

+ 6 - 2
custom_components/tuya_local/climate.py

@@ -24,7 +24,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
     if cfg is None:
         raise ValueError(f"No device config found for {discovery_info}")
     ecfg = cfg.primary_entity
-    if ecfg.entity == "climate" and discovery_info.get(ecfg.config_id, False):
+    if ecfg.entity == "climate" and (
+        discovery_info.get(ecfg.config_id, False) or not ecfg.deprecated
+    ):
         data[ecfg.config_id] = TuyaLocalClimate(device, ecfg)
         climates.append(data[ecfg.config_id])
         if ecfg.deprecated:
@@ -32,7 +34,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
         _LOGGER.debug(f"Adding climate for {ecfg.name}")
 
     for ecfg in cfg.secondary_entities():
-        if ecfg.entity == "climate" and discovery_info.get(ecfg.config_id, False):
+        if ecfg.entity == "climate" and (
+            discovery_info.get(ecfg.config_id, False) or not ecfg.deprecated
+        ):
             data[ecfg.config_id] = TuyaLocalClimate(device, ecfg)
             climates.append(data[ecfg.config_id])
             if ecfg.deprecated:

+ 12 - 6
custom_components/tuya_local/config_flow.py

@@ -14,7 +14,7 @@ _LOGGER = logging.getLogger(__name__)
 
 
 class ConfigFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
-    VERSION = 7
+    VERSION = 8
     CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_POLL
     device = None
     data = {}
@@ -97,9 +97,11 @@ class ConfigFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
         config = get_config(self.data[CONF_TYPE])
         schema = {vol.Required(CONF_NAME, default=config.name): str}
         e = config.primary_entity
-        schema[vol.Optional(e.config_id, default=True)] = bool
+        if e.deprecated:
+            schema[vol.Optional(e.config_id, default=False)] = bool
         for e in config.secondary_entities():
-            schema[vol.Optional(e.config_id, default=not e.deprecated)] = bool
+            if e.deprecated:
+                schema[vol.Optional(e.config_id, default=False)] = bool
 
         return self.async_show_form(
             step_id="choose_entities",
@@ -141,11 +143,15 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
         if cfg is None:
             return self.async_abort(reason="not_supported")
         e = cfg.primary_entity
-        schema[vol.Optional(e.config_id, default=config.get(e.config_id, True))] = bool
-        for e in cfg.secondary_entities():
+        if e.deprecated:
             schema[
-                vol.Optional(e.config_id, default=config.get(e.config_id, False))
+                vol.Optional(e.config_id, default=config.get(e.config_id, True))
             ] = bool
+        for e in cfg.secondary_entities():
+            if e.deprecated:
+                schema[
+                    vol.Optional(e.config_id, default=config.get(e.config_id, False))
+                ] = bool
         return self.async_show_form(
             step_id="user",
             data_schema=vol.Schema(schema),

+ 6 - 4
custom_components/tuya_local/cover.py

@@ -24,15 +24,17 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
     if cfg is None:
         raise ValueError(f"No device config found for {discovery_info}")
     ecfg = cfg.primary_entity
-    if ecfg.entity == "cover" and discovery_info.get(ecfg.config_id, False):
+    if ecfg.entity == "cover" and (
+        discovery_info.get(ecfg.config_id, False) or not ecfg.deprecated
+    ):
         data[ecfg.config_id] = TuyaLocalCover(device, ecfg)
         covers.append(data[ecfg.config_id])
         if ecfg.deprecated:
             _LOGGER.warning(ecfg.deprecation_message)
         _LOGGER.debug(f"Adding cover for {ecfg.name}")
-
-    for ecfg in cfg.secondary_entities():
-        if ecfg.entity == "cover" and discovery_info.get(ecfg.config_i, False):
+        if ecfg.entity == "cover" and (
+            discovery_info.get(ecfg.config_id, False) or not ecfg.deprecated
+        ):
             data[ecfg.config_id] = TuyaLocalCover(device, ecfg)
             covers.append(data[ecfg.config_id])
             if ecfg.deprecated:

+ 4 - 2
custom_components/tuya_local/devices/README.md

@@ -77,14 +77,16 @@ secondary entities, so only basic functionality is implemented.
 
 ### `deprecated`
 
-*Optional*
+*Optional, deprecated*
 
 This is used to mark an entity as deprecated.  This is mainly
 for older devices that were implemented when only climate devices were
 supported, but are better represented in HA as fan or humidifier devices.
+This option will be removed in a future release, so do not use it in new
+devices.
 An entity should be moved to `secondary_entities` before being marked as
 deprecated, and the preferred device type moved to the `primary_entity`.
-The value of this should indicated what to use instead.
+The value of this should indicate what to use instead.
 
 ### `class`
 

+ 6 - 2
custom_components/tuya_local/fan.py

@@ -24,7 +24,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
     if cfg is None:
         raise ValueError(f"No device config found for {discovery_info}")
     ecfg = cfg.primary_entity
-    if ecfg.entity == "fan" and discovery_info.get(ecfg.config_id, False):
+    if ecfg.entity == "fan" and (
+        discovery_info.get(ecfg.config_id, False) or not ecfg.deprecated
+    ):
         data[ecfg.config_id] = TuyaLocalFan(device, ecfg)
         fans.append(data[ecfg.config_id])
         if ecfg.deprecated:
@@ -32,7 +34,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
         _LOGGER.debug(f"Adding fan for {ecfg.name}")
 
     for ecfg in cfg.secondary_entities():
-        if ecfg.entity == "fan" and discovery_info.get(ecfg.config_id, False):
+        if ecfg.entity == "fan" and (
+            discovery_info.get(ecfg.config_id, False) or not ecfg.deprecated
+        ):
             data[ecfg.config_id] = TuyaLocalFan(device, ecfg)
             fans.append(data[ecfg.config_id])
             if ecfg.deprecated:

+ 6 - 2
custom_components/tuya_local/humidifier.py

@@ -24,7 +24,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
     if cfg is None:
         raise ValueError(f"No device config found for {discovery_info}")
     ecfg = cfg.primary_entity
-    if ecfg.entity == "humidifier" and discovery_info.get(ecfg.config_id, False):
+    if ecfg.entity == "humidifier" and (
+        discovery_info.get(ecfg.config_id, False) or not ecfg.deprecated
+    ):
         data[ecfg.config_id] = TuyaLocalHumidifier(device, ecfg)
         humidifiers.append(data[ecfg.config_id])
         if ecfg.deprecated:
@@ -32,7 +34,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
         _LOGGER.debug(f"Adding humidifier for {ecfg.name}")
 
     for ecfg in cfg.secondary_entities():
-        if ecfg.entity == "humidifier" and discovery_info.get(ecfg.config_id, False):
+        if ecfg.entity == "humidifier" and (
+            discovery_info.get(ecfg.config_id, False) or not ecfg.deprecated
+        ):
             data[ecfg.config_id] = TuyaLocalHumidifier(device, ecfg)
             humidifiers.append(data[ecfg.config_id])
             if ecfg.deprecated:

+ 6 - 2
custom_components/tuya_local/light.py

@@ -24,7 +24,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
     if cfg is None:
         raise ValueError(f"No device config found for {discovery_info}")
     ecfg = cfg.primary_entity
-    if ecfg.entity == "light" and discovery_info.get(ecfg.config_id, False):
+    if ecfg.entity == "light" and (
+        discovery_info.get(ecfg.config_id, False) or not ecfg.deprecated
+    ):
         data[ecfg.config_id] = TuyaLocalLight(device, ecfg)
         lights.append(data[ecfg.config_id])
         if ecfg.deprecated:
@@ -32,7 +34,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
         _LOGGER.debug(f"Adding light for {device.name}/{ecfg.name}")
 
     for ecfg in cfg.secondary_entities():
-        if ecfg.entity == "light" and discovery_info.get(ecfg.config_id, False):
+        if ecfg.entity == "light" and (
+            discovery_info.get(ecfg.config_id, False) or not ecfg.deprecated
+        ):
             data[ecfg.config_id] = TuyaLocalLight(device, ecfg)
             lights.append(data[ecfg.config_id])
             if ecfg.deprecated:

+ 6 - 2
custom_components/tuya_local/lock.py

@@ -25,7 +25,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
     if cfg is None:
         raise ValueError(f"No device config found for {discovery_info}")
     ecfg = cfg.primary_entity
-    if ecfg.entity == "lock" and discovery_info.get(ecfg.config_id, False):
+    if ecfg.entity == "lock" and (
+        discovery_info.get(ecfg.config_id, False) or not ecfg.deprecated
+    ):
         data[ecfg.config_id] = TuyaLocalLock(device, ecfg)
         locks.append(data[ecfg.config_id])
         if ecfg.deprecated:
@@ -33,7 +35,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
         _LOGGER.debug(f"Adding lock for {ecfg.name}")
 
     for ecfg in cfg.secondary_entities():
-        if ecfg.entity == "lock" and discovery_info.get(ecfg.config_id, False):
+        if ecfg.entity == "lock" and (
+            discovery_info.get(ecfg.config_id, False) or not ecfg.deprecated
+        ):
             data[ecfg.config_id] = TuyaLocalLock(device, ecfg)
             locks.append(data[ecfg.config_id])
             if ecfg.deprecated:

+ 2 - 2
custom_components/tuya_local/manifest.json

@@ -2,11 +2,11 @@
     "domain": "tuya_local",
     "iot_class": "local_polling",
     "name": "Tuya Local",
-    "version": "0.16.3",
+    "version": "0.17.0",
     "documentation": "https://github.com/make-all/tuya-local",
     "issue_tracker": "https://github.com/make-all/tuya-local/issues",
     "dependencies": [],
     "codeowners": ["@make-all"],
-    "requirements": ["pycryptodome~=3.14.1","tinytuya~=1.3.1"],
+    "requirements": ["pycryptodome~=3.14.1","tinytuya~=1.6.0"],
     "config_flow": true
 }

+ 6 - 2
custom_components/tuya_local/number.py

@@ -24,7 +24,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
     if cfg is None:
         raise ValueError(f"No device config found for {discovery_info}")
     ecfg = cfg.primary_entity
-    if ecfg.entity == "number" and discovery_info.get(ecfg.config_id, False):
+    if ecfg.entity == "number" and (
+        discovery_info.get(ecfg.config_id, False) or not ecfg.deprecated
+    ):
         data[ecfg.config_id] = TuyaLocalNumber(device, ecfg)
         numbers.append(data[ecfg.config_id])
         if ecfg.deprecated:
@@ -32,7 +34,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
         _LOGGER.debug(f"Adding number for {discovery_info[ecfg.config_id]}")
 
     for ecfg in cfg.secondary_entities():
-        if ecfg.entity == "number" and discovery_info.get(ecfg.config_id, False):
+        if ecfg.entity == "number" and (
+            discovery_info.get(ecfg.config_id, False) or not ecfg.deprecated
+        ):
             data[ecfg.config_id] = TuyaLocalNumber(device, ecfg)
             numbers.append(data[ecfg.config_id])
             if ecfg.deprecated:

+ 6 - 2
custom_components/tuya_local/select.py

@@ -24,7 +24,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
     if cfg is None:
         raise ValueError(f"No device config found for {discovery_info}")
     ecfg = cfg.primary_entity
-    if ecfg.entity == "select" and discovery_info.get(ecfg.config_id, False):
+    if ecfg.entity == "select" and (
+        discovery_info.get(ecfg.config_id, False) or not ecfg.deprecated
+    ):
         data[ecfg.config_id] = TuyaLocalSelect(device, ecfg)
         selects.append(data[ecfg.config_id])
         if ecfg.deprecated:
@@ -32,7 +34,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
         _LOGGER.debug(f"Adding select for {discovery_info[ecfg.config_id]}")
 
     for ecfg in cfg.secondary_entities():
-        if ecfg.entity == "select" and discovery_info.get(ecfg.config_id, False):
+        if ecfg.entity == "select" and (
+            discovery_info.get(ecfg.config_id, False) or not ecfg.deprecated
+        ):
             data[ecfg.config_id] = TuyaLocalSelect(device, ecfg)
             selects.append(data[ecfg.config_id])
             if ecfg.deprecated:

+ 6 - 2
custom_components/tuya_local/sensor.py

@@ -24,7 +24,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
     if cfg is None:
         raise ValueError(f"No device config found for {discovery_info}")
     ecfg = cfg.primary_entity
-    if ecfg.entity == "sensor" and discovery_info.get(ecfg.config_id, False):
+    if ecfg.entity == "sensor" and (
+        discovery_info.get(ecfg.config_id, False) or not ecfg.deprecated
+    ):
         data[ecfg.config_id] = TuyaLocalSensor(device, ecfg)
         sensors.append(data[ecfg.config_id])
         if ecfg.deprecated:
@@ -32,7 +34,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
         _LOGGER.debug(f"Adding sensor for {discovery_info[ecfg.config_id]}")
 
     for ecfg in cfg.secondary_entities():
-        if ecfg.entity == "sensor" and discovery_info.get(ecfg.config_id, False):
+        if ecfg.entity == "sensor" and (
+            discovery_info.get(ecfg.config_id, False) or not ecfg.deprecated
+        ):
             data[ecfg.config_id] = TuyaLocalSensor(device, ecfg)
             sensors.append(data[ecfg.config_id])
             if ecfg.deprecated:

+ 6 - 2
custom_components/tuya_local/switch.py

@@ -24,7 +24,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
     if cfg is None:
         raise ValueError(f"No device config found for {discovery_info}")
     ecfg = cfg.primary_entity
-    if ecfg.entity == "switch" and discovery_info.get(ecfg.config_id, False):
+    if ecfg.entity == "switch" and (
+        discovery_info.get(ecfg.config_id, False) or not ecfg.deprecated
+    ):
         data[ecfg.config_id] = TuyaLocalSwitch(device, ecfg)
         switches.append(data[ecfg.config_id])
         if ecfg.deprecated:
@@ -32,7 +34,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
         _LOGGER.debug(f"Adding switch for {discovery_info[ecfg.config_id]}")
 
     for ecfg in cfg.secondary_entities():
-        if ecfg.entity == "switch" and discovery_info.get(ecfg.config_id, False):
+        if ecfg.entity == "switch" and (
+            discovery_info.get(ecfg.config_id, False) or not ecfg.deprecated
+        ):
             data[ecfg.config_id] = TuyaLocalSwitch(device, ecfg)
             switches.append(data[ecfg.config_id])
             if ecfg.deprecated:

+ 6 - 342
custom_components/tuya_local/translations/en.json

@@ -23,177 +23,9 @@
                 "description": "Choose a name for this device, and which entities will be enabled",
                 "data": {
                     "name": "Name",
-                    "binary_sensor": "Include a binary sensor entity",
-                    "climate": "Include a climate entity",
-                    "cover": "Include a cover entity",
-                    "fan": "Include a fan entity",
-                    "humidifier": "Include a humidifier entity",
-                    "light": "Include a light entity",
-                    "lock": "Include a lock entity",
-                    "number": "Include a number entity",
-                    "select": "Include a select entity",
-                    "sensor": "Include a sensor entity",
-                    "switch": "Include a switch entity",
-                    "vacuum": "Include a vacuum entity",
-                    "binary_sensor_almost_charged": "Include almost charged as a binary sensor",
-                    "binary_sensor_fully_charged": "Include fully charged as a binary sensor",
-                    "binary_sensor_continuous_heat": "Include continuous heat alarm as a binary_sensor entity",
-                    "binary_sensor_defrost": "Include defrost as a binary_sensor entity",
-                    "binary_sensor_door_open": "Include door open as a binary sensor",
-                    "binary_sensor_error": "Include error as a binary_sensor entity.",
-                    "binary_sensor_high_temperature": "Include high temperature alarm as a binary_sensor entity",
-                    "binary_sensor_low_temperature": "Include low temperature alarm as a binary_sensor entity",
-                    "binary_sensor_sensor_fault": "Include sensor fault as a binary_sensor entity",
-                    "binary_sensor_tank": "Include tank as a binary_sensor entity",
-                    "binary_sensor_valve": "Include valve as a binary_sensor entity",
-                    "binary_sensor_water_flow": "Include water flow warning as a binary_sensor entity",
-                    "binary_sensor_short_circuit": "Include short circuit as a binary_sensor entity",
-                    "binary_sensor_surge": "Include surge detection as a binary_sensor entity",
-                    "binary_sensor_overload": "Include overload detection as a binary_sensor entity",
-                    "binary_sensor_leakage_current": "Include leakage current as a binary_sensor entity",
-                    "binary_sensor_fire": "Include fire detection as a binary_sensor entity",
-                    "binary_sensor_high_power": "Include high power detection as a binary_sensor entity",
-                    "binary_sensor_self_test": "Include self test as a binary_sensor entity",
-                    "binary_sensor_overcurrent": "Include overcurrent detection as a binary_sensor entity",
-                    "binary_sensor_unbalanced": "Include unbalanced detection as a binary_sensor entity",
-                    "binary_sensor_overvoltage": "Include overvoltage detection as a binary_sensor entity",
-                    "binary_sensor_undervoltage": "Include undervoltage detection as a binary_sensor entity",
-                    "binary_sensor_phase_fault": "Include phase fault detection as a binary_sensor entity",
-                    "binary_sensor_outage": "Include outage detection as a binary_sensor entity",
-                    "binary_sensor_magnetism": "Include magnetism detection as a binary_sensor entity",
-                    "binary_sensor_low_credit": "Include low credit as a binary_sensor entity",
-                    "binary_sensor_credit": "Include credit as a binary_sensor entity",
-                    "climate_dehumidifier_as_climate": "Include a climate entity for the dehumidifier (deprecated, recommend using humidifier and fan instead)",
-                    "fan_intensity": "Include intensity as a fan entity",
-                    "light_aq_indicator": "Include AQ indicator as a light entity",
-                    "light_backlight": "Include backlight as a light entity",
-                    "light_display": "Include display as a light entity",
-                    "light_flame": "Include flame as a light entity",
-                    "light_led": "Include LED as a light entity",
-                    "light_mood": "Include mood light as a light entity",
-                    "light_night_light": "Include night light as a light entity",
-                    "light_uv_sterilization": "Include UV sterilization as a light entity",
-                    "lock_child_lock": "Include child lock as a lock entity",
-                    "number_calibration_offset": "Include calibration offset as a number entity",
-                    "number_calibration_offset_external": "Include calibration offset for external sensor as a number entity",
-                    "number_calibration_offset_internal": "Include calibration offset for internal sensor as a number entity",
-                    "number_calibration_swing": "Include calibration swing as a number entity",
-                    "number_calibration_swing_external": "Include calibration swing for external sensor as a number entity",
-                    "number_calibration_swing_internal": "Include calibration swing for internal sensor as a number entity",
-                    "number_charge_current": "Include charge current as a number entity",
-                    "number_charge_voltage": "Include charge voltage as a number entity",
-                    "number_compressor_delay": "Include compressor delay as a number entity",
-                    "number_cooling_hysteresis": "Include cooling hysteresis as a number entity",
-                    "number_heating_hysteresis": "Include heating hysteresis as a number entity",
-                    "number_continuous_heat_hours": "Include Continuous Heating Time as a number entity",
-                    "number_fan_runtime": "Include fan run time as a number entity",
-                    "number_high_temperature_limit": "Include High Temperature Limit as a number entity",
-                    "number_low_temperature_limit": "Include Low Temperature Limit as a number entity",
-                    "number_floor_temperature_limit": "Include Floor Temperature Limit as a number entity",
-                    "number_high_temperature_protection": "Include High Temperature Protection as a number entity",
-                    "number_low_temperature_protection": "Include Low Temperature Protection as a number entity",
-                    "number_holiday_days": "Include Holiday Days as a number entity",
-                    "number_holiday_temperature": "Include Holiday Temperature as a number entity",
-                    "number_power_rating": "Include Power Rating as a number entity",
-                    "number_timer": "Include timer as a number entity",
-                    "number_timer_1": "Include timer 1 as a number entity",
-                    "number_timer_2": "Include timer 2 as a number entity",
-                    "number_timer_3": "Include timer 3 as a number entity",
-                    "number_timer_4": "Include timer 4 as a number entity",
-                    "number_usb_timer": "Include timer USB as a number entity",
-                    "number_interrupt_frames": "Include interrupt frames as a number entity",
-                    "number_maintain_points": "Include maintain points as a number entity",
-                    "number_maintain_power": "Include maintain power as a number entity",
-                    "number_travel_time": "Include travel time as a number entity",
-                    "number_trigger_frames": "Include trigger frames as a number entity",
-                    "number_trigger_points": "Include trigger points as a number entity",
-                    "number_trigger_power": "Include trigger power as a number entity",
-                    "select_charge_type": "Include charge type as a select entity",
-                    "select_configuration": "Include configuration as a select entity",
-                    "select_delay": "Include delay as a select entity",
-                    "select_initial_state": "Include initial state as a select entity",
-                    "select_installation": "Include installation as a select entity",
-                    "select_max_range": "Include max range as a select entity",
-                    "select_mode": "Include mode as a select entity",
-                    "select_motor_reverse_mode": "Include motor reverse mode as a select entity",
-                    "select_open_window_detection": "Include open window detection as a select entity",
-                    "select_pir_timeout": "Include PIR timeout as a select entity",
-                    "select_safe_range": "Include safe range as a select entity",
-                    "select_schedule": "Include schedule as a select entity",
-                    "select_timer": "Include timer as a select entity",
-                    "select_temperature_sensor": "Include temperature sensor config as a select entity",
-                    "select_temperature_unit": "Include temerature unit as a select entity",
-                    "select_horizontal_position": "Include horizontal position as a select entity",
-                    "select_horizontal_swing": "Include horizontal swing as a select entity",
-                    "select_vertical_position": "Include vertical position as a select entity",
-                    "select_vertical_swing": "Include vertical swing as a select entity",
-                    "sensor_active_filter_life": "Include active filter life as a sensor entity",
-                    "sensor_air_quality": "Include air quality as a sensor entity",
-                    "sensor_balance_energy": "Include balance energy as a sensor_entity",
-                    "sensor_battery": "Include battery as a sensor",
-                    "sensor_charcoal_filter_life": "Include charcoal filter life as a sensor entity",
-                    "sensor_clean_area": "Include clean area as a sensor entity",
-                    "sensor_clean_time": "Include clean time as a sensor entity",
-                    "sensor_filter": "Include filter as a sensor entity",
-                    "sensor_edge_brush": "Include edge brush as a sensor entity",
-                    "sensor_roll_brush": "Include roll brush as a sensor entity",
-                    "sensor_current": "Include current as a sensor entity",
-                    "sensor_current_humidity": "Include current humidity as a sensor entity",
-                    "sensor_current_temperature": "Include current temperature as a sensor entity",
-                    "sensor_energy": "Include energy as a sensor entity",
-                    "sensor_external_temperature": "Include external temperature as a sensor entity",
-                    "sensor_floor_temperature": "Include floor temperature as a sensor entity",
-                    "sensor_hepa_filter_life": "Include HEPA filter life as a sensor entity",
-		    "sensor_max_current": "Include max current as a sensor entity",
-		    "sensor_max_temperature_count": "Include max temperature count as a sensor entity",
-		    "sensor_mode": "Include mode as a sensor entity",
-		    "sensor_name": "Include name as a sensor entity",
-                    "sensor_open": "Include open as a sensor entity",
-                    "sensor_power": "Include power as a sensor entity",
-                    "sensor_power_level": "Include power level as a sensor entity",
-                    "sensor_pm2_5": "Include PM2.5 as a sensor entity",
-                    "sensor_prefilter_life": "Include prefilter life as a sensor entity",
-                    "sensor_status": "Include status as a sensor entity",
-                    "sensor_time_remaining": "Include time remaining as a sensor entity",
-                    "sensor_timer": "Include time remaining as a sensor entity",
-                    "sensor_travel_time": "Include travel time as a sensor entity",
-                    "sensor_voltage": "Include voltage as a sensor entity",
-                    "sensor_ambient_temperature": "Include ambient temperature as a sensor entity",
-                    "sensor_compressor_speed": "Include compressor speed as a sensor entity",
-                    "sensor_cooling_coil_pipe_temperature": "Include cooling coil pipe temperature as a sensor entity",
-                    "sensor_cooling_plate_temperature": "Include cooling plate temperature as a sensor entity",
-                    "sensor_eev_opening": "Include EEV opening as a sensor entity",
-                    "sensor_evaporator_coil_pipe_temperature": "Include evaporator coil pipe temperature as a sensor entity",
-                    "sensor_exhaust_gas_temperature": "Include exhaust gas temperature as a sensor entity",
-                    "sensor_fan_speed": "Include fan speed as a sensor entity",
-                    "sensor_outlet_water_temperature": "Include outlet water temperature as a sensor entity",
-                    "sensor_return_gas_temperature": "Include return gas temperature as a sensor entity",
-                    "sensor_water_level": "Include water level as a sensor entity",
-                    "switch_adaptive": "Include adaptive as a switch entity",
-                    "switch_air_clean": "Include air clean as a switch entity",
-                    "switch_anti_frost": "Include anti-frost as a switch entity",
-                    "switch_edge_brush_reset": "Include edge brush reset as a switch entity",
-                    "switch_roll_brush_reset": "Include roll brush reset as a switch entity",
-                    "switch_energy_reset": "Include energy reset as a switch entity",
-                    "switch_factory_reset": "Include factory reset as a switch entity",
-                    "switch_filter_reset": "Include filter reset as a switch entity",
-                    "switch_ionizer": "Include ionizer as a switch entity",
-                    "switch_master": "Include master switch as a switch entity",
-                    "switch_open_window_detector": "Include open window detect as a switch entity",
-                    "switch_outlet": "Include outlet as a switch entity",
-                    "switch_outlet_1": "Include outlet 1 as a switch entity",
-                    "switch_outlet_2": "Include outlet 2 as a switch entity",
-                    "switch_outlet_3": "Include outlet 3 as a switch entity",
-                    "switch_outlet_4": "Include outlet 4 as a switch entity",
-                    "switch_overcharge_cutoff": "Include overcharge cutoff as a switch entity",
-                    "switch_prepay": "Include prepay as a switch entity",
-                    "switch_sleep": "Include sleep mode as a switch entity",
-                    "switch_sound": "Include sound mute as a switch entity",
-                    "switch_storage": "Include storage as a switch entity",
-                    "switch_temperature_limiter": "Include Temperature Limiter as a switch entity",
-                    "switch_time_sync": "Include time sync as a switch entity",
-                    "switch_usb_switch": "Include USB as a switch entity",
-                    "switch_uv_sterilization": "Include UV sterilization as a switch"
+                    "climate": "Include a climate entity (deprecated, will be removed soon, use humidifier and fan instead)",
+                    "climate_dehumidifier_as_climate": "Include a climate entity for the dehumidifier (deprecated, will be removed soon, usehumidifier and fan instead)",
+                    "light_display": "Include display as a light entity (deprecated, will be removed soon, use the hvac_mode on the climate entity instead to turn the panel off)"
                 }
             }
         },
@@ -213,177 +45,9 @@
                 "data": {
                     "host": "IP address or hostname",
                     "local_key": "Local key",
-                    "binary_sensor": "Include a binary sensor entity",
-                    "climate": "Include a climate entity",
-                    "cover": "Include a cover entity",
-                    "fan": "Include a fan entity",
-                    "humidifier": "Include a humidifier entity",
-                    "light": "Include a light entity",
-                    "lock": "Include a lock entity",
-                    "number": "Include a number entity",
-                    "select": "Include a select entity",
-                    "sensor": "Include a sensor entity",
-                    "switch": "Include a switch entity",
-                    "vacuum": "Include a vacuum entity",
-                    "binary_sensor_almost_charged": "Include almost charged as a binary sensor",
-                    "binary_sensor_fully_charged": "Include fully charged as a binary sensor",
-                    "binary_sensor_continuous_heat": "Include continuous heat alarm as a binary_sensor entity",
-                    "binary_sensor_defrost": "Include defrost as a binary_sensor entity",
-                    "binary_sensor_door_open": "Include door open as a binary sensor",
-                    "binary_sensor_error": "Include error as a binary_sensor entity.",
-                    "binary_sensor_high_temperature": "Include high temperature alarm as a binary_sensor entity",
-                    "binary_sensor_low_temperature": "Include low temperature alarm as a binary_sensor entity",
-                    "binary_sensor_sensor_fault": "Include sensor fault as a binary_sensor entity",
-                    "binary_sensor_tank": "Include tank as a binary_sensor entity",
-                    "binary_sensor_valve": "Include valve as a binary_sensor entity",
-                    "binary_sensor_water_flow": "Include water flow warning as a binary_sensor entity",
-                    "binary_sensor_short_circuit": "Include short circuit as a binary_sensor entity",
-                    "binary_sensor_surge": "Include surge detection as a binary_sensor entity",
-                    "binary_sensor_overload": "Include overload detection as a binary_sensor entity",
-                    "binary_sensor_leakage_current": "Include leakage current as a binary_sensor entity",
-                    "binary_sensor_fire": "Include fire detection as a binary_sensor entity",
-                    "binary_sensor_high_power": "Include high power detection as a binary_sensor entity",
-                    "binary_sensor_self_test": "Include self test as a binary_sensor entity",
-                    "binary_sensor_overcurrent": "Include overcurrent detection as a binary_sensor entity",
-                    "binary_sensor_unbalanced": "Include unbalanced detection as a binary_sensor entity",
-                    "binary_sensor_overvoltage": "Include overvoltage detection as a binary_sensor entity",
-                    "binary_sensor_undervoltage": "Include undervoltage detection as a binary_sensor entity",
-                    "binary_sensor_phase_fault": "Include phase fault detection as a binary_sensor entity",
-                    "binary_sensor_outage": "Include outage detection as a binary_sensor entity",
-                    "binary_sensor_magnetism": "Include magnetism detection as a binary_sensor entity",
-                    "binary_sensor_low_credit": "Include low credit as a binary_sensor entity",
-                    "binary_sensor_credit": "Include credit as a binary_sensor entity",
-                    "climate_dehumidifier_as_climate": "Include a climate entity for the dehumidifier (deprecated, recommend using humidifier and fan instead)",
-                    "fan_intensity": "Include intensity as a fan entity",
-                    "light_aq_indicator": "Include AQ indicator as a light entity",
-                    "light_backlight": "Include backlight as a light entity",
-                    "light_display": "Include display as a light entity",
-                    "light_flame": "Include flame as a light entity",
-                    "light_led": "Include LED as a light entity",
-                    "light_mood": "Include mood light as a light entity",
-                    "light_night_light": "Include night light as a light entity",
-                    "light_uv_sterilization": "Include UV sterilization as a light entity",
-                    "lock_child_lock": "Include child lock as a lock entity",
-                    "number_calibration_offset": "Include calibration offset as a number entity",
-                    "number_calibration_offset_external": "Include calibration offset for external sensor as a number entity",
-                    "number_calibration_offset_internal": "Include calibration offset for internal sensor as a number entity",
-                    "number_calibration_swing": "Include calibration swing as a number entity",
-                    "number_calibration_swing_external": "Include calibration swing for external sensor as a number entity",
-                    "number_calibration_swing_internal": "Include calibration swing for internal sensor as a number entity",
-                    "number_charge_current": "Include charge current as a number entity",
-                    "number_charge_voltage": "Include charge voltage as a number entity",
-                    "number_compressor_delay": "Include compressor delay as a number entity",
-                    "number_cooling_hysteresis": "Include cooling hysteresis as a number entity",
-                    "number_heating_hysteresis": "Include heating hysteresis as a number entity",
-                    "number_continuous_heat_hours": "Include Continuous Heating Time as a number entity",
-                    "number_fan_runtime": "Include fan run time as a number entity",
-                    "number_high_temperature_limit": "Include High Temperature Limit as a number entity",
-                    "number_low_temperature_limit": "Include Low Temperature Limit as a number entity",
-                    "number_floor_temperature_limit": "Include Floor Temperature Limit as a number entity",
-                    "number_high_temperature_protection": "Include High Temperature Protection as a number entity",
-                    "number_low_temperature_protection": "Include Low Temperature Protection as a number entity",
-                    "number_holiday_days": "Include Holiday Days as a number entity",
-                    "number_holiday_temperature": "Include Holiday Temperature as a number entity",
-                    "number_power_rating": "Include Power Rating as a number entity",
-                    "number_timer": "Include timer as a number entity",
-                    "number_timer_1": "Include timer 1 as a number entity",
-                    "number_timer_2": "Include timer 2 as a number entity",
-                    "number_timer_3": "Include timer 3 as a number entity",
-                    "number_timer_4": "Include timer 4 as a number entity",
-                    "number_usb_timer": "Include timer USB as a number entity",
-                    "number_interrupt_frames": "Include interrupt frames as a number entity",
-                    "number_maintain_points": "Include maintain points as a number entity",
-                    "number_maintain_power": "Include maintain power as a number entity",
-                    "number_travel_time": "Include travel time as a number entity",
-                    "number_trigger_frames": "Include trigger frames as a number entity",
-                    "number_trigger_points": "Include trigger points as a number entity",
-                    "number_trigger_power": "Include trigger power as a number entity",
-                    "select_charge_type": "Include charge type as a select entity",
-                    "select_configuration": "Include configuration as a select entity",
-                    "select_delay": "Include delay as a select entity",
-                    "select_initial_state": "Include initial state as a select entity",
-                    "select_installation": "Include installation as a select entity",
-                    "select_max_range": "Include max range as a select entity",
-                    "select_mode": "Include mode as a select entity",
-                    "select_motor_reverse_mode": "Include motor reverse mode as a select entity",
-                    "select_open_window_detection": "Include open window detection as a select entity",
-                    "select_pir_timeout": "Include PIR timeout as a select entity",
-                    "select_safe_range": "Include safe range as a select entity",
-                    "select_schedule": "Include schedule as a select entity",
-                    "select_timer": "Include timer as a select entity",
-                    "select_temperature_sensor": "Include temperature sensor config as a select entity",
-                    "select_temperature_unit": "Include temerature unit as a select entity",
-                    "select_horizontal_position": "Include horizontal position as a select entity",
-                    "select_horizontal_swing": "Include horizontal swing as a select entity",
-                    "select_vertical_position": "Include vertical position as a select entity",
-                    "select_vertical_swing": "Include vertical swing as a select entity",
-                    "sensor_active_filter_life": "Include active filter life as a sensor entity",
-                    "sensor_air_quality": "Include air quality as a sensor entity",
-                    "sensor_balance_energy": "Include balance energy as a sensor_entity",
-                    "sensor_battery": "Include battery as a sensor",
-                    "sensor_charcoal_filter_life": "Include charcoal filter life as a sensor entity",
-                    "sensor_clean_area": "Include clean area as a sensor entity",
-                    "sensor_clean_time": "Include clean time as a sensor entity",
-                    "sensor_filter": "Include filter as a sensor entity",
-                    "sensor_edge_brush": "Include edge brush as a sensor entity",
-                    "sensor_roll_brush": "Include roll brush as a sensor entity",
-                    "sensor_current": "Include current as a sensor entity",
-                    "sensor_current_humidity": "Include current humidity as a sensor entity",
-                    "sensor_current_temperature": "Include current temperature as a sensor entity",
-                    "sensor_energy": "Include energy as a sensor entity",
-                    "sensor_external_temperature": "Include external temperature as a sensor entity",
-                    "sensor_floor_temperature": "Include floor temperature as a sensor entity",
-                    "sensor_hepa_filter_life": "Include HEPA filter life as a sensor entity",
-		    "sensor_max_current": "Include max current as a sensor entity",
-		    "sensor_max_temperature_count": "Include max temperature count as a sensor entity",
-		    "sensor_mode": "Include mode as a sensor entity",
-		    "sensor_name": "Include name as a sensor entity",
-                    "sensor_open": "Include open as a sensor entity",
-                    "sensor_power": "Include power as a sensor entity",
-                    "sensor_power_level": "Include power level as a sensor entity",
-                    "sensor_pm2_5": "Include PM2.5 as a sensor entity",
-                    "sensor_prefilter_life": "Include prefilter life as a sensor entity",
-                    "sensor_status": "Include status as a sensor entity",
-                    "sensor_time_remaining": "Include time remaining as a sensor entity",
-                    "sensor_timer": "Include time remaining as a sensor entity",
-                    "sensor_travel_time": "Include travel time as a sensor entity",
-                    "sensor_voltage": "Include voltage as a sensor entity",
-                    "sensor_ambient_temperature": "Include ambient temperature as a sensor entity",
-                    "sensor_compressor_speed": "Include compressor speed as a sensor entity",
-                    "sensor_cooling_coil_pipe_temperature": "Include cooling coil pipe temperature as a sensor entity",
-                    "sensor_cooling_plate_temperature": "Include cooling plate temperature as a sensor entity",
-                    "sensor_eev_opening": "Include EEV opening as a sensor entity",
-                    "sensor_evaporator_coil_pipe_temperature": "Include evaporator coil pipe temperature as a sensor entity",
-                    "sensor_exhaust_gas_temperature": "Include exhaust gas temperature as a sensor entity",
-                    "sensor_fan_speed": "Include fan speed as a sensor entity",
-                    "sensor_outlet_water_temperature": "Include outlet water temperature as a sensor entity",
-                    "sensor_return_gas_temperature": "Include return gas temperature as a sensor entity",
-                    "sensor_water_level": "Include water level as a sensor entity",
-                    "switch_adaptive": "Include adaptive as a switch entity",
-                    "switch_air_clean": "Include air clean as a switch entity",
-                    "switch_anti_frost": "Include anti-frost as a switch entity",
-                    "switch_edge_brush_reset": "Include edge brush reset as a switch entity",
-                    "switch_roll_brush_reset": "Include roll brush reset as a switch entity",
-                    "switch_energy_reset": "Include energy reset as a switch entity",
-                    "switch_factory_reset": "Include factory reset as a switch entity",
-                    "switch_filter_reset": "Include filter reset as a switch entity",
-                    "switch_ionizer": "Include ionizer as a switch entity",
-                    "switch_master": "Include master switch as a switch entity",
-                    "switch_open_window_detector": "Include open window detect as a switch entity",
-                    "switch_outlet": "Include outlet as a switch entity",
-                    "switch_outlet_1": "Include outlet 1 as a switch entity",
-                    "switch_outlet_2": "Include outlet 2 as a switch entity",
-                    "switch_outlet_3": "Include outlet 3 as a switch entity",
-                    "switch_outlet_4": "Include outlet 4 as a switch entity",
-                    "switch_overcharge_cutoff": "Include overcharge cutoff as a switch entity",
-                    "switch_prepay": "Include prepay as a switch entity",
-                    "switch_sleep": "Include sleep mode as a switch entity",
-                    "switch_sound": "Include sound mute as a switch entity",
-                    "switch_storage": "Include storage as a switch entity",
-                    "switch_temperature_limiter": "Include Temperature Limiter as a switch entity",
-                    "switch_time_sync": "Include time sync as a switch entity",
-                    "switch_usb_switch": "Include USB as a switch entity",
-                    "switch_uv_sterilization": "Include UV sterilization as a switch"
+                    "climate": "Include a climate entity (deprecated, will be removed soon, use humidifier and fan instead)",
+                    "climate_dehumidifier_as_climate": "Include a climate entity for the dehumidifier (deprecated, will be removed soon, usehumidifier and fan instead)",
+                    "light_display": "Include display as a light entity (deprecated, will be removed soon, use the hvac_mode on the climate entity instead to turn the panel off)"
                 }
             }
         },

+ 6 - 2
custom_components/tuya_local/vacuum.py

@@ -24,7 +24,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
     if cfg is None:
         raise ValueError(f"No device config found for {discovery_info}")
     ecfg = cfg.primary_entity
-    if ecfg.entity == "vacuum" and discovery_info.get(ecfg.config_id, False):
+    if ecfg.entity == "vacuum" and (
+        discovery_info.get(ecfg.config_id, False) or not ecfg.deprecated
+    ):
         data[ecfg.config_id] = TuyaLocalVacuum(device, ecfg)
         vacs.append(data[ecfg.config_id])
         if ecfg.deprecated:
@@ -32,7 +34,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
         _LOGGER.debug(f"Adding vacuum for {device.name}/{ecfg.name}")
 
     for ecfg in cfg.secondary_entities():
-        if ecfg.entity == "vacuum" and discovery_info.get(ecfg.config_id, False):
+        if ecfg.entity == "vacuum" and (
+            discovery_info.get(ecfg.config_id, False) or not ecfg.deprecated
+        ):
             data[ecfg.config_id] = TuyaLocalVacuum(device, ecfg)
             vacs.append(data[ecfg.config_id])
             if ecfg.deprecated:

+ 1 - 1
requirements-dev.txt

@@ -5,4 +5,4 @@ pytest
 pytest-asyncio
 pytest-cov
 pycryptodome~=3.14.1
-tinytuya~=1.3.1
+tinytuya~=1.6.0

+ 1 - 1
requirements.txt

@@ -1,2 +1,2 @@
 pycryptodome~=3.14.1
-tinytuya~=1.3.1
+tinytuya~=1.6.0

+ 0 - 4
tests/test_binary_sensor.py

@@ -19,8 +19,6 @@ async def test_init_entry(hass):
             CONF_TYPE: "goldair_dehumidifier",
             CONF_DEVICE_ID: "dummy",
             "humidifier": False,
-            "binary_sensor_tank": True,
-            "binary_sensor_defrost": False,
         },
     )
     m_add_entities = Mock()
@@ -44,7 +42,6 @@ async def test_init_entry_fails_if_device_has_no_binary_sensor(hass):
         data={
             CONF_TYPE: "mirabella_genio_usb",
             CONF_DEVICE_ID: "dummy",
-            "binary_sensor": True,
         },
     )
     m_add_entities = Mock()
@@ -68,7 +65,6 @@ async def test_init_entry_fails_if_config_is_missing(hass):
         data={
             CONF_TYPE: "non_existing",
             CONF_DEVICE_ID: "dummy",
-            "binary_sensor": True,
         },
     )
     m_add_entities = Mock()

+ 11 - 39
tests/test_config_flow.py

@@ -45,7 +45,7 @@ async def test_init_entry(hass):
     """Test initialisation of the config flow."""
     entry = MockConfigEntry(
         domain=DOMAIN,
-        version=7,
+        version=8,
         title="test",
         data={
             CONF_DEVICE_ID: "deviceid",
@@ -53,10 +53,7 @@ async def test_init_entry(hass):
             CONF_LOCAL_KEY: "localkey",
             CONF_TYPE: "kogan_kahtp_heater",
         },
-        options={
-            CONF_CLIMATE: True,
-            "lock_child_lock": True,
-        },
+        options={},
     )
     entry.add_to_hass(hass)
     await hass.config_entries.async_setup(entry.entry_id)
@@ -401,7 +398,7 @@ async def test_flow_choose_entities_init(hass):
     # Check the schema.  Simple comparison does not work since they are not
     # the same object
     try:
-        result["data_schema"]({CONF_NAME: "test", CONF_SWITCH: True})
+        result["data_schema"]({CONF_NAME: "test"})
     except vol.MultipleInvalid:
         assert False
     try:
@@ -430,13 +427,10 @@ async def test_flow_choose_entities_creates_config_entry(hass, bypass_setup):
             flow["flow_id"],
             user_input={
                 CONF_NAME: "test",
-                CONF_CLIMATE: True,
-                "lock_child_lock": False,
-                "number_timer": False,
             },
         )
         expected = {
-            "version": 7,
+            "version": 8,
             "type": "create_entry",
             "flow_id": ANY,
             "handler": DOMAIN,
@@ -446,12 +440,9 @@ async def test_flow_choose_entities_creates_config_entry(hass, bypass_setup):
             "result": ANY,
             "options": {},
             "data": {
-                CONF_CLIMATE: True,
                 CONF_DEVICE_ID: "deviceid",
                 CONF_HOST: "hostname",
                 CONF_LOCAL_KEY: "localkey",
-                "lock_child_lock": False,
-                "number_timer": False,
                 CONF_TYPE: "kogan_kahtp_heater",
             },
         }
@@ -462,14 +453,13 @@ async def test_options_flow_init(hass):
     """Test config flow options."""
     config_entry = MockConfigEntry(
         domain=DOMAIN,
-        version=7,
+        version=8,
         unique_id="uniqueid",
         data={
             CONF_DEVICE_ID: "deviceid",
             CONF_HOST: "hostname",
             CONF_LOCAL_KEY: "localkey",
             CONF_NAME: "test",
-            CONF_SWITCH: True,
             CONF_TYPE: "smartplugv1",
         },
     )
@@ -487,7 +477,6 @@ async def test_options_flow_init(hass):
         {
             CONF_HOST: "hostname",
             CONF_LOCAL_KEY: "localkey",
-            CONF_SWITCH: True,
         }
     )
 
@@ -499,15 +488,12 @@ async def test_options_flow_modifies_config(mock_test, hass):
 
     config_entry = MockConfigEntry(
         domain=DOMAIN,
-        version=7,
+        version=8,
         unique_id="uniqueid",
         data={
-            CONF_CLIMATE: True,
             CONF_DEVICE_ID: "deviceid",
             CONF_HOST: "hostname",
             CONF_LOCAL_KEY: "localkey",
-            "lock_child_lock": True,
-            "number_timer": False,
             CONF_NAME: "test",
             CONF_TYPE: "kogan_kahtp_heater",
         },
@@ -522,19 +508,13 @@ async def test_options_flow_modifies_config(mock_test, hass):
     result = await hass.config_entries.options.async_configure(
         form["flow_id"],
         user_input={
-            CONF_CLIMATE: True,
             CONF_HOST: "new_hostname",
             CONF_LOCAL_KEY: "new_key",
-            "lock_child_lock": False,
-            "number_timer": True,
         },
     )
     expected = {
-        CONF_CLIMATE: True,
         CONF_HOST: "new_hostname",
         CONF_LOCAL_KEY: "new_key",
-        "lock_child_lock": False,
-        "number_timer": True,
     }
     assert "create_entry" == result["type"]
     assert "" == result["title"]
@@ -548,14 +528,13 @@ async def test_options_flow_fails_when_connection_fails(mock_test, hass):
 
     config_entry = MockConfigEntry(
         domain=DOMAIN,
-        version=7,
+        version=8,
         unique_id="uniqueid",
         data={
             CONF_DEVICE_ID: "deviceid",
             CONF_HOST: "hostname",
             CONF_LOCAL_KEY: "localkey",
             CONF_NAME: "test",
-            CONF_SWITCH: True,
             CONF_TYPE: "smartplugv1",
         },
     )
@@ -571,7 +550,6 @@ async def test_options_flow_fails_when_connection_fails(mock_test, hass):
         user_input={
             CONF_HOST: "new_hostname",
             CONF_LOCAL_KEY: "new_key",
-            CONF_SWITCH: False,
         },
     )
     assert "form" == result["type"]
@@ -586,14 +564,13 @@ async def test_options_flow_fails_when_config_is_missing(mock_test, hass):
 
     config_entry = MockConfigEntry(
         domain=DOMAIN,
-        version=7,
+        version=8,
         unique_id="uniqueid",
         data={
             CONF_DEVICE_ID: "deviceid",
             CONF_HOST: "hostname",
             CONF_LOCAL_KEY: "localkey",
             CONF_NAME: "test",
-            CONF_SWITCH: True,
             CONF_TYPE: "non_existing",
         },
     )
@@ -613,19 +590,15 @@ async def test_async_setup_entry_for_dehumidifier(mock_setup, hass):
     """Test setting up based on a config entry.  Repeats test_init_entry."""
     config_entry = MockConfigEntry(
         domain=DOMAIN,
-        version=7,
+        version=8,
         unique_id="uniqueid",
         data={
             CONF_CLIMATE: False,
             CONF_DEVICE_ID: "deviceid",
-            CONF_FAN: True,
             CONF_HOST: "hostname",
-            CONF_HUMIDIFIER: True,
-            CONF_LIGHT: True,
-            CONF_LOCK: False,
             CONF_LOCAL_KEY: "localkey",
             CONF_NAME: "test",
-            CONF_TYPE: "dehumidifier",
+            CONF_TYPE: "goldair_dehumidifier",
         },
     )
     assert await async_setup_entry(hass, config_entry)
@@ -636,14 +609,13 @@ async def test_async_setup_entry_for_switch(mock_device, hass):
     """Test setting up based on a config entry.  Repeats test_init_entry."""
     config_entry = MockConfigEntry(
         domain=DOMAIN,
-        version=7,
+        version=8,
         unique_id="uniqueid",
         data={
             CONF_DEVICE_ID: "deviceid",
             CONF_HOST: "hostname",
             CONF_LOCAL_KEY: "localkey",
             CONF_NAME: "test",
-            CONF_SWITCH: True,
             CONF_TYPE: "smartplugv2",
         },
     )

+ 4 - 2
tests/test_translations.py

@@ -71,7 +71,9 @@ def subtest_entity_covered(entity):
 @pytest.mark.parametrize("device", get_devices())
 def test_device_covered(device):
     entity = device.primary_entity
-    subtest_entity_covered(entity)
+    if entity.deprecated:
+        subtest_entity_covered(entity)
 
     for entity in device.secondary_entities():
-        subtest_entity_covered(entity)
+        if entity.deprecated:
+            subtest_entity_covered(entity)