---
title: "Input datetime"
description: "Spook adds actions to create and delete input datetime helpers in Home Assistant from your automations and scripts, without a trip to the helper settings."
canonical_url: "https://spook.boo/input-datetime"
---
# Input datetime

> Spook adds actions to create and delete input datetime helpers in Home Assistant from your automations and scripts, without a trip to the helper settings.

The input datetime helper in Home Assistant holds a date, a time, or both, that can be set from a dashboard or from automations, and used as a trigger. An alarm clock you can put on a dashboard, for example.

Spook adds actions to the input datetime integration to create and delete these helpers from automations and scripts.

## Actions

Spook adds two actions for input datetimes. You find them wherever you add an action, marked with a 👻.

### Create an input datetime

Creates a new input datetime helper, the same as adding one on the helpers page.

Some moments only matter for a while. The time the guests are due, the day the holiday ends, the moment a script should check back. Made by hand, that helper stays on the helpers page long after. Made with this action, the script makes it when it needs it, and [deletes it](#delete-an-input-datetime) when it is done.

**How to use it**

1. Open the automation or script that should make the helper, and select **Add action**.
2. Search for **create an input datetime**, and select **Input datetime: Create an input datetime 👻**.
3. Fill in **Name**, like `Wake up`.
4. Turn on **Has a date**, **Has a time**, or both. At least one has to be on.
5. Optionally, set **Input datetime entity ID** to pick the entity ID yourself, **Initial value**, and **Icon**.
6. Select **Save**.

Just want to see it work? [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=input_datetime.create) opens it in your Home Assistant, ready to run once.

![The Actions tool with Create an input datetime 👻 picked and filled in with an example.](https://spook.boo/images/screenshots/en/light/action-input-datetime-create.webp)

What **Try this action** opens, filled in with an example.

**Technical details**

| Action properties |
| --- |
| Action | Input datetime: Create an input datetime 👻 |
| Action name | `input_datetime.create` |
| Action targets | No targets |
| Action response | Optional, the `entity_id` of the new input datetime |
| Spook's influence | Newly added action |
| Tools | [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=input_datetime.create) [![Open your Home Assistant instance and show the Actions tool with a specific action selected.](https://my.home-assistant.io/badges/developer_call_service.svg)](https://my.home-assistant.io/redirect/developer_call_service/?service=input_datetime.create) |

| Action data parameters |
| --- |
| Attribute | Type | Required | Default / Example |
| `name` | string | Yes | `Wake up` |
| `input_datetime_id` | string | No | `wake_up` |
| `has_date` | boolean | No | `false` |
| `has_time` | boolean | No | `true` |
| `initial` | string | No | `07:30:00` |
| `icon` | string | No | `mdi:alarm` |

At least one of `has_date` and `has_time` has to be on, and both are off when left out, so give at least one. An initial value has to be something Home Assistant can read as a date, a time, or both. One it cannot read is refused before anything is made.

Without an `input_datetime_id`, the entity ID follows the name, as it does in the UI, and gets a number at the end if that name is already taken. With an `input_datetime_id`, you get exactly that entity ID or an error: one that is already taken is refused, and does not get a number at the end.

**Example actions in YAML**

Make a wake up time, set to half past seven, and keep its entity ID for the steps after it:

```yaml
action: input_datetime.create
data:
  name: "Wake up"
  input_datetime_id: wake_up
  has_time: true
  initial: "07:30:00"
response_variable: created
```

The new input datetime's entity ID is then in `{{ created.entity_id }}`.

### Delete an input datetime

Deletes one or more input datetime helpers.

The other half of [Create an input datetime](#create-an-input-datetime): the script that made a helper cleans it up again. It works on any input datetime made in the UI as well, disabled ones included.

**How to use it**

1. Open the automation or script that should do the cleaning up, and select **Add action**.
2. Search for **delete an input datetime**, and select **Input datetime: Delete an input datetime 👻**.
3. Under **Entity ID**, choose the input datetimes to delete.
4. Select **Save**.

Just want to see it work? [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=input_datetime.delete) opens it in your Home Assistant, ready to run once. Mind that it really deletes.

![The Actions tool with Delete an input datetime 👻 picked and filled in with an example.](https://spook.boo/images/screenshots/en/light/action-input-datetime-delete.webp)

What **Try this action** opens, filled in with an example.

**Technical details**

| Action properties |
| --- |
| Action | Input datetime: Delete an input datetime 👻 |
| Action name | `input_datetime.delete` |
| Action targets | No targets |
| Action response | No response |
| Spook's influence | Newly added action |
| Tools | [Try this action](https://my.home-assistant.io/redirect/developer_call_service/?service=input_datetime.delete) [![Open your Home Assistant instance and show the Actions tool with a specific action selected.](https://my.home-assistant.io/badges/developer_call_service.svg)](https://my.home-assistant.io/redirect/developer_call_service/?service=input_datetime.delete) |

| Action data parameters |
| --- |
| Attribute | Type | Required | Default / Example |
| `entity_id` | string \| list of strings | Yes | `input_datetime.wake_up` |

**Example actions in YAML**

Remove the wake up time again:

```yaml
action: input_datetime.delete
data:
  entity_id: input_datetime.wake_up
```

**Known limitations**

- Input datetimes set up in YAML can only be removed from the YAML. Asking for one is an error.
- Everything in the list is checked first: if one of them cannot be deleted, none of them are.

## Use cases

What people use this for:

- Let a script make the date or time it needs, and clean it up again afterwards, so the helpers page only has input datetimes you actually use.


## Sitemap

See the full [sitemap](https://spook.boo/sitemap.md) for all pages.
