Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95312

Trigger automation 15 minutes before date_time stored in input_datetime

$
0
0

@flemmingss wrote:

Okey, I have this in my configuration.yaml file:

sensor:
  - platform: time_date
    display_options:
      - 'time'
      - 'date'
      - 'date_time'
      - 'date_time_iso'
      - 'time_date'
      - 'time_utc'
      - 'beat'

input_datetime:
  flemming_phone_next_alarm_date_and_time:
    name: Flemmings neste alarm
    has_date: true
    has_time: true

I want to trigger an automation 15 min before the above input_datetime.

Example:
If input_datetime is 2019-11-02 15:45:00 I want the automation to trigger 2019-11-02 15:30:00.
If input_datetime is 2019-11-02 00:05:00 I want the automation to trigger 2019-11-01 23:50:00.

By the way, checking the template I see the formatting of sensor.date_time and my input_datetime is not the same:
{{ states.sensor.date_time.state }} show as 2019-10-30, 13:30
{{ states.input_datetime.flemming_phone_next_alarm_date_and_time.state }} show as 2019-10-30 13:30:00

Tried to google, and I find examples on time and date separate, but not with them together, and with trigger in “past-time”

Posts: 10

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 95312

Trending Articles