Service_template error: Invalid config for [automation]: expected dictionary @ data['action'][0]. Got None


I’m struggling with the following automation code:

- id: Set_opritcamera_mode
  alias: "Set Opritcamera Mode"
    - platform: state
      entity_id: input_select.opritcamera_mode
      {% if is_state ('input_select.opritcamera_mode' ,'on') %} script.camera_light_mode_on
      {% if is_state ('input_select.opritcamera_mode' ,'off') %} script.camera_light_mode_off
      {% if is_state ('input_select.opritcamera_mode' ,'auto') %} script.camera_light_mode_auto
      {% endif %} 

Invalid config for [automation]: expected dictionary @ data[‘action’][0]. Got None. (See /config/configuration.yaml, line 24).

I presume that the service_template is the cause.

Thx for your help.

Remove the space between is_state and the opening bracket.

Also since around version 0.115 service_template can be replaced with service

… And add a space between the colon and the greater-than symbol

service: >

… And change the second two if to elif

1 Like

Yes , solved. Thx. Damned syntax errors …

1 Like