I noticed recently this error in my log:
Cat Fountain Comes On With Kitchen Lights: Error executing script. Unexpected error for call_service at pos 1: Template rendered invalid service:
Here is the automation:
- alias: Cat Fountain Comes On With Kitchen Lights
initial_state: true
trigger:
platform: state
entity_id: switch.kitchen_light_switch
action:
service_template: >
{%- if states('switch.kitchen_light_switch') == 'on' -%}
switch.turn_on
{%- endif -%}
entity_id: switch.cat_fountain_switch
After a little research I think this is happening because I don’t have an “else” statement but I don’t want the cat fountain to turn off with the kitchen light. How can I change this automation so I don’t get the error? BTW the automation works fine, just trying to clean up the error log.