Automation not subscribing to state('date_time_iso')?

Hi all,

I have an automation to monitor the state change of my 3D printer every minute, however, it does not seem to trigger with a time_date sensor, this is the Trigger Value Template I have:

{{ states('sensor.x1c_00m00a2c0603733_current_stage') == "Unknown" and states.sensor.x1c_00m00a2c0603733_current_stage.last_changed > as_datetime(as_timestamp(states('sensor.date_time_iso'))) - timedelta(minutes=30) }}

Interestingly, if I just have states(‘sensors.date_time_iso’) it is triggering correctly.

Is there a limit to how deep home assistant will evaluate an expression before it considers a state for state subscription?

Thanks.

states('x1c_00m00a2c0603733_current_stage') is missing a domain… so your comparison will always be false…

1 Like

Even if it is incorrect, the automation should trigger once per minute due to sensor.date_time_iso, but it is not even firing?

No, it will trigger when the evaluation of the template changes from false to true… the template will be reevaluated every minute.

{{ states('sensor.x1c_00m00a2c0603733_current_stage') == "unknown"
 and states.sensor.x1c_00m00a2c0603733_current_stage.last_changed < 
now() - timedelta(minutes=30) }}
1 Like