Hi all, I am trying to learn some templating in automations. Here is my code, what am I doing wrong?
Basically I want to check if a backlight is on, if it is then just do what the automation is supposed to do (set a value to a input_number), otherwise turn on that backlight (light.displ_bedroom_backlight).
Ok I get the following error: * Invalid config for [automation]: [state] is an invalid option for [automation]. Check: automation->action->0->choose->0->conditions->0->state. (See ?, line ?).
I guess the mistake is here?:
- condition: template
state: off
entity_id: light.displ_bedroom_backlight
Invalid config for [automation]: [state] is an invalid option for [automation]. Check: automation->action->0->choose->0->conditions->0->state. (See ?, line ?).
Invalid config for [automation]: [value] is an invalid option for [automation]. Check: automation->action->0->choose->0->conditions->0->value. (See ?, line ?).
Invalid config for [automation]: expected str for dictionary value @ data['action'][0]['choose'][0]['conditions'][0]['state']. Got None. (See ?, line ?).
Thank you so much for walking me through my mistakes. Thatâs the best way to learn and now I can reproduce the âchooseâ method for all my other automations!
Sorry @petro , I need to take advantage of your patience once again. I realized that even if a light is dimmed, it is still considered on (obviously). So I have to modify my automation to check if the light is below 255 brightness instead of checking if the light is âoffâ. Here is my proposal which obviously doesnt work:
Invalid config for [automation]: [state] is an invalid option for [automation]. Check: automation->action->0->choose->0->conditions->0->state. (See ?, line ?).
Invalid config for [automation]: [value] is an invalid option for [automation]. Check: automation->action->0->choose->0->conditions->0->value. (See ?, line ?).
Invalid config for [automation]: expected str for dictionary value @ data['action'][0]['choose'][0]['conditions'][0]['state']. Got None. (See ?, line ?).
Invalid config for [automation]: [data_template] is an invalid option for [automation]. Check: automation->action->0->choose->0->conditions->0->data_template. (See ?, line ?).
@petro, I donât understand why what is written after âdefault:â is executed anyway. I mean, if the condition is met (i.e. brightness<255), why the following part continues to be executed (the part after âdefault:â)?
EDIT: probably after the brightness is restored to 255 the script goes on because it reads now that is 255�
EDIT2: restarting home assistant instead of just reloading the automations solved the issue!