Deprecate power_command_topic for MQTT climate (#85229)

* Deprecate mode_command_topic for MQTT climate

* Correct deprecation and remove support release inf

* Do not use future tense for comment

* Extend deprecation period to 6 months
This commit is contained in:
Jan Bouwhuis 2023-01-12 09:49:14 +01:00 committed by GitHub
parent a7fb3c82fb
commit 64e235285d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 4 deletions

View file

@ -116,6 +116,10 @@ CONF_MODE_COMMAND_TOPIC = "mode_command_topic"
CONF_MODE_LIST = "modes"
CONF_MODE_STATE_TEMPLATE = "mode_state_template"
CONF_MODE_STATE_TOPIC = "mode_state_topic"
# CONF_POWER_COMMAND_TOPIC, CONF_POWER_STATE_TOPIC and CONF_POWER_STATE_TEMPLATE are deprecated,
# support for CONF_POWER_STATE_TOPIC and CONF_POWER_STATE_TEMPLATE was already removed or never added
# support was deprecated with release 2023.2 and will be removed with release 2023.8
CONF_POWER_COMMAND_TOPIC = "power_command_topic"
CONF_POWER_STATE_TEMPLATE = "power_state_template"
CONF_POWER_STATE_TOPIC = "power_state_topic"
@ -371,6 +375,12 @@ PLATFORM_SCHEMA_MODERN = vol.All(
cv.removed(CONF_HOLD_STATE_TEMPLATE),
cv.removed(CONF_HOLD_STATE_TOPIC),
cv.removed(CONF_HOLD_LIST),
# CONF_POWER_COMMAND_TOPIC, CONF_POWER_STATE_TOPIC and CONF_POWER_STATE_TEMPLATE are deprecated,
# support for CONF_POWER_STATE_TOPIC and CONF_POWER_STATE_TEMPLATE was already removed or never added
# support was deprecated with release 2023.2 and will be removed with release 2023.8
cv.deprecated(CONF_POWER_COMMAND_TOPIC),
cv.deprecated(CONF_POWER_STATE_TEMPLATE),
cv.deprecated(CONF_POWER_STATE_TOPIC),
_PLATFORM_SCHEMA_BASE,
valid_preset_mode_configuration,
valid_humidity_range_configuration,
@ -400,6 +410,12 @@ DISCOVERY_SCHEMA = vol.All(
cv.removed(CONF_HOLD_STATE_TEMPLATE),
cv.removed(CONF_HOLD_STATE_TOPIC),
cv.removed(CONF_HOLD_LIST),
# CONF_POWER_COMMAND_TOPIC, CONF_POWER_STATE_TOPIC and CONF_POWER_STATE_TEMPLATE are deprecated,
# support for CONF_POWER_STATE_TOPIC and CONF_POWER_STATE_TEMPLATE was already removed or never added
# support was deprecated with release 2023.2 and will be removed with release 2023.8
cv.deprecated(CONF_POWER_COMMAND_TOPIC),
cv.deprecated(CONF_POWER_STATE_TEMPLATE),
cv.deprecated(CONF_POWER_STATE_TOPIC),
valid_preset_mode_configuration,
valid_humidity_range_configuration,
valid_humidity_state_configuration,

View file

@ -273,6 +273,9 @@ async def test_set_operation_optimistic(hass, mqtt_mock_entry_with_yaml_config):
assert state.state == "heat"
# CONF_POWER_COMMAND_TOPIC, CONF_POWER_STATE_TOPIC and CONF_POWER_STATE_TEMPLATE are deprecated,
# support for CONF_POWER_STATE_TOPIC and CONF_POWER_STATE_TEMPLATE was already removed or never added
# support was deprecated with release 2023.2 and will be removed with release 2023.8
async def test_set_operation_with_power_command(hass, mqtt_mock_entry_with_yaml_config):
"""Test setting of new operation mode with power command enabled."""
config = copy.deepcopy(DEFAULT_CONFIG[mqtt.DOMAIN])
@ -1410,14 +1413,14 @@ async def test_unique_id(hass, mqtt_mock_entry_with_yaml_config):
climate.DOMAIN: [
{
"name": "Test 1",
"power_state_topic": "test-topic",
"power_command_topic": "test_topic",
"mode_state_topic": "test_topic1/state",
"mode_command_topic": "test_topic1/command",
"unique_id": "TOTALLY_UNIQUE",
},
{
"name": "Test 2",
"power_state_topic": "test-topic",
"power_command_topic": "test_topic",
"mode_state_topic": "test_topic2/state",
"mode_command_topic": "test_topic2/command",
"unique_id": "TOTALLY_UNIQUE",
},
]