Date/ Time Inputs not always triggering?

A few weeks ago I started to implement date/ time inputs for a couple of lights and fans around the house, but something weird seems to be happening recently. Sometimes the triggers work and sometimes they don’t. For example this week, over Friday and Saturday, the behavior was as follows with some of them:

.

I have triple checked my configuration and when manually triggered they work. I have no error logs on any of the inputs or automations.

Just to make sure, here is a snippet of the code I am implementing (tho it did work a week ago):

Automaton:

  - alias: "Friday Night- Turn off Living Room Light"
    trigger:
      - platform: template
        value_template: "{{ states('sensor.date_time') == (states.input_datetime.frinight_livingroom_off_time.attributes.timestamp | int | timestamp_custom('%Y-%m-%d, %H:%M', True)) }}"
    action:
      - service: switch.turn_off
        entity_id: switch.wall_switch_right_XXXXXXXXXX

Corresponding Date/ Time input:

input_datetime:
  frinight_livingroom_off_time:
    name: Living room light off at
    has_date: true
    has_time: true

So my questions has two parts:

  1. What next should I check? My hunch is that it may be network issues that interfere exactly when the automation is supposed to trigger.
  2. If I am having network issue, how should I address these? My idea in theory is to add an additional action to each automation that will run with a delay of X minutes, so each action is run twice and will (hopefully) increase the chances of the light being turned on or off.

Thoughts? Additional Suggestions?
TIA

I’ve not had a problem using date and time sensors in automation triggers. They always seem to trigger fine. The only differences are that I only use the time (sensor.time) and not the date and use an an input_text to store the time the automation should trigger rather than an input_datetime (they run daily so I’m not bothered about the date).

I think the first thing to do would be to check the Logbook in Home Assistant to check what is failing, whether it is that the automations aren’t triggering or that the automation is triggering but the action isn’t working as expected.

Thanks Steven. According to the log, the trigger runs, but the action never happens. I tried again last night… Its like something is getting ‘lost’ between the trigger and the action.

If you put your value template for the trigger into the template editor does it ever show as “true”?

@yoavi, what’s the icon did you use for “fan”? (the Q is out of the current discussion)