#triggers not working

1 messages · Page 1 of 1 (latest)

reef sand
#

Can someone please help identifying the issue. My current time in HA is Mon Apr 28 20:54:11 EDT 2025

However the value_template is giving me false instead of true and not triggering anything.

alias: 1 Aqua
description: ''
triggers:
  - id: t_co2_switch_on
    value_template: >-
      {{ as_timestamp(now()) >= as_timestamp(now().strftime('%Y-%m-%d
      14:00:00')) }}
    trigger: template
actions:
  - condition: trigger
    id:
      - t_co2_switch_on
  - data:
      message: >
        Current time: {{ now() }}, Target time: {{ now().strftime('%Y-%m-%d
        14:00:00') }}, Comparison: {{
          as_timestamp(now()) >= as_timestamp(now().strftime('%Y-%m-%d 14:00:00'))
        }}
      level: info
    action: system_log.write
mode: single

Even the template seems correct and output is as below if removing the condition validation temporarily.

lost mason
#

that's a very complicated way to just use a time trigger at 14:00

#

it's just all needlessly complicated

reef sand
#

for testing i did that. actually I used to create blueprint with similar logic, where the specified time is equal or greater than the current time

lost mason
#

triggers are a point in time, not a range of times

#

template triggers only trigger when the value changes from false to true

#

not if it's already true

reef sand
#

the above method allows both system and manual triggers any time and validate the statement

#

even template giving me correct value

lost mason
#

I guess I'm not really following what you're trying to do or what your concern is

reef sand
#

my concern is the templated command is true elsewhere but only not in trigger section

lost mason
#

you're just trying to trigger at 14:00?

#

just do that?

reef sand
#

oh no. please understand

lost mason
#

how do you even know that?

#

it won't trigger at all and won't have a trace if the trigger isn't satisfied

reef sand
#

this trigger is for use with both manual or system

The logic is either 2pm or > 2pm. Either system triggers or human does not matter

lost mason
#

and I'll say again - it won't trigger if the value_template is just true, it has to change from false to true

#

if you're manually running the actions in teh automation via automation.trigger, the trigger itself doesn't matter at all

reef sand
lost mason
#

you won't have a trigger at all if you just manually run the actions

#

so that will fail

reef sand
#

do you see this? I did a manual trigger where it resulted false

lost mason
#

yes, because there was no trigger

#

that's why the option in the UI is simply "run actions"

#

it doesn't evalue the trigger at all

reef sand
#

ok let me try

lost mason
#

If you really want to manually run an automation in addition to a regular trigger, you're better off move the action section to a script and then calling that from the automation or manually. Or if you really want to manually trigger the automation, add an event trigger that you can fire whenever you want