Automation at specific time not executed

Hi,

I have created an automation to open the sunshades (covers) at 19:00. Automation has these steps:
At 19:00
check if covers are closed (4 screens and an awning)
When closed open screens and awning
Send notification to mail

When I do a test run it check status, but not from all entities and then sends open command again not all, then drops me a mail.
Below the YAML code anything I missed?

lias: Zonwering Open
description: Open gesloten zonwering om 19:00
trigger:
  - platform: time
    at: "19:00:00"
condition:
  - condition: state
    entity_id: cover.markies
    attribute: current_position
    state: open
  - condition: state
    entity_id: cover.screen
    attribute: current_position
    state: closed
  - condition: state
    entity_id: cover.screen_2
    attribute: current_position
    state: closed
  - condition: state
    entity_id: cover.screen_links
    attribute: current_position
    state: closed
  - condition: state
    entity_id: cover.screen_rechts
    attribute: current_position
    state: closed
action:
  - service: cover.open_cover
    metadata: {}
    data: {}
    target:
      entity_id:
        - cover.screen
        - cover.screen_2
        - cover.screen_links
        - cover.screen_rechts
  - service: cover.close_cover
    metadata: {}
    data: {}
    target:
      entity_id: cover.markies
  - service: notify.email_1
    metadata: {}
    data:
      message: Zonwering open het is 19:00 uur
      title: Zonwering geopend
mode: single

Thanks for the support.

How did you test it?

Did you wait until 19:00 for it to trigger or did you execute the automation using its “Run” command?

If you used the “Run” command, it skips the automation’s condition section and simply executes its actions.

I did both, waited until 19:00 nothing happened, used the run command. actions get partly executed.

Are you saying the automation’s Time Trigger failed to trigger at 19:00?

Or are you saying it did trigger at 19:00 but didn’t execute any actions? In this case it will have produced a trace and you can examine it.

“Partly executed” implies a possible problem with the transmission/reception of commands between Home Assistant and the cover devices.

1 Like

The trigger failed to trigger at 19:00, so no trace.

I was thinking along those lines comms issue between ESPSomfyRTS and HA. Most likely not able to receive 4 open & 1 close instruction in 1 go. I could split the automation up, or maybe there are options to put a delay between each command send to the ESPSomfyRTS.

A Time Trigger is one of the most reliable triggers because all it has to do is monitor the system clock and trigger at its scheduled time.

If even that simple trigger fails to work, your Home Assistant system has fundamental problems.

  • If you are running Home Assistant in a Virtual Machine, ensure its clock settings are correct.

  • Go to Settings → System → General and confirm the clock-related settings are correct.

  • Go to Developer Tools → Template, enter the following template and confirm it reports the correct time.

{{ now() }}
  • Create a simple automation with a Time Trigger and an action that posts a persistent notification. Wait for it to trigger at whatever time you had set and confirm it does trigger at that time and posts a notification.

Thanks for helping out. Did the template check response:
2024-07-20 20:28:16.380411+02:00 which is correct.
Clock setting are all right too, on my local time zone (GMT+1 Amsterdam).

I run HA on a HA Yellow with PoE. I have other automation’s which work i.e. when doorbell is pressed take snapshot and mail that.

Created test for time trigger

alias: Time Trigger Test
description: ""
trigger:
  - platform: time
    at: "20:40:00"
condition: []
action:
  - service: notify.persistent_notification
    metadata: {}
    data:
      message: Time Test 20:40
mode: single

And now a few minutes to wait :slight_smile:

You do realize all conditions need to pass? So if even one cover is not the way you expect, nothing happens. Why did you put the conditions in? If is is just to prevent unneeded actions, consider removing them. There’s no harm in executing a command if the state is already right.

Time check automation worked:

I did indeed stick the conditions in to check, can run without but when automation sets state to i.e. up then I cannot manually push up again as it is up. Here is HA working somewhat different to what I was used to in Domoticz.
So ideally I would want to check status of each cover, and when state is closed send an open command to that cover.
In practice it will mean 99 out of a 100 times all will be closed so all will need to open.

