Hello,
I am having problems with if else states in an automation.
My goal is,that I get a notification, when someone writes a telegram bot to shutdown the server and I want to see the name. I thought I could get the name by the trigger.event.data.user_id, but I always get a message from the bot that the server was shutdown by unknown, not by the person.
- alias: Shutdown
initial_state: on
trigger:
platform: event
event_type: telegram_command
event_data:
command: '/shutdown'
action:
- service: shell_command.shutdownserver
- service: notify.telegram
data_template:
message: >
Server was shutdown by {% if (is_state("{{ trigger.event.data.user_id}}", "88888888")) -%} Person A {% elif (is_state("{{trigger.event.data.user_id}}", "77777777")) -%} Person B {% else %} Unknown {{trigger.event.data.user_id}} {% endif %}. Waiting 2,5 Minutes to turn off the plug.