[HELP] Home Assistant: Automations, only triggers on "Run Action", but not automatically

Hello all,

I’ve been trying to solve a problem for a few weeks now without getting anywhere. My automations are not firing, I can trigger them manually through dev tools or in config > automations and then “Run Actions”.
I’ve tried a lot of solutions from the forums, but nothing has worked for me so far. Any ideas? Here is one of my simple automations that doesn’t work:

### Home Assistant Auto Restart
- id: "1630230394699"
  alias: Home Assistant Auto Restart
  description: ""
    - platform: time
      at: 05:00:00
    - condition: time
        - mon
        - tue
        - wed
        - thu
        - fri
        - sat
        - sun
    - service: homeassistant.restart
  mode: restart

You seem to have indentation problems.
But you need to format the code for us to be able to answer

1 Like

Copy the code from automations.yaml and paste using the </> preformatted text button in the toolbar.

Ah, there we go, edited so you can see the code easier. Thank you for quick answers! I have other automations too, but it’s just the same things more or less just more complicated. This is also one of them:

### Turn oven on when temp is 20 C
- id: "1634499709931"
  alias: Turn oven on when temp is 20 C
  description: ""
    - type: temperature
      platform: device
      device_id: 84c2c28ef648978d46f0c6a6924a03ff
      entity_id: sensor.lumi_lumi_weather_temperature
      domain: sensor
      below: 20
        hours: 0
        minutes: 0
        seconds: 0
        milliseconds: 0
  condition: []
    - type: turn_on
      device_id: b8784ad818911c85494b39aab50b2dbc
      entity_id: switch.smart_metering_plug
      domain: switch
    - delay:
        hours: 0
        minutes: 30
        seconds: 0
        milliseconds: 0
    - type: turn_off
      device_id: b8784ad818911c85494b39aab50b2dbc
      entity_id: switch.smart_metering_plug
      domain: switch
  mode: restart

Is it supposed to run every day? Why do you need the time condition?

No need for the time condition, I just did this using HA creator in automation config, not in yaml. Therefore there are some extra code that is not needed, but it shouldn’t stay in the way for the automation to run.

I would love to get some more inputs on this, I’ve seen many others have the same problem as me. Not sure how they fixed it but I can’t find anyone similar to my situation that has solved the issue.

I notice you are using restart mode - is there a reason for that?

If that is to restart the automation after triggering, that’s the reason. But is that wrong? If so, what should I use instead?

Check the log for error messages.

There is nothing about automations or anything in error logs that could be related to it. The automations have never been fired without me manually doing it. It means that they can fire, but they never do. So I know they work from doing it manually. It’s like it never does automations.

Not like you think it might.

When you execute Run Actions, or the automation.trigger service call, all it does is run the automation’s action. It doesn’t exercise the automation’s trigger so it isn’t validating its functionality. For more information, refer to: Testing your automation.

True, I have been following all the steps on YouTube and forums for trying to get this to work. Been looking at the Troubleshooting guides as well. Still nothing. And when the trigger is as simple as a time of day but it still doesn’t trigger there must be something wrong another place and not the automation itself?

Not sure, but my automations don’t have those device_id’s, just entity_id’s.

Correct. That’s why I suggested you check the log.

Here’s one possibility:

If you have a syntax error in one of your automations, that you edited with a text editor (not the Automation Editor), and then restarted Home Assistant, on startup it will refuse to load the Automations integration. The result of that is none of your automations will be triggered normally.

Automations created/edited with the Automation Editor will refuse to be saved if they contain a syntax error. Automations created with a text editor should be validated with Check Configuration. Theoretically, Home Assistant will refuse to restart if it detects a problem with its configuration (which includes defective automations) but a system reboot easily thwarts that safeguard.

Ok, I’ll look into the device_id as well as the syntax error. I have some other automations that I can get rid off. Maybe it will fix it. I’ll update on the progress.

Because your automations aren’t using Device-oriented Triggers, Conditions and Actions (which are the default offered when creating an automation with the Automation Editor). However, that’s immaterial to this problem.

See, I shouldn’t be trying to answer people’s questions :laughing:
I’ve apparently only used entity states as triggers.
Never mind me.

Every little help matters! :slight_smile:

Sorry if this is obvious, but “restart” is used to restart the automation if it is triggered a second time when it is already running. Normally you would use “single”, which is the default. If you do that, it will simply not run if it is triggered a second time when it is already running, and you’ll get a message in the log.

If it is not already running, an automation will always run when the trigger fires - you don’t need to restart it.

Again, sorry if this is obvious, but a trigger is an event, not a state. Your second automation should fire when the temperature crosses from 20C to 19C - it will not fire again until the temperature rises above 20C and drops again.