Template Contition with a variables

Hi, i have a big issue. I want put out a text over My script to Alexa. This works fine. I set a variable title and message and in the script i give out to Alexa.
Now is want set a variables called silent. So Alexa script give not out the text to Alexa.

This is My automation.

service: script.test_notification
data:
variables:
title: Türglocke
message: Es hat geklingelt.
image: /api/camera_proxy/camera.haustur_low
silent: true

And this is My script for Alexa:

if:

  • condition: template
    value_template: “{{ variables.silent != true }}”
    then:
  • service: notify.alexa_media_stoecklis_echo_dot
    data:
    title: “{{ variables.title }}”
    message: “{{ variables.message }}”

My issue is in this line: value_template: “{{ variables.silent != true }}”
Can everyone help? Please!

You don’t need the variables., just use "{{ silent != true }}" or "{{ not silent }}"

I have try this. Variables are set in the automation script.

Ok, I see. I missed that you weren’t using the indirect method to call the script… in the future please format your code properly, it makes it a lot easier on us.

I’m pretty sure it’s just a string-boolean comparison issue. If you are passing your variables as the object variables, then either of the following should work:

{{ not variables.a }}
{{ variables.a != True }}

If they don’t, please post the full automation, script, and any debug traces.

In the automation

- service: script.test_notification
  data:
    title: Türglocke
    message: Es hat geklingelt.
    image: /api/camera_proxy/camera.haustur_low
    silent: true

In the script

- if:
    - condition: template
      value_template: '{{ silent | bool == false }}'
  then:
    - service: notify.alexa_media_stoecklis_echo_dot
      data:
        title: '{{ title }}'
        message: '{{ message }}'

Reference:

Passing variables to scripts

every suggestion has not worked. I think the problem is with the variable. I create a variable names silent in the automation. This calls a script which sends a text message and outputs a voice message to Alexa. However, I would like to prevent some voice messages. Therefore I create the variable silent and want to pass in the case distinction Alexa only the text, which must be spoken. But somehow the variable does not arrive. I don’t really understand this, the title and the message arrive correctly.