Solved... my fault

I have these two scripts to turn on or off my chromecast on my LG TV, but it seems they are not working.

The scripts are the following:

cast_lg_on:
  alias: Accendi Chromecast LG
  sequence:
    - service_template: >
        {% if is_state('switch.tvlg', 'off') %}
           switch.turn_on
        {% else %}
           switch.turn_off
        {% endif %}              
      entity_id: switch.tvlg
    - delay: 00:00:15
    - service: switch.turn_on
      entity_id: switch.right

cast_lg_off:
  alias: Spegni Chromecast LG
  sequence:
    - service_template: >
        {% if is_state('switch.tvlg', 'off') %}
           switch.turn_on
        {% else %}
           switch.turn_off
        {% endif %}              
      entity_id: switch.tvlg
    - delay: 00:00:15
    - service: switch.turn_on
      entity_id: switch.source
    - delay: 00:00:02
    - service: switch.turn_on
      entity_id: switch.left

Any help to solve this?

Sorry… i understand why it’s not working…
Solved!