Remove aux heat support from mqtt climate (#109513)
This commit is contained in:
parent
29462fc991
commit
00947b708f
3 changed files with 5 additions and 223 deletions
|
@ -9,7 +9,6 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant.components import climate, mqtt
|
||||
from homeassistant.components.climate import (
|
||||
ATTR_AUX_HEAT,
|
||||
ATTR_CURRENT_HUMIDITY,
|
||||
ATTR_CURRENT_TEMPERATURE,
|
||||
ATTR_FAN_MODE,
|
||||
|
@ -1262,91 +1261,6 @@ async def test_set_preset_mode_pessimistic(
|
|||
assert state.attributes.get("preset_mode") == "home"
|
||||
|
||||
|
||||
# Options CONF_AUX_COMMAND_TOPIC, CONF_AUX_STATE_TOPIC
|
||||
# and CONF_AUX_STATE_TEMPLATE were deprecated in HA Core 2023.9
|
||||
# Support will be removed in HA Core 2024.3
|
||||
@pytest.mark.parametrize(
|
||||
"hass_config",
|
||||
[
|
||||
help_custom_config(
|
||||
climate.DOMAIN,
|
||||
DEFAULT_CONFIG,
|
||||
({"aux_command_topic": "aux-topic", "aux_state_topic": "aux-state"},),
|
||||
)
|
||||
],
|
||||
)
|
||||
async def test_set_aux_pessimistic(
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test setting of the aux heating in pessimistic mode."""
|
||||
await mqtt_mock_entry()
|
||||
|
||||
state = hass.states.get(ENTITY_CLIMATE)
|
||||
assert state.attributes.get("aux_heat") == "off"
|
||||
|
||||
await common.async_set_aux_heat(hass, True, ENTITY_CLIMATE)
|
||||
state = hass.states.get(ENTITY_CLIMATE)
|
||||
assert state.attributes.get("aux_heat") == "off"
|
||||
|
||||
async_fire_mqtt_message(hass, "aux-state", "ON")
|
||||
state = hass.states.get(ENTITY_CLIMATE)
|
||||
assert state.attributes.get("aux_heat") == "on"
|
||||
|
||||
async_fire_mqtt_message(hass, "aux-state", "OFF")
|
||||
state = hass.states.get(ENTITY_CLIMATE)
|
||||
assert state.attributes.get("aux_heat") == "off"
|
||||
|
||||
async_fire_mqtt_message(hass, "aux-state", "nonsense")
|
||||
state = hass.states.get(ENTITY_CLIMATE)
|
||||
assert state.attributes.get("aux_heat") == "off"
|
||||
|
||||
|
||||
# Options CONF_AUX_COMMAND_TOPIC, CONF_AUX_STATE_TOPIC
|
||||
# and CONF_AUX_STATE_TEMPLATE were deprecated in HA Core 2023.9
|
||||
# Support will be removed in HA Core 2024.3
|
||||
# "aux_command_topic": "aux-topic"
|
||||
@pytest.mark.parametrize(
|
||||
"hass_config",
|
||||
[
|
||||
help_custom_config(
|
||||
climate.DOMAIN, DEFAULT_CONFIG, ({"aux_command_topic": "aux-topic"},)
|
||||
)
|
||||
],
|
||||
)
|
||||
async def test_set_aux(
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
) -> None:
|
||||
"""Test setting of the aux heating."""
|
||||
mqtt_mock = await mqtt_mock_entry()
|
||||
|
||||
state = hass.states.get(ENTITY_CLIMATE)
|
||||
assert state.attributes.get("aux_heat") == "off"
|
||||
await common.async_set_aux_heat(hass, True, ENTITY_CLIMATE)
|
||||
mqtt_mock.async_publish.assert_called_once_with("aux-topic", "ON", 0, False)
|
||||
mqtt_mock.async_publish.reset_mock()
|
||||
state = hass.states.get(ENTITY_CLIMATE)
|
||||
assert state.attributes.get("aux_heat") == "on"
|
||||
|
||||
await common.async_set_aux_heat(hass, False, ENTITY_CLIMATE)
|
||||
mqtt_mock.async_publish.assert_called_once_with("aux-topic", "OFF", 0, False)
|
||||
state = hass.states.get(ENTITY_CLIMATE)
|
||||
assert state.attributes.get("aux_heat") == "off"
|
||||
|
||||
support = (
|
||||
ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
| ClimateEntityFeature.AUX_HEAT
|
||||
| ClimateEntityFeature.SWING_MODE
|
||||
| ClimateEntityFeature.FAN_MODE
|
||||
| ClimateEntityFeature.PRESET_MODE
|
||||
| ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
|
||||
| ClimateEntityFeature.TARGET_HUMIDITY
|
||||
| ClimateEntityFeature.TURN_OFF
|
||||
| ClimateEntityFeature.TURN_ON
|
||||
)
|
||||
|
||||
assert state.attributes.get("supported_features") == support
|
||||
|
||||
|
||||
@pytest.mark.parametrize("hass_config", [DEFAULT_CONFIG])
|
||||
async def test_availability_when_connection_lost(
|
||||
hass: HomeAssistant, mqtt_mock_entry: MqttMockHAClientGenerator
|
||||
|
@ -1476,7 +1390,6 @@ async def test_get_target_temperature_low_high_with_templates(
|
|||
"temperature_high_command_topic": "temperature-high-topic",
|
||||
"fan_mode_command_topic": "fan-mode-topic",
|
||||
"swing_mode_command_topic": "swing-mode-topic",
|
||||
"aux_command_topic": "aux-topic",
|
||||
"preset_mode_command_topic": "preset-mode-topic",
|
||||
"preset_modes": [
|
||||
"eco",
|
||||
|
@ -1493,8 +1406,6 @@ async def test_get_target_temperature_low_high_with_templates(
|
|||
"current_humidity_template": "{{ value_json }}",
|
||||
"current_temperature_template": "{{ value_json }}",
|
||||
"temperature_state_template": "{{ value_json }}",
|
||||
# Rendering to a bool for aux heat
|
||||
"aux_state_template": "{{ value == 'switchmeon' }}",
|
||||
# Rendering preset_mode
|
||||
"preset_mode_value_template": "{{ value_json.attribute }}",
|
||||
"action_topic": "action",
|
||||
|
@ -1503,7 +1414,6 @@ async def test_get_target_temperature_low_high_with_templates(
|
|||
"swing_mode_state_topic": "swing-state",
|
||||
"temperature_state_topic": "temperature-state",
|
||||
"target_humidity_state_topic": "humidity-state",
|
||||
"aux_state_topic": "aux-state",
|
||||
"current_temperature_topic": "current-temperature",
|
||||
"current_humidity_topic": "current-humidity",
|
||||
"preset_mode_state_topic": "current-preset-mode",
|
||||
|
@ -1590,21 +1500,6 @@ async def test_get_with_templates(
|
|||
state = hass.states.get(ENTITY_CLIMATE)
|
||||
assert state.attributes.get("preset_mode") == "eco"
|
||||
|
||||
# Aux mode
|
||||
|
||||
# Options CONF_AUX_COMMAND_TOPIC, CONF_AUX_STATE_TOPIC
|
||||
# and CONF_AUX_STATE_TEMPLATE were deprecated in HA Core 2023.9
|
||||
# Support will be removed in HA Core 2024.3
|
||||
assert state.attributes.get("aux_heat") == "off"
|
||||
async_fire_mqtt_message(hass, "aux-state", "switchmeon")
|
||||
state = hass.states.get(ENTITY_CLIMATE)
|
||||
assert state.attributes.get("aux_heat") == "on"
|
||||
|
||||
# anything other than 'switchmeon' should turn Aux mode off
|
||||
async_fire_mqtt_message(hass, "aux-state", "somerandomstring")
|
||||
state = hass.states.get(ENTITY_CLIMATE)
|
||||
assert state.attributes.get("aux_heat") == "off"
|
||||
|
||||
# Current temperature
|
||||
async_fire_mqtt_message(hass, "current-temperature", '"74656"')
|
||||
state = hass.states.get(ENTITY_CLIMATE)
|
||||
|
@ -1648,7 +1543,6 @@ async def test_get_with_templates(
|
|||
"temperature_high_command_topic": "temperature-high-topic",
|
||||
"fan_mode_command_topic": "fan-mode-topic",
|
||||
"swing_mode_command_topic": "swing-mode-topic",
|
||||
"aux_command_topic": "aux-topic",
|
||||
"preset_mode_command_topic": "preset-mode-topic",
|
||||
"preset_modes": [
|
||||
"eco",
|
||||
|
@ -2104,7 +1998,6 @@ async def test_unique_id(
|
|||
[
|
||||
("action_topic", "heating", ATTR_HVAC_ACTION, "heating"),
|
||||
("action_topic", "cooling", ATTR_HVAC_ACTION, "cooling"),
|
||||
("aux_state_topic", "ON", ATTR_AUX_HEAT, "on"),
|
||||
("current_temperature_topic", "22.1", ATTR_CURRENT_TEMPERATURE, 22.1),
|
||||
("current_humidity_topic", "60.4", ATTR_CURRENT_HUMIDITY, 60.4),
|
||||
("fan_mode_state_topic", "low", ATTR_FAN_MODE, "low"),
|
||||
|
@ -2386,13 +2279,6 @@ async def test_precision_whole(
|
|||
"on",
|
||||
"swing_mode_command_template",
|
||||
),
|
||||
(
|
||||
climate.SERVICE_SET_AUX_HEAT,
|
||||
"aux_command_topic",
|
||||
{"aux_heat": "on"},
|
||||
"ON",
|
||||
None,
|
||||
),
|
||||
(
|
||||
climate.SERVICE_SET_TEMPERATURE,
|
||||
"temperature_command_topic",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue