Time trigger not working on Automation

Looks good there. Perhaps a timezone issue based on that prior screenshot, although that may be expected UTC in logs? Does it switch the light an hour later than expected? What do you have for HA timezone?

image

Yeah the timezone is UTC

image

And… holy smokes…

image

System time: 11:03… automation time: 10:03 :confused:

So its indeed a timezone issue… how do I fix this?

Configuration / General. Odd that you “have other time automations that work just fine”.

Wondering if its because all the time ones we’re created a long time ago? Not sure actually… :confused:

What do you get in the template editor if you enter this:

{{ utcnow() }} {{ utcnow().tzinfo }}
{{ now() }} {{ now().tzinfo }}
{{ now().astimezone() }} {{ now().astimezone().tzinfo }}

I have been getting odd stuff going with time since upgrade to 0.113.x. Twice now the time has gotten stuck, causing automations based on sensor.time to not work at all.

See topic linked by @troon further up in thread on 31 July - Sensor.time problem

Thanks, but a time trigger is different from a state trigger using sensor.time. Of course there could be some underlying issue that affects both, but just wanted to be clear.

Hello,

I have smae issue and try to make a simple holiday light automation and when i use a time to switch on it will not work. My code is as follows:

alias: vakantieverlichting aan
 description: ''
 trigger:
 - platform: time
   at: input_datetime.tijd_vakantieverlichting_inschakelen
 condition:
 - condition: and
   conditions:
   - condition: state
     entity_id: input_boolean.vakantie
     state: 'on'
 action:
 - service: light.turn_on
   data: {}
   entity_id: light.holyday_lights
 mode: single

When i use an other trigger like a switch it works. Looks like something simple but i dont know :frowning:
I hope someone can help me further with this.

I dont have failure in logbook or so,

Thanks in advance

Regards

Wilfried

Hello,

It is solved.

Wilfried

Hi, same there.
How have you solved it?

In my case it was the timezone it was wrongly setup so all the automations were indeed working but with an hour delay. Not sure if its the same case as you.

Exactly the same. But just setting the timezone in settings wasn’t enough. Had to restart the server.
Now it’s solved as well

1 Like

has this officially been fixed?

I have exactly the same problem. Time zone is correct, I even changed it to another city, did not work either. dev tools now() states the correct time and I have restarted HA various times.
The holiday sensor works properly, I use it in other automations with sunrise and that works like a charm.

This is my automation. It works with sunrise, but not with time :frowning:

Any ideas?

alias: Cover Up Weekday
description: ''
trigger:
  - platform: time
    at: '8:00:00'
condition:
  - condition: state
    entity_id: binary_sensor.holiday
    state: 'off'
action:
  - device_id: 3230cfb2f23ff6ed08771ca482d95e62
    domain: cover
    entity_id: cover.covername
    type: set_position
    position: 100
mode: single

Shouldn’t be the reason, but have you tried 08:00?

Yes I did, in fact it was ‘08:00:00’ before - same result: not working

I was running HA OS in a VM in VirtualBox onDdebian. I moved the VM to a windows host (of all things) and my time issues went away.

I think it was relatve to the somfy integration. I moved to the Tahoma integration and it is working ever since. I must say it did work also with Somfy (I moved the time from 08:00:00 to 08:01:01 and it worked, but I also learned that the official Somfy integration is struggling sometimes, unless it is reloaded - I just moved to Tahoma and I also left the time-trigger at 08:01:01 and its all working ever since.

1 Like

I’ve resolved my issue by setting up the timezone correcty in the UI:
http://homeassistant:8123 → Settings → System → General

I first restored a backup I made when a clean install, and then changed the timezone as above, then configured the automation. All worked after doing that.

I know this is an old thread but I setup some new automations about 4-5 months ago and realized that none of them are triggering. Two days ago I decided to add an additional trigger of going off every X number of hours. Still nothing. My time zone is set correctly. Any other ideas?

alias: HVAC Filter Needs Cleaned - Chore
description: ""
trigger:
  - platform: time
    at: "18:00:00"
  - platform: time_pattern
    hours: "23"
condition:
  - condition: template
    value_template: "  value_template: \"{{ as_timestamp(now()) > (as_timestamp(states('input_datetime.cleaned_hvac_filter_chore')) + 15552000) }}\""
action:
  - service: input_boolean.turn_on
    data: {}
    target:
      entity_id:
        - input_boolean.hvac_filter_needs_cleaned_chore
  - service: notify.mobile_app_iphone_wf4l1910mh
    data:
      message: Clean HVAC Filter
  - service: notify.mobile_app_iphone_12
    data:
      message: HVAC Filter Needs Cleaned
mode: single

You’ll probably find errors in your logs, as that condition is nonsense. I suspect you want:

    value_template: "{{ as_timestamp(now()) > (as_timestamp(states('input_datetime.cleaned_hvac_filter_chore')) + 15552000) }}"

Your time pattern trigger will not fire every 23 hours: it will fire at 23:00 only. See the documentation.