Automation won't save

New Ha user,
Trying to save code

triggers:
  - trigger: switch.turned_on
    target:
      entity_id: switch.galaxy_tab_a_2016_screen
    options:
      behavior: first
conditions: []
actions:
  - action: light.turn_on
    metadata: {}
    target:
      device_id: 89a31d42475f61a901d4eb59583b1a2b
    data: {}
  - delay:
      hours: 0
      minutes: 5
      seconds: 0
      milliseconds: 0
  - action: light.turn_off
    metadata: {}
    target:
      device_id: 89a31d42475f61a901d4eb59583b1a2b
    data: {}
mode: single

and I recieve the following error when I test in Developer tools
This template does not listen for any events and will not update automatically.
switch.galaxy_tab_a_2016_screen is coming from Fully Kiosk integration and light is a mqqt entity that works fine. Goal is to turn light on when display turns on.

Where did you find this option? Is it AI? I don’t think (I might be wrong) that is valid.

it was an option in HA Automations. first/last/any , tried them all

Use Trigger >
Entity … choose your switch.galaxy…
To: On

Action:
…

triggers:
  - trigger: state
    entity_id:
      -switch.galaxy
    to:
      - "on"

PS: Im not sure how you manage to make it so “Complicated”
Nor Why You Choosed switch.turned_on as a Trigger , And why you added that “Options” , What does that Option do actually ?

Still did not save

alias: "Galaxy to woodstove light "
description: ""
triggers:
  - trigger: state
    entity_id: switch.galaxy_tab_a_2016_screen    
    to:
      - "on"
conditions: []
actions:
  - action: light.turn_on
    metadata: {}
    target:
      device_id: 89a31d42475f61a901d4eb59583b1a2b
    data: {}
  - delay:
      hours: 0
      minutes: 5
      seconds: 0
      milliseconds: 0
  - action: light.turn_off
    metadata: {}
    target:
      device_id: 89a31d42475f61a901d4eb59583b1a2b
    data: {}
mode: single

ps. As mentioned I am new to HA and was just trying to use intuitive Automation creator.

Yes i noticed after i posted :slight_smile: , and i have never tried any of the “new” options etc. in Automations, So i can’t tell if they are intuitive … To Me

Not sure what could cause that, it looks ok to me, i would go out of the automation-page/refresh browser go in and try again
Also try with just light.turn_on > entity.id ( As i have no idea which device it is you are trying to “light_turn_on”

Gut feeling is we are on the wrong path. This is the error
This template does not listen for any events and will not update automatically.
I think it is an the Fully Kiosk entity issue although it behaves properly when tested on developer options and reports on/off. The entity I’m tryingto turn on/off is a hue bulb over MQTT.

1 Like

Ok, Im Also not familiar with Fully Kiosk, but the Automation should work as written, so You can be right, something is “spooky” with Fully Kiosk

I should probably know better, but I am puzzled.

If you have some ‘code’ as YAML, and you are testing it in Developer Tools, just what Tool exactly are you testing this in?

If, perchance, you are testing your automation configuration code inside the Template testbed, then no this is not a template and will not actually listen for anything or do anything.

Your YAML configuration, to my inexperienced eyes, looks like a good automation, and would naturally go inside an automation.

If you use the HA automation, create a new one, switch to edit in YAML, paste your (second) configuration, then switch back to edit in UI, it should show you if there are any errors. Doing this and substituting a switch and ‘device’ on my system works just fine.

1 Like

Hi Geoff,
Yes I was using Template in developer tools, still learning and confused :slight_smile: . I tried what you reccomended and recieve the following error
New automation setup timed out
Your new automation was saved, but waiting for it to set up has timed out. This could be due to errors parsing your configuration.yaml, please check the configuration in developer tools. Your automation will not be visible until this is corrected and automations are reloaded. Changes to area, category, or labels were not saved and must be reapplied.
You may continue to wait for a response from the server, in case it is just taking an unusually long time to process this automation.

I thought this would be a 2 minute job, guess I was wrong

I’ll try the same with a different trigger

I believe they enabled this experimental feature:

“Purpose-specific Triggers” are not yet part of the documented list of Triggers.

It’s the second example I have seen recently that uses these new Triggers and both users reported problems with their automations.

I don’t recommend new users try experimental features.

1 Like

It’s not an error.

The Template Editor simply tests Jinja2 templates and nothing else (i.e. it does not test an automation’s YAML code). Your automation contains no templates and so you get that message.

Example:

Note the message at the bottom.

Home Assistant can be very confusing when first starting. It does take time to understand all the various bits.

Automations can be hand-coded using YAML and edited into the correct part of the main configuration.yaml file. Normally the main config file holds
automation: !include automations.yaml or similar to point to (include) a separate automations.yaml file, which is the one that actually holds the automations. When using the UI to write automations, HA will, on save, attempt to modify and maintain this file for you, hence it has to be there and available.

Sometimes HA can’t find the file to work on:

This post holds a list of possible causes and fixes that may help you. My uneducated guess is that your configuration file is either corrupted or does not have the ‘automations.yaml’ file there, particularly if you have never created an automation before and this is the first time you are seeing this error.

The first Developer Tool, YAML - “check configuration” - can help a bit, but where there are configuration file problems the only solution is to get access to the main directory and check it all out. I have found setting up Samba share (HA App) to permit direct file access to my HA directory very useful. If editing the configuration files, always use a plain text editor, and keep a backup copy first!

Note that, if you add automations directly to the main configuration file, then they have to be started with “automation:” and the rest of your code must be space indented. If you add automations to the include file, then the indentation is not required. Personally I do all my (few) automations entirely using UI and I do not attempt to mix the HA-generated ones from UI with any hand-coded ones.

As I say, I used the HA Automation (UI) to create a new, blank automation, pasted your config code directly into the ‘edit yaml’ option, adjusted the trigger sensor and the light device to something that I have, and saved it successfully. Perhaps you should start with a basic HA automation in the UI, using eg a time trigger with a set time to turn a light (entity not device) on and just check that the ‘save automation’ works.

When it works, yes it is a 2 minute job, so eventually you will break through the learning barrier and reach the sunny uplands.