From bbd8f67c49bdddb878fcdceb248b1c29f3e70511 Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Sun, 30 Apr 2023 14:35:06 -0400 Subject: [PATCH] Add `date` entity developer docs (#1533) Co-authored-by: Franck Nijhof --- docs/core/entity/date.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 docs/core/entity/date.md diff --git a/docs/core/entity/date.md b/docs/core/entity/date.md new file mode 100644 index 00000000..73bb0da8 --- /dev/null +++ b/docs/core/entity/date.md @@ -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.""" + +```