Automate automation

In the first are no 2 spaces in front of conditions and in the second are. So I did copy/paste the wrong code directly so no two spaces like you typed. When I added the two spaces it worked. Just see your first post and you will see it is missing. And there it went wrong. I started to change things myself and was testing things. So I was not quick enough and missed a post or two of you.

Now I understand thanks.

I’m not blaming anybody. It is helpful but started with a wrong code and me trying to find what is wrong.

Nope. still not seeing it. They look exactly the same to me…

Indeed, simply scroll up to the post at the top of the thread and it can clearly be seen that I posted the correct code with the correct indentation. That post has never been edited, so the solution to the problem has been in place since the very first reply to the thread.

OP’s just angry with her/himself for not following simple instructions so it must be someone else’s fault. Not to worry, I shall not be assisting him/her again.

1 Like

This is the first post right? Or am I wrong or just stupid? When I copy paste this into my automation it is shifted left. When I add manually two spaces on all lines it is working. So that is what went wrong.

condition:
  condition: or
  conditions:
    - condition: time
      after: '23:00:00'
    - condition: sun 
      before: sunrise

  condition:
    condition: or
    conditions:
      - condition: time
        after: '23:00:00'
      - condition: sun 
        before: sunrise

Just see the two difference it the two posts. I’m not telling that anybody is wrong but by copy paste this it went sideways for me and was trying to figure out what it was.

But I will end this discussion because it will give no extra info as long as you both not seeing the error I pointed out.

Indentation is relative to the key under which it falls. Nobody knows how many spaces you already have before the keys in your configuration because you could have configured it a number of different ways, you should preserve the formatting when pasting it in to your configuration

condition: #your condition block already in your automation
  condition: or #2 spaces further in
  conditions:
    - condition: time #4spaces further in
      after: '23:00:00'
    - condition: sun 
      before: sunrise

The first condition: in your configuration could be unindented, 2 spaces, 4 spaces or more depending on your file structure, so nobody can indent the first key for you. Just preserve the indentation when you paste.

Okay fair. I did not know that and now it is getting clear why I get the error.

Invalid config for [automation]: expected a dictionary @ data[‘condition’][0]. Got None extra keys not allowed @ data[‘conditions’]. Got None. (See /home/homeassistant/.homeassistant/configuration.yaml, line 115). Please check the docs at Automation - Home Assistant Invalid config for [automation]: expected a dictionary @ data[‘condition’][0]. Got None extra keys not allowed @ data[‘conditions’]. Got None. (See /home/homeassistant/.homeassistant/configuration.yaml, line 115). Please check the docs at Automation - Home Assistant

Like said I’m learning. It is not that I’m not reading but trying to understand things.

Thanks