Automation Datatemplate

Hey all I am re-doing all my automation’s and and HA logs don’t complain on any syntax error after the re-write however now when I trigger the automation it write the following to the log

automation automation.lights_varsagds. Invalid data for call_service at pos 1: not a valid value for dictionary value @ data['entity_id']

The automation looks likes this, I hope anyone can give me a hint of what is wrong.

- alias: lights varsagds
  trigger:
    - platform: state
      entity_id: sensor.someoneontv
      to: 'True'
    - platform: state
      entity_id: binary_sensor.telldus_tzdw_100_magnet_switch_sensor
      to: 'on'
    - platform: state
      entity_id: binary_sensor.fibaro_system_fgms001_zw5_motion_sensor_sensor
      to: 'on'
    - platform: state
      entity_id: binary_sensor.fibaro_system_fgms001_zw5_motion_sensor_sensor_2
      to: 'on'
    - platform: state
      entity_id: group.devices2home
      to: 'home'
  condition:
    condition: and
    conditions:
      - condition: time
        after: '06:00:00'
        before: '22:00:00'
      - condition: state 
        entity_id: sensor.lux_living_room
        state: 'On'
  action:
    - service: script.turn_on
      data_template:
        entity_id: >
          {% if is_state("input_select.trapphus_state", "Automatiskt") %}
            script.scen_trapphus_std
          {% endif %}
    - service: script.turn_on
      data_template: 
        entity_id: >
          {% if is_state("input_select.hugo_sovrum_state", "Automatiskt") %}
            script.scen_trapphus_std
          {% endif %}
    - service: script.turn_on
      data_template:
        entity_id: >
          {% if is_state("input_select.felix_sovrum_state", "Automatiskt") %}
            script.scen_trapphus_std
          {% endif %}
    - service: script.turn_on
      data_template:
        entity_id: >
          {% if is_state("input_select.vardagsrum_state", "Automatiskt") %}
            script.scen_vardagsrum_std
          {% endif %}
    - service: script.turn_on
      data_template:
        entity_id: >
          {% if is_state("input_select.ks_sovrum_state", "Automatiskt") %}
            script.scen_kssovrum_std
          {% endif %}
    - service: script.turn_on
      data_template:
        entity_id: >
          {% if is_state("input_select.tv_light_color", "Lila") and is_state('group.ikeacolorlights', 'off') %}
            script.scene_ikeapurple_light
          {% elif is_state("input_select.tv_light_color", "Blå") and is_state('group.ikeacolorlights', 'off') %}
            script.scene_ikeablue_light
          {% elif is_state("input_select.tv_light_color", "Vitt") and is_state('group.ikeacolorlights', 'off') %}
            script.scene_ikeawhit_light
          {% elif is_state("input_select.tv_light_color", "Standard") and is_state('group.ikeacolorlights', 'off') %}
            script.scene_standard_light
          {% endif %}
    - service: script.turn_on 
      entity_id: script.scene_standardbelysning_hallen

No capital
Also it’s a sensor
How can a sensor be true

sensor.someoneontv state True is what I see in dev tools. Anyhow I tried without that and it didn’t make any difference.

So I found the problem I have no else statement and if the if statement render “false” i return something bad for the ID. I have change the code to

    - service: script.turn_on
      data_template: 
        entity_id: >
          {% if is_state("input_select.hugo_sovrum_state", "Automatiskt") %}
            script.scen_trapphus_std
          {% else %}
            script.dummy_donothings
          {% endif %}