Automation is sometimes not running when it should

I finally got my HVAC automation working in a v1 state. The other night I started a fork to begin refactoring it, but now the original has stopped working, sometimes. Both the time-based & condition-based triggers are triggering, but not consistently.

It’ll indicate the trigger, then… nothing. The Trace just shows nothing, which doesn’t make sense because i have a default Choose action that it’ll pick if there’s no action needed, and that default will trigger success fully

What’s also weird is that if I update the HVAC in the Dashboard, then I’ll get the notification from the automation that should only run at the end of the automation.

I’ve seen a full successful time-based activation trace, and a full condition-based activation trace, but I’ve also seen them just stop after the trigger.
Additionally, if I click Run in the UI, nothing happens.

This is the yaml for it in it’s current state:

Here’s some screenshots from my UI:

Anyone have tips on how to troubleshoot this? I have no idea what to do if Traces aren’t showing anything.

You have commented out a big part of your code in the below 68 part.

And what are you expecting this to do?

temperature: >-
                    {{ 65 if (now() | as_timestamp() | int(1000)) >= 57600 and
                    (now() | as_timestamp() | int(1000)) < 21600 else 70 }}
                

As I see it you could just have set the temperature to 70

Hi Jacob Lee,

Follow the highlighted path and see where it stops. That’s the step that it’s hung at or busy with or stopped at. then click the other things to see the status of what it sees at that point and determine what happened.
If I were to guess, it looks like it got to the first action statement and is waiting for this:


  - wait_template: "{{ has_value('climate.main_house') }}"
    alias: Wait for main_house to be available
  - data:
      name: main_house temp
      message: "{{state_attr('climate.main_house', 'current_temperature')}}"
      entity_id: climate.main_house
    action: logbook.log
    alias: log main_house current_temp

.

@Hellis81 The GIST link is there, or at least it’s there now if you want to dig into the code for specifics. I suck at that.

What part is commented out?

That template is setting the target temp based on time of day; it sets it to 70 in the daytime, but 65 at night. I do need to refactor it to apply the schedule better, but it was working properly previously.

I’ve seen the wait work, both with an immediate true, and once with a over a hundred false then a true.
Is it possible that it’s timing out even if I don’t have a timeout value set?

I’ll try adding a sleep(30) in there too, just to be gentler.
Updated gist: Revisions · 240917-hvac_automation.yaml · GitHub

It could be just waiting for the condition, running… Stuck…

All the code that is within the red part has a different color.
That meas it’s a comment.

It does not change with day night.
Currently the timestamp is about 1726808330.
So yes that is more than 57600 and it can’t ever be less than 21600 at the same time.
Its just impossible.

yeah, I think that’s exactly what’s happening. that also explains why i suddenly get a bunch of the notifications all at once. It doesn’t explain why my Ping tool tells me the unit it always available, but that’s a different problem…

So I tried to use > alone, like what is shown in the templating documentation: Templating - Home Assistant

But that throws an error in the config editor, and the only way i got it to accept was to make it >- instead.