I need some help to finish an automation. I have a motion sensor that turns on my bathroom light. I had it to set a low light between 1-6 am and full-strength any other time. It then has a delay of 3 minutes and switches off if no motion is detected. This works fine most of the time but I decided that I wanted it to stay on and ignore the motion sensor if it’s switched on manually. Therefore the state of the light.master_bathroom light.master_bathroom has to be “off”. I’m constantly getting the error “[choose] is an invalid option for [automation]” although I have used it before in automations. Any help will be appreciated.
You are getting the error message because the choose statement is malformed. The second sequence block is insufficiently indented. Indent the entire block by two more spaces.
Because it still contains indentation errors. Indent minutes by two more spaces.
Although not an error, the syntax to call a service is inconsistent (a mix of old and modern). This is the old-fashioned way of defining a service call:
I assume you are using a text editor to make the suggested changes. What steps do you perform immediately after modifying the automation and saving the changes?
For example, do you run Check Configuration and, if it passes, execute Reload Automations?
I pasted the example, containing the incorrectly indented default, into the Automation Editor and, after clicking the Save button, it immediately flagged the error.
I changed it back to 4 spaces (default). No errors on Check configuration but still get a notification with the following error:
Invalid config for [automation]: [to] is an invalid option for [automation]. Check: automation->action->0->choose->0->conditions->1->to. (See /config/configuration.yaml, line 18).
Invalid config for [automation]: [sequence] is an invalid option for [automation]. Check: automation->action->0->choose->0->conditions->1->sequence. (See /config/configuration.yaml, line 18).
I have checked my entire automation.yaml file and there is no condition that has a “to”, only state triggers. I’m unsure where this comes from. I have rebooted but it still comes up.
tells us that the offending option is located in an automation’s action in the first conditions section of the first choose statement (and it’s the second condition within conditions).
That’s clearly not in the example I posted so it’s somewhere else.
Use Visual Studio Code to find all choose statements in all of your automation files (I assume you have more than one otherwise your manually created automations are combined with those composed using the Automation Editor).
I already done that and found no “to” anywhere after any condition. I only create automation manually so no Automation editor stuff in my yaml file. The first example I posted had a “to” in the condition but I changed that to state later on. on my first reply.