From eac4921e3f5cd2f049bd8de4e3c011dcfe36e54c Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Sun, 30 Apr 2023 16:34:30 -0400 Subject: [PATCH] Add `time` entity developer docs (#1534) Co-authored-by: Teemu R. --- docs/core/entity/time.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 docs/core/entity/time.md diff --git a/docs/core/entity/time.md b/docs/core/entity/time.md new file mode 100644 index 00000000..f0ff2350 --- /dev/null +++ b/docs/core/entity/time.md @@ -0,0 +1,36 @@ +--- +title: Time Entity +sidebar_label: Time +--- + +A `time` is an entity that allows the user to input a time to an integration. Derive entity platforms from [`homeassistant.components.time.TimeEntity`](https://github.com/home-assistant/core/blob/dev/homeassistant/components/time/__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 | time | **Required** | The value of the time. + +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 MyTime(TimeEntity): + # Implement one of these methods. + + def set_value(self, value: time) -> None: + """Update the current value.""" + + async def async_set_value(self, value: time) -> None: + """Update the current value.""" + +```