mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 22:07:10 +00:00
Fix not stripping no device class in template helper binary sensor (#99640)
Strip none template helper binary sensor
This commit is contained in:
parent
216a174cba
commit
47c20495bd
@ -208,6 +208,7 @@ def validate_user_input(
|
|||||||
]:
|
]:
|
||||||
"""Do post validation of user input.
|
"""Do post validation of user input.
|
||||||
|
|
||||||
|
For binary sensors: Strip none-sentinels.
|
||||||
For sensors: Strip none-sentinels and validate unit of measurement.
|
For sensors: Strip none-sentinels and validate unit of measurement.
|
||||||
For all domaines: Set template type.
|
For all domaines: Set template type.
|
||||||
"""
|
"""
|
||||||
@ -217,8 +218,9 @@ def validate_user_input(
|
|||||||
user_input: dict[str, Any],
|
user_input: dict[str, Any],
|
||||||
) -> dict[str, Any]:
|
) -> dict[str, Any]:
|
||||||
"""Add template type to user input."""
|
"""Add template type to user input."""
|
||||||
if template_type == Platform.SENSOR:
|
if template_type in (Platform.BINARY_SENSOR, Platform.SENSOR):
|
||||||
_strip_sentinel(user_input)
|
_strip_sentinel(user_input)
|
||||||
|
if template_type == Platform.SENSOR:
|
||||||
_validate_unit(user_input)
|
_validate_unit(user_input)
|
||||||
_validate_state_class(user_input)
|
_validate_state_class(user_input)
|
||||||
return {"template_type": template_type} | user_input
|
return {"template_type": template_type} | user_input
|
||||||
|
Loading…
x
Reference in New Issue
Block a user