You can check per cover by using an if for each action, use the the conditions block only if you want the automation not to run at all. But: The state of the cover in HA should match the state of the cover in real life. If it does, the condition won’t matter. If it does not, the condition won’t work.

If you have problems with the state of the cover being out of sync, that is what you should fix. And then, even more then ever, you should send the command for the state you want. Because testing the state in HA that does not reflect real life is not helping you at all.

So the remaining question is why did the other automation fail to trigger at 19:00?

You said it produced no trace at 19:00. Even if its conditions were not met, it would have still produced trace. However you said there was no trace so that means it never even triggered at 19:00.

That’s odd because you just confirmed that the system clock is correct and the test automation’s Time Trigger worked properly.

The latest information, based on successful tests, contradicts the allegation that the original automation failed to trigger.

Does the original automation always fail to trigger at 19:00 (i.e. it never produces a trace)? Go to Settings > Automations and Scenes and find your automation in the list. What is the time it shows when it was last triggered? Does it show a date and time or simply say “Never”?

You’re not doing this in 2 different browser windows?
Another way to bypass the time trigger, as a test, and check your automation is to make a script with the same conditions & actions to see what happens.

@Edwin_D Not sure I follow. When I close the covers state in HA matches state of covers. Then when automation would run and only 3 out the 5 are opened at that moment state does not match anymore.
Leaving me the question why when automation is executed not all covers are opened.
Will investigate this further if this is a limitation of ESPSomfyRTS, do not have this issue when running scripts controlling covers via RFXcom.
Thanks for the support!
@123 It shows the time I manually run the automation. since then it has been twice 19:00 hours.
Will start simpler with 1 cover no condition check to see if that will work. If that is the case I must have an issue with multiple covers and conditional check.
@Nick4 Did that works partially, only 3 out of the 5 covers opened :frowning:

But if all these conditions are not met, nothing happens and as Taras is saying: you should at least see that the automation has run, so something in the traces.
If that time trigger keeps bugging: close that automation and try another one with just a time trigger to see what happens.

@Nick4 See above done that :smiley:

OK, I have experienced something similar in the past and I just created a new automation.
This will most likely be much faster then trying to find out what is going wrong.

If some covers open and others do not, you have communications problems (as stated above). When that happens the state in HA does not match the state of the actual device. In that case, testing the state in HA does not work as it should - this is a reason not to trust the state in HA if you cannot avoid the fact that HA is wrong about the state of the device.

What kind of integration are you using for the covers? Are the covers communicating back, or just listening to remotes(I guess the last)? I know Somfy RTS may have problems when you send commands too quickly. When I still had those, adding a delay between each command helped.

You should have at least two traces, one for each instance that the time was 19:00.

If you don’t, delete the automation and create it again from scratch.

As for some covers opening but others not, that’s unrelated to the automation (because it is simply designed to open 4 covers and close 1) and is a problem with whatever integration you’re using to control the covers.

Thank you all for helping and pointing out path to solution.
I will create a new automation and delete his one.
@Edwin_D I build an ESPSomfyRTS module to control the covers in HA. I have RFXcom attached to HA also but to get Somfy RTS working in HA was to complicated could not program RFXcom via HA.
As I wanted to phase out KAKU and move my temp sensors to something that has an IP address and are PoE powered.
Will post the outcome off a new automation here.

1 Like

ESPSomfyRTS is pretty great at trying to keep the covers in sync, especially if you teach it the remotes you have lying around the house. Even though the blinds do not communicate back, the state should usually match. ESPSomfyRTS is also smart enough to send the command code from automations, even if the states in HA do not match the real blind. So my advise would be to only use conditions if you need them for something else, like a cover should not move if the window is open.

I did use delays together with RTS when I sent individual commands. The blinds seem to need this, and I do not know if the SomfyRTS developer does this in the firmware too. I needed the delays before I started using ESPSomfyRTS.

Last but not least: you could decide to define group codes in ESPSomfyRTS. Basically you create a new code that is programmed in all the blinds of the group. That way only one code operates all blinds exactly at the same time.

If you keep getting that blinds miss commands, try to reposition the ESPSomfy device, or consider adding a better antenna to it. The developer has some tips about it.