feature-requests icon indicating copy to clipboard operation
feature-requests copied to clipboard

Support new date, time and date/time entities in Home Assistant

Open mill1000 opened this issue 1 year ago • 5 comments

Describe the problem you have/What new integration you would like

The latest Home Assistant release (2023.6) just added support for integrations to provide date, time and date/time entities.

Quote from the release announcement.

These entities allow integrations to provide date, time, or date/time input controls from the UI. They are very similar to the input datetime helper but are available for use by integrations.

I would like to see ESPHome support these entities so we can have UI configuration for time automation.

Please describe your use case for this integration and alternatives you've tried:

I currently implement a solution using a input_datetime helper with a Home Assistant attribute sensor to pull in the timestamp and then make comparisons using an on_time trigger every minute.

At very least, it would be nice if ESPHome could provide the date, time or date/time entities even if they don't integrate automatically with the on_time trigger. This would at least eliminate the need to manually create and link an input_datetime to the device.

Additional context

#1333 also made a similar request, but there wasn't HA support at the time. The linked alarm clock example utilizes a similar solution to the one I described above.

mill1000 avatar Jun 07 '23 22:06 mill1000

I have started working towards this.

jesserockz avatar Jun 08 '23 21:06 jesserockz

@jesserockz How do we use this? I mean what's requested in https://github.com/esphome/feature-requests/issues/2100 and https://github.com/esphome/feature-requests/issues/1004 so we can specify a time/date via a helper components, and that could time-trigger automations within ESPHome? Is that possible?

nagyrobi avatar Nov 29 '23 13:11 nagyrobi

I don't this feature has been implemented yet.

mill1000 avatar Nov 29 '23 20:11 mill1000

@jessrockz Is there any progress on this? We can add an Input Helper and text_sensor to do this, but it's clunky. The scenario I'm looking at is to allow me to set a timeout for a relay and know it will be honoured even if the HA connection goes down. It seems far better to tell the ESPHome instance when I want the relay to be switched off, rather than trusting that HA will be around to actually turn it off in the future (particularly for longer timeouts). A datetime sensor on ESPHome that I can set when I turn on the relay would allow the ESPHome code itself to check when the timer has expired and automatically turn off the relay.

thargy avatar Jan 17 '24 14:01 thargy

The start of this was just added in v2024.3.0:

  • https://esphome.io/components/datetime/
  • https://esphome.io/components/datetime/template

So far it only supports the date type. No support for time type or datetime type yet.

Unfocused avatar Mar 20 '24 07:03 Unfocused

time support is coming up:

  • https://github.com/esphome/esphome/pull/6399

Unfocused avatar Mar 23 '24 13:03 Unfocused

Support for the time type will be in ESPHome 2024.4.0, which is currently in beta.

The final piece is the datetime type (combining both date and time in one entity), which is being worked on in this PR:

  • https://github.com/esphome/esphome/pull/6513

Unfocused avatar Apr 16 '24 01:04 Unfocused