Can't enable automation

I have multiple automations like everyone, but some of them are auto disabled. I do have some automations that are disabling other automations when some conditions are met, but this one specific automation is untouched. When I click the enable button, after 1 second it is automatically disabled.

What should I start looking for? Is it something I missed, or did something wrong?

I am currently running the latest update 0.109, but this happened in 0.108 and I think in 0.107 too but I am not sure.

Did you check you log? Also did you use the initial_state parameter?

I couldnt find anything relative in my logs. Maybe I missed it? I dont know… :confused:
No, I dont have the initial_state, but that would only help to have the automations enabled after restarting HA… Thats not the case… The automations CANNOT be enabled… I click the enable button and it immediately disables itself.
This doesnt happen to all automations. It happens randomly.
Some hours after this post, I restarted HA and everything is fine. I dont know how long it takes before it starts behaving like this again.

If you don’t find anything useful in the UI logs, try looking in home-assistant.log. There should be INFO lines that might help shed light on what’s happening. If that still doesn’t help, try:

logger:
  default: info
  logs:
    homeassistant.core: debug

That will generate a lot more detail in home-assistant.log, but hopefully should make it clear what’s happening.

But my guess as to what is happening is there is something wrong with the automation’s trigger(s.) If you look in home-assistant.log, near the beginning, you’ll probably find an ERROR line that contains: “Error setting up trigger”. This is probably happening before the UI log is set up, which would explain why you’re not seeing the error there.

Can you post the automation that you’re having trouble with (which you should almost always do anyway when you’re asking for help)? Maybe we can spot a simple problem that can be easily corrected.

I have the same issue with one of my automations.
Every now and then it stops working.

The automation runs every second as the trigger (/1) and the action is to increment a number.
Nothing fancy going on but it still stops working after some reboots.

It would be helpful if you, too, could post the automation. Also, any clues in home-assistant.log? If not, as I suggested above, enabling debug can help shed light on what’s happening.

Thank you for your reply. There is nothing referring to a trigger in the logs. I searched the word “trigger” if thats ok (the log is 2MB long).
Here is the automation:

- id: '1587751375531'
  alias: '[TTSTEXTS] AUTO TURN ON OPENINGS TTS'
  trigger:
  - entity_id: automation.ttstexts_openings_tts
    for: 01:00:00
    platform: state
    to: 'off'
  condition: []
  action:
  - data: {}
    entity_id: automation.ttstexts_openings_tts
    service: automation.turn_on

This is straight from the automations.yaml file which is auto generated. I have created all my automations from the gui. Dont ask me why. 3 years now I am using the yaml to write my automations, but I recently formatted my raspberry and I thought I would give it a try. So here I am. Nevertheless, this was happening even before the formatting.

sidenote: the automation is working fine. My problem is that it is disabling itself sometimes… And my guess is that this is happening randomly, or at least that is what I think. I havent noticed a pattern anyway…
this hasnt happened for 2 days now… yet…

What editor do you use?
Notepad++ can load all your yaml files and you can search for automation turn off actions (same is true for vsc, or you can just search in your OS for files within a folder (including sub folders) for files containing ‘text’)
Do you use automation turn off?
I don’t as the status is then sometimes in question (just use an appropriate boolean in the condition).

The purpose of this automation is simple but let me explain the whole thing to make it clear.
I am having a TTS announcer, as I have speakers all over my house. When a door or window opens or closes, the TTS informs me of that using automatiion (A). When it is late at night and when some conditions are met, I am turning off the automation (A), so it will remain silent.

The automation I posted before is automation (B) and is making sure that automation (A) will turn back on after 1 hour.
Since automation (B) is disabled randomly, automation (A) will stop announcing even after the hour passes by.

Now, after 2 days (and after my previous post that I made 2 hours ago) I noticed that automation (B) is again disabled. I cant turn it back on.

You asked about my editor. I am using notepadd++ and yes, I have already done that, but didnt find anything.
I also searched again for “triggers” in my logs since the automation is disabled once again, but no luck. If I restart home assistant or press the EXECUTE button on the automations page, the automation will be enabled again…
Thanks for any help guys.
Opera Snapshot_2020-05-03_155753_192.168.1.20

