Automation no longer triggered at a given time

To program the house heating modes for 4 zones, I have a grid of multiple entry fields for the time of trigger and the selected heating mode (eco1, eco2 …) which must be triggered time indicated.
An automation is supposed to be triggered each time the time indicated in one of these entry fields is the current time.
It launches a script that takes care of modifying and checking the condition of the heaters.

It worked for 3 years, but since this year, the automation is no longer triggered (last trigger in May 2024).
I regularly update ha, so I can say that the current version of January 2024 worked (but I cannot go back).

Samples of input fields (the input_datetime.prg_time_thermo_sal_we_02 get by the automation bellow):

Sample of automation that worked before (the script thermo_sal_prog_we works today :

- alias: "Thermostat sal prog WE 02"
  trigger:
    platform: template
    value_template: "{{ states('sensor.time') == (state_attr('input_datetime.prg_time_thermo_sal_we_02', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}"
  action:
    - service: script.turn_on
      entity_id: script.thermo_sal_prog_we
      data:
        variables:
          mode_thermostat: "input_select.prg_mode_thermo_sal_we_02"
          message: "Prog sal WE 02"

I tested the other scripts and they work … but they are never automatically launched by these automations.

I suppose something has changed in the behavior of the current hour test, or in templating … Can someone help me?

Note : I know that this system is a bit complicated, but I put it in place several years ago and I did not want to depend on a “calendar” connection, even locally. So the heating works even if the LAN is cut (at least until this year).

Thank you

If you are using the standard sensor.time, it’s state should be in your local time, but you have specified that timestamp_custom not use the local time… remove the False and it should work as expected:

trigger:
    platform: template
    value_template: |
      {{ states('sensor.time') == (state_attr('input_datetime.prg_time_thermo_sal_we_02', 'timestamp') | timestamp_custom('%H:%M')) }}
....

Than you for you reply.
I must admit that I no longer understand this line very well given the time spent since its creation.
I’ve removed the “False”, but no automation are triggered.
I’ve updated my post since I found that last trigger was in May.

Well, that’s not too weird for a heating automation… Have you double checked that both the entities still exist?

You said “both”… I did not check the sensor.time as I thought it was a “hidden system wide” sensor… and yes, it was missing (don’t ask me why) !
Now it works, I have to correct the custom_time use in another automations, but it can wait.
Thank you very much, you saved my weekend (and my electricity bills).

1 Like