Need help on script

Hello!

I need help with my script.

I want to perform different actions based on the value of a boolean input variable called “notificarTelegram”

If notificarTelegram is true, then execute ActionA.

If notificarTelegram is false, then execute ActionB.

Please, can anyone help me?
Thanks in advance!

Use an if - then with a Template Condition.

Example

if:
  - condition: template 
    value_template: "{{ notificarTelegram is true }}"
then:
   ... Your ActionA ...
else:
   ... Your ActionB ...

The template will work only if notificarTelegram contains a boolean value. If it contains a string value then the template must be changed to {{ notificarTelegram == 'true' }}.

It would be helpful if you post your script in YAML format. It makes it easier for me, or others, to modify it so that it meets your requirements.

1 Like