Improve mqtt sensor options validion logging (#127631)

* Improve mqtt sensor options validion logging

* Fix test
This commit is contained in:
Jan Bouwhuis 2024-10-05 13:31:42 +02:00 committed by GitHub
parent 24fbc366a6
commit e54031e318
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -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}'"
)

View File

@ -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'",
),
(