First a warning: with the YAML language, indenting (spaces, never tabs) really matters.
1)
To help you thereâs yamllint, install and run it (regularly) on the ha folder : I use âyamllint ~/.homeassistant -parsableâ and you can create a config file, ha is not as strict as other implementations of YAML.
Even if doesnât apply here, I see youâre really trying and canât help but feel youâll soon need templates.
2) test them in the h-a dev module
3) Use âhass --script check_config -i automationâ
Try to always think of step 1 and 3 before any restart (to be sure you havenât missed a space or a quote), automations are the hardest to debug, I often end up having to move every file out, and put them back in progressively to figure out which one is the problem.
Now back to your automation.
âQuotingâ will not always feel logic, and I often made the mistake to think I had something figured out, screwing up my automations in the process.
MOST values donât need quoting, but True/true/False/false/on/off/0/1 will have a different effect depending on if they are quoted or not (and both are often used)
I like this short summary : http://symfony.com/doc/current/components/yaml/yaml_format.html
Using âTrueâ (string) or True (boolean) are both fine, but sometimes ha (core + components) expect a specific type. It cannot distinguish what you meant, You can also look at binary sensors to get a feel of how booleans are different : a binary sensor can only have 2 values, but itâs mentioned those can be On/Off True/False etc.
You should read first about the syntax, then start testing working examples (snippets in the wiki are less useful than looking this here : https://home-assistant.io/cookbook/
I understand you want to have something work fast and now, but youâll get exponentially more frustrated if you donât first learn those basics. I didnât want to either, and now I see how much time I could have saved
This will also help you understand how you can format multiline ouput : http://stackoverflow.com/a/21699210/6305035
So, finally, hereâs your automation in a way to be able to copy/paste & adapt it for your next steps :
automation:
- alias: Turn off Light
initial_state: 'True'
trigger:
platform: state
entity_id: switch.light
condition:
condition: and
conditions:
- condition: or
conditions:
- condition: time
before: '02:00:00'
- condition: time
after: '23:50:00'
- condition: time
weekday:
- mon
- wed
- fri
action:
service: switch.turn_off
entity_id: switch.light