Change name to entity_id Text platform error messages (#87963)
parent
ea94a2fbfd
commit
896dd1a36b
|
@ -65,16 +65,16 @@ async def _async_set_value(entity: TextEntity, service_call: ServiceCall) -> Non
|
|||
value = service_call.data[ATTR_VALUE]
|
||||
if len(value) < entity.min:
|
||||
raise ValueError(
|
||||
f"Value {value} for {entity.name} is too short (minimum length"
|
||||
f"Value {value} for {entity.entity_id} is too short (minimum length"
|
||||
f" {entity.min})"
|
||||
)
|
||||
if len(value) > entity.max:
|
||||
raise ValueError(
|
||||
f"Value {value} for {entity.name} is too long (maximum length {entity.max})"
|
||||
f"Value {value} for {entity.entity_id} is too long (maximum length {entity.max})"
|
||||
)
|
||||
if entity.pattern_cmp and not entity.pattern_cmp.match(value):
|
||||
raise ValueError(
|
||||
f"Value {value} for {entity.name} doesn't match pattern {entity.pattern}"
|
||||
f"Value {value} for {entity.entity_id} doesn't match pattern {entity.pattern}"
|
||||
)
|
||||
await entity.async_set_value(value)
|
||||
|
||||
|
|
|
@ -61,5 +61,5 @@ async def test_text_node(
|
|||
)
|
||||
|
||||
assert str(err.value) == (
|
||||
f"Value {value} for Text Node 1 1 is too long (maximum length 25)"
|
||||
f"Value {value} for text.text_node_1_1 is too long (maximum length 25)"
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue