Automations are way off time

Hello, I have an automation that acts strange, or I’m doing something wrong, I want the shutters up at sunrise and an hour after sunset, but no later than 22:30 the shutters should close.

Can anyone help and shed light on this behavior?

YAML code for closing:

alias: Rolluiken sluiten 1 uur na zonsondergang
description: Sluit rolluiken 1 t/m 5 één uur na zonsondergang
triggers:
  - event: sunset
    offset: "01:00:00"
    trigger: sun
  - trigger: time
    at: "22:30:00"
conditions: []
actions:
  - target:
      entity_id:
        - cover.rfy_020005_2
        - cover.rfy_020004_2
        - cover.rfy_020003_2
        - cover.rfy_020002_2
        - cover.rfy_020001_2
    action: cover.close_cover
    data: {}
mode: queued
max: 10

YAML code for opening:

alias: Rolluiken openen bij zonsopkomst
description: Open rolluiken 1 t/m 5 bij zonsopkomst
triggers:
  - event: sunrise
    trigger: sun
  - trigger: time
    at: "07:00:00"
conditions: []
actions:
  - target:
      entity_id:
        - cover.rfy_020005_2
        - cover.rfy_020004_2
        - cover.rfy_020003_2
        - cover.rfy_020002_2
        - cover.rfy_020001_2
    action: cover.open_cover
    data: {}
mode: queued
max: 10

Closing the shutters not works on time :frowning: and the sun up automation starts at 08:29, while the entity sun.sun indicates in the log: rise 05:53:47 - 5 hours ago

Times and time zones etc are all good, any idea?

Log:

Opening roller shutters at sunrise sunrise 08:29:06 - 2 hours ago

Roller shutter3 opened triggered by automation Roller shutters opening at sunrise 08:29:06 - 2 hours ago

Roller shutter1 opened triggered by automation roller shutters opening at sunrise 08:29:06 - 2 hours ago

Roller shutter4 opened triggered by automation Roller shutters opening at sunrise 08:29:06 - 2 hours ago

Roller shutter5 opened triggered by automation Roller shutters opening at sunrise 08:29:06 - 2 hours ago

Roller shutter2 opened triggered by automation Roller shutters opening at sunrise 08:29:06 - 2 hours ago

All roller shutters open triggered by automation roller shutters open at sunrise 08:29:06 - 2 hours ago

Edit: also a simple notify of a test to my phone shows this weird behavior. Restarted system, checked timezones etc.

Hi,

In regard to the sun, I use this block to choose between day and night. Special, I want it to act 30 minutes before sunset at night, but 30 min later in the morning.

action:
  - choose:
      - conditions:
          - alias: Illumination from dawn (day time period).
            condition: sun
            after: sunrise
            before: sunset
            after_offset: "00:30:00"
        sequence:
          - service: light.turn_on
            data:
              brightness_pct: !input day_brightness
            target: !input light_target

      - conditions:
          - alias: Illumination from dusk (night time period).
            condition: sun
            after: sunset
            before: sunrise
            after_offset: "-00:30:00"
            before_offset: "00:30:00"
        sequence:
          - service: light.turn_on
            data:
              brightness_pct: !input night_brightness
            target: !input light_target

Hello peterpijpelink

Thanks for coming here and asking a question.
Would you be so kind as to adjusting the format of your code so that we can read it properly & check the YAML spacing, etc. Editing your original is the preferred way. It is very hard for us to tell what is what when the text formatter jumbles everything like that.
You can use the </> button like this… How to format your code in forum posts
OR… Here is an example of how to fix it from the site FAQ Page.
How to help us help you - or How to ask a good question.

can you post the trace and the TZ you’re in?

By post the trace, I mean download it then put the resulting file here. You’ll need to copy/paste the contents (json).

could try, I am now deleting these automations and start over, all automations are way off time. Seems there is this issue when I make a new one it works… Keep you posted.

That won’t fix it.

100% true, you are correct, I did find time and recreated this automation again. the cover.alle_rolluiken is a helper group with all blinds in. However, if I add them separate, same issue, it was now 1 hour and 4 minutes off. I did a trace but can’t find anything what seems wrong. I do see that time like on the weather clock is 100% fine and accurate. My machine is perfect on time and still all automations are few hours late…

this is the automation:

YAML:

id: '1748719628916'
alias: Openen rolluiken om 0700
description: Rolluiken open om 07:00
triggers:
  - trigger: time
    at: '07:00:00'
conditions: []
actions:
  - action: cover.open_cover
    metadata: {}
    data: {}
    target:
      entity_id: cover.alle_rolluiken
mode: single

from the trace:

trigger: time
at: '07:00:00'

changed variable:

this:
  entity_id: automation.openen_rolluiken_om_0700
  state: 'on'
  attributes:
    id: '1748719628916'
    last_triggered: null
    mode: single
    current: 0
    friendly_name: Openen rolluiken om 0700
  last_changed: '2025-05-31T19:27:32.413714+00:00'
  last_reported: '2025-05-31T19:27:32.413828+00:00'
  last_updated: '2025-05-31T19:27:32.413714+00:00'
  context:
    id: 01JWKX0KHX74N6455WN2E5XCF7
    parent_id: null
    user_id: null
trigger:
  id: '0'
  idx: '0'
  alias: null
  platform: time
  now: '2025-06-01T08:03:17.227908+02:00'
  description: time
  entity_id: null

Checked sensor.date (now it is obvious later) and it is fine on time:
date 20250601.0
Last Updated: 2025-06-01T12:00:50.125598+02:00
unit_of_measurement:
icon: mdi:alert-circle
friendly_name: date

any genius has a idea??

I need to see the trace. Download the full trace as a file. I’m not saying “download the trace” for no reason.

okay, what trace do you mean? Please explain where to find and I get it, in the meantime, I did switch off the sync time from VMware to the HA vm, hopefully that does help… there seems to be more issues with time sync in virtual environments.

When you view the trace you posted above, instead of copy/pasting the variables. Click the 3 dots in the corner and download the trace.

here is the trace, it was now within 5minutes (still late, butt better than 2,5hrs)

JSON

{
  "trace": {
    "last_step": "action/0",
    "run_id": "eb68167f9e9fe9869dfcd256ebdbc8d2",
    "state": "stopped",
    "script_execution": "finished",
    "timestamp": {
      "start": "2025-06-02T05:05:04.803130+00:00",
      "finish": "2025-06-02T05:05:04.810763+00:00"
    },
    "domain": "automation",
    "item_id": "1748719628916",
    "trigger": "time",
    "trace": {
      "trigger/0": [
        {
          "path": "trigger/0",
          "timestamp": "2025-06-02T05:05:04.803172+00:00",
          "changed_variables": {
            "this": {
              "entity_id": "automation.openen_rolluiken_om_0700",
              "state": "on",
              "attributes": {
                "id": "1748719628916",
                "last_triggered": "2025-06-01T06:03:17.228241+00:00",
                "mode": "single",
                "current": 0,
                "friendly_name": "Openen rolluiken om 0700"
              },
              "last_changed": "2025-06-01T12:32:44.006881+00:00",
              "last_reported": "2025-06-01T12:32:44.006881+00:00",
              "last_updated": "2025-06-01T12:32:44.006881+00:00",
              "context": {
                "id": "01JWNQNSF682R01JKV436QX15M",
                "parent_id": null,
                "user_id": null
              }
            },
            "trigger": {
              "id": "0",
              "idx": "0",
              "alias": null,
              "platform": "time",
              "now": "2025-06-02T07:05:04.802910+02:00",
              "description": "time",
              "entity_id": null
            }
          }
        }
      ],
      "action/0": [
        {
          "path": "action/0",
          "timestamp": "2025-06-02T05:05:04.803473+00:00",
          "changed_variables": {
            "context": {
              "id": "01JWQGETS3806N1H79GRSX2C9P",
              "parent_id": null,
              "user_id": null
            }
          },
          "result": {
            "params": {
              "domain": "cover",
              "service": "open_cover",
              "service_data": {},
              "target": {
                "entity_id": [
                  "cover.alle_rolluiken"
                ]
              }
            },
            "running_script": false
          }
        }
      ]
    },
    "config": {
      "id": "1748719628916",
      "alias": "Openen rolluiken om 0700",
      "description": "Rolluiken open om 07:00",
      "triggers": [
        {
          "trigger": "time",
          "at": "07:00:00"
        }
      ],
      "conditions": [],
      "actions": [
        {
          "action": "cover.open_cover",
          "metadata": {},
          "data": {},
          "target": {
            "entity_id": "cover.alle_rolluiken"
          }
        }
      ],
      "mode": "single"
    },
    "blueprint_inputs": null,
    "context": {
      "id": "01JWQGETS3806N1H79GRSX2C9P",
      "parent_id": null,
      "user_id": null
    }
  },
  "logbookEntries": [
    {
      "name": "Openen rolluiken om 0700",
      "message": "triggered by time",
      "source": "time",
      "entity_id": "automation.openen_rolluiken_om_0700",
      "context_id": "01JWQGETS3806N1H79GRSX2C9P",
      "domain": "automation",
      "when": 1748840704.8032687
    },
    {
      "state": "open",
      "entity_id": "cover.rfy_020003_2",
      "when": 1748840704.8068912,
      "context_event_type": "automation_triggered",
      "context_domain": "automation",
      "context_name": "Openen rolluiken om 0700",
      "context_message": "triggered by time",
      "context_source": "time",
      "context_entity_id": "automation.openen_rolluiken_om_0700"
    },
    {
      "state": "open",
      "entity_id": "cover.rfy_020002_2",
      "when": 1748840704.8069553,
      "context_event_type": "automation_triggered",
      "context_domain": "automation",
      "context_name": "Openen rolluiken om 0700",
      "context_message": "triggered by time",
      "context_source": "time",
      "context_entity_id": "automation.openen_rolluiken_om_0700"
    },
    {
      "state": "open",
      "entity_id": "cover.alle_rolluiken",
      "when": 1748840704.8070562,
      "context_event_type": "automation_triggered",
      "context_domain": "automation",
      "context_name": "Openen rolluiken om 0700",
      "context_message": "triggered by time",
      "context_source": "time",
      "context_entity_id": "automation.openen_rolluiken_om_0700"
    },
    {
      "state": "open",
      "entity_id": "cover.rfy_020004_2",
      "when": 1748840704.8077989,
      "context_event_type": "automation_triggered",
      "context_domain": "automation",
      "context_name": "Openen rolluiken om 0700",
      "context_message": "triggered by time",
      "context_source": "time",
      "context_entity_id": "automation.openen_rolluiken_om_0700"
    },
    {
      "state": "open",
      "entity_id": "cover.rfy_020001_2",
      "when": 1748840704.809375,
      "context_event_type": "automation_triggered",
      "context_domain": "automation",
      "context_name": "Openen rolluiken om 0700",
      "context_message": "triggered by time",
      "context_source": "time",
      "context_entity_id": "automation.openen_rolluiken_om_0700"
    },
    {
      "state": "open",
      "entity_id": "cover.rfy_020005_2",
      "when": 1748840704.8094525,
      "context_event_type": "automation_triggered",
      "context_domain": "automation",
      "context_name": "Openen rolluiken om 0700",
      "context_message": "triggered by time",
      "context_source": "time",
      "context_entity_id": "automation.openen_rolluiken_om_0700"
    }
  ]
}

uncheck of the sync time to vm did the trick, it looks solved. So VMware fusion and HA in a vm, uncheck sync time.