1 Like

Probably ought to post automation A too in case the issue is there.

You can’t even turn on automation B manually?

Just to clarify…

When you say “turn on” you mean set the automation state to “on”? Or do you mean to trigger automation B?

We’re all scratching our heads here, you seem to have checked everything.
Wild stab n the dark, rather than a trigger could it instead be a trigger that then runs a script.? So we’re looking in the wrong place ?

Did you make any changes in the yaml file, then you can not enable/disable it in the UI or is your speaker on a diverent subnet ?

If you enable debug for core as I suggested above, then you can search home-assistant.log for state_changed events for that automation. You’ll be able to find when it gets turned off, and if you look at what happened in the log previous to that, hopefully it should tell you what turned it off.

@finity Yes, when I say turn on I mean the state. Not executing/triggering the automation.
@Mutt Remember mentioning formatting the raspberry recently? I am manually reconfiguring everything (instead of copy-paste my old config into the new setup) and I havent even touched scripts. I have no scripts in my setup yet.
@wolfpins No changes in the yaml file. Even if that was the case, if you check my previous post, I mention that the automation goes “on” when i restart HA or when i click the “execute” button aka when I manually trigger the automation. Then I have to wait some time (completely random to 10 hours - 2 days) and then it goes off by itself…

OK, I tried something after my last post.

With automation (B) turned off (aka bugged), I turned off automation (A). That means that after 1 hour it would remain “off”… Newsflash everybody… Automation (A) turned back on, meaning automation (B) worked normally even though it LOOKS to be “off”.
When I checked automation (B), it now says “ON”…

What I am thinking is that the bug is only visual! What I havent noticed is the state from the developer tools… Next time it goes “off” I will have to check the state and report back to you.
Duh! How havent I thought of that? The gui from the automation dashboard said it is “off” but I never checked the “states” tab! I will next time it happens and I will report back the results!
If it still doesnt make any sense, I will enable the debug log as @pnbruckner suggested…

I am just posting my 2 automations here, for reference:
Automation (A):

- id: '1587748218344'
  alias: '[TTSTEXTS] OPENINGS TTS ANNOUNCER'
  trigger:
  - entity_id: input_text.openingstts
    platform: state
  condition: []
  action:
  - data:
      message: '{{states.input_text.openingstts.state}}'
    service: notify.tts_lenovo
  - data:
      value: ''
    entity_id: input_text.openingstts
    service: input_text.set_value

Automation (B):

- id: '1587751375531'
  alias: '[TTSTEXTS] AUTO TURN ON OPENINGS TTS'
  trigger:
  - entity_id: automation.ttstexts_openings_tts
    for: 01:00:00
    platform: state
    to: 'off'
  condition: []
  action:
  - data: {}
    entity_id: automation.ttstexts_openings_tts
    service: automation.turn_on

Hmm, just exactly where are you seeing that? In a card of all automations? If so, I noticed a while ago that that is sometimes wrong. I don’t know why, and never looked into it. If you click on it to bring up its “more info” window, that window should show the correct on/off state. And, of course, the STATES tab in Developer Tools will, too.

Here:

I dont know… My brain just never thought of checking the real state of the automation from the developer tools…

Should automation A be controlled by automation B?

If so then I think the entity_id for trigger and action in automation B is incorrect.

Shouldn’t it be something like “automation.ttstexts_openings_tts_announcer”?

You have “automation.ttstexts_openings_tts” which seems to be leaving off the “_announcer” part.

Thank you for noticing that! You are indeed right, but for some reason, I cant remember now, I have changed the entity_id of that automation. Take a look at this:
Opera Snapshot_2020-05-03_211804_192.168.1.20

Good catch though!

Yes. But only for turning it on.
Nothing controls Automation (B)

I’m sorry about this, and I understand all the hate, but it’s just impossible to copy text from the app and I’m in bed now.
But this is a very simple automation as I said.
Just increment a counter.

Just as Argy says it just won’t enable in the GUI window. It does not run in the background I know that for sure.
So it’s not just “visual” for me.

It stops working and starts working after reboots. Sometimes many reboots before it “toggles”.
Have never looked in the logs, it’s not a big problem for me if this is off, so I have not spent much time on it.