Skip to main content

Date/Time Entity

A datetime is an entity that allows the user to input a timestamp to an integration. Derive entity platforms from homeassistant.components.datetime.DateTimeEntity



Properties should always only return information from memory and not do I/O (like network requests). Implement update() or async_update() to fetch data.

native_valuedatetime.datetime | NoneRequiredThe value of the datetime. Must include timezone info.

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


Set value

Called when the user or an automation wants to update the value. The input datetime will always be in UTC.

class MyDateTime(DateTimeEntity):
# Implement one of these methods.

def set_value(self, value: datetime) -> None:
"""Update the current value."""

async def async_set_value(self, value: datetime) -> None:
"""Update the current value."""