From 0fc51ac75af4a901cfbfdb7f2c6edcd6938359e7 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Tue, 27 Jun 2023 19:55:59 +0200 Subject: [PATCH] Remove current humidity humidifier device trigger (#95394) --- .../components/humidifier/device_trigger.py | 26 +------------------ .../humidifier/test_device_trigger.py | 7 +++-- 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/homeassistant/components/humidifier/device_trigger.py b/homeassistant/components/humidifier/device_trigger.py index 0e0f401819b..ee452398a26 100644 --- a/homeassistant/components/humidifier/device_trigger.py +++ b/homeassistant/components/humidifier/device_trigger.py @@ -26,23 +26,10 @@ from homeassistant.helpers import config_validation as cv, entity_registry as er from homeassistant.helpers.trigger import TriggerActionType, TriggerInfo from homeassistant.helpers.typing import ConfigType -from . import ATTR_CURRENT_HUMIDITY, DOMAIN +from . import DOMAIN # mypy: disallow-any-generics -CURRENT_TRIGGER_SCHEMA = vol.All( - DEVICE_TRIGGER_BASE_SCHEMA.extend( - { - vol.Required(CONF_ENTITY_ID): cv.entity_id, - vol.Required(CONF_TYPE): "current_humidity_changed", - vol.Optional(CONF_BELOW): vol.Any(vol.Coerce(float)), - vol.Optional(CONF_ABOVE): vol.Any(vol.Coerce(float)), - vol.Optional(CONF_FOR): cv.positive_time_period_dict, - } - ), - cv.has_at_least_one_key(CONF_BELOW, CONF_ABOVE), -) - HUMIDIFIER_TRIGGER_SCHEMA = vol.All( DEVICE_TRIGGER_BASE_SCHEMA.extend( { @@ -58,7 +45,6 @@ HUMIDIFIER_TRIGGER_SCHEMA = vol.All( TRIGGER_SCHEMA = vol.All( vol.Any( - CURRENT_TRIGGER_SCHEMA, HUMIDIFIER_TRIGGER_SCHEMA, toggle_entity.TRIGGER_SCHEMA, ), @@ -78,8 +64,6 @@ async def async_get_triggers( if entry.domain != DOMAIN: continue - state = hass.states.get(entry.entity_id) - # Add triggers for each entity that belongs to this integration base_trigger = { CONF_PLATFORM: "device", @@ -95,14 +79,6 @@ async def async_get_triggers( } ) - if state and ATTR_CURRENT_HUMIDITY in state.attributes: - triggers.append( - { - **base_trigger, - CONF_TYPE: "current_humidity_changed", - } - ) - return triggers diff --git a/tests/components/humidifier/test_device_trigger.py b/tests/components/humidifier/test_device_trigger.py index afdbc046042..01c223a8dcb 100644 --- a/tests/components/humidifier/test_device_trigger.py +++ b/tests/components/humidifier/test_device_trigger.py @@ -64,13 +64,12 @@ async def test_get_triggers( STATE_ON, { const.ATTR_HUMIDITY: 23, - const.ATTR_CURRENT_HUMIDITY: 48, ATTR_MODE: "home", const.ATTR_AVAILABLE_MODES: ["home", "away"], ATTR_SUPPORTED_FEATURES: 1, }, ) - humidifier_trigger_types = ["current_humidity_changed", "target_humidity_changed"] + humidifier_trigger_types = ["target_humidity_changed"] toggle_trigger_types = ["turned_on", "turned_off", "changed_states"] expected_triggers = [ { @@ -302,13 +301,13 @@ async def test_if_fires_on_state_change( }, ) - # Fake that the humidity is changing + # Fake that the humidity target is changing hass.states.async_set(entry.entity_id, STATE_ON, {const.ATTR_HUMIDITY: 7}) await hass.async_block_till_done() assert len(calls) == 1 assert calls[0].data["some"] == "target_humidity_changed_below" - # Fake that the humidity is changing + # Fake that the humidity target is changing hass.states.async_set(entry.entity_id, STATE_ON, {const.ATTR_HUMIDITY: 37}) await hass.async_block_till_done() assert len(calls) == 2