Skip to main content

Text Entity

A text entity is an entity that allows the user to input a text value to an integration. Derive entity platforms from homeassistant.components.text.TextEntity

Properties

tip

Properties should always only return information from memory and not do I/O (like network requests). Implement update() or async_update() to fetch data or build a mechanism to push state updates to the entity class instance.

NameTypeDefaultDescription
modestringtextDefines how the text should be displayed in the UI. Can be text or password.
native_maxint100The maximum number of characters in the text value (inclusive).
native_minint0The minimum number of characters in the text value (inclusive).
patternstrNoneA regex pattern that the text value must match to be valid.
native_valuestrRequiredThe value of the text.

Other properties that are common to all entities such as icon, name etc are also applicable.

Methods

Set value

class MyTextEntity(TextEntity):
# Implement one of these methods.

def set_value(self, value: str) -> None:
"""Set the text value."""

async def async_set_value(self, value: str) -> None:
"""Set the text value."""