Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add date entity developer docs #1533

Merged
merged 4 commits into from
Apr 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 36 additions & 0 deletions docs/core/entity/date.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: Date Entity
sidebar_label: Date
---

A `date` is an entity that allows the user to input a date to an integration. Derive entity platforms from [`homeassistant.components.date.DateEntity`](https://github.com/home-assistant/core/blob/dev/homeassistant/components/date/__init__.py)

## 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.
:::

| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| native_value | date | **Required** | The value of the date.

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

## Methods

### Set value

Called when the user or an automation wants to update the value.

```python
class MyDate(DateEntity):
# Implement one of these methods.

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

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

```