From e54031e318ff7af281ae399d6de9743411bf31a9 Mon Sep 17 00:00:00 2001 From: Jan Bouwhuis <jbouwh@users.noreply.github.com> Date: Sat, 5 Oct 2024 13:31:42 +0200 Subject: [PATCH] Improve mqtt sensor options validion logging (#127631) * Improve mqtt sensor options validion logging * Fix test --- homeassistant/components/mqtt/sensor.py | 2 +- tests/components/mqtt/test_sensor.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/mqtt/sensor.py b/homeassistant/components/mqtt/sensor.py index 3046c957978..17ea0ab1f5b 100644 --- a/homeassistant/components/mqtt/sensor.py +++ b/homeassistant/components/mqtt/sensor.py @@ -100,7 +100,7 @@ def validate_sensor_state_and_device_class_config(config: ConfigType) -> ConfigT if (device_class := config.get(CONF_DEVICE_CLASS)) != SensorDeviceClass.ENUM: raise vol.Invalid( - f"The option `{CONF_OPTIONS}` can only be used " + f"The option `{CONF_OPTIONS}` must be used " f"together with device class `{SensorDeviceClass.ENUM}`, " f"got `{CONF_DEVICE_CLASS}` '{device_class}'" ) diff --git a/tests/components/mqtt/test_sensor.py b/tests/components/mqtt/test_sensor.py index 555d1be5ed3..7b63afbc603 100644 --- a/tests/components/mqtt/test_sensor.py +++ b/tests/components/mqtt/test_sensor.py @@ -956,7 +956,7 @@ async def test_invalid_state_class( } } }, - "The option `options` can only be used together with " + "The option `options` must be used together with " "device class `enum`, got `device_class` 'gas'", ), ( -- GitLab