diff --git a/homeassistant/components/text/__init__.py b/homeassistant/components/text/__init__.py index 1cd980e71cc..f07a672afbd 100644 --- a/homeassistant/components/text/__init__.py +++ b/homeassistant/components/text/__init__.py @@ -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) diff --git a/tests/components/mysensors/test_text.py b/tests/components/mysensors/test_text.py index 3b4b5c767d3..7ed46532c8a 100644 --- a/tests/components/mysensors/test_text.py +++ b/tests/components/mysensors/test_text.py @@ -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)" )