Remove current humidity humidifier device trigger (#95394)

This commit is contained in:
Erik Montnemery 2023-06-27 19:55:59 +02:00 committed by GitHub
parent f1a54a510c
commit 0fc51ac75a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 29 deletions

View File

@ -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

View File

@ -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