Custom state for sensor ON OFF in Telegram message

Thanks! That seems to be exactly what I’m looking for!

However, there appears to be a small error: I always get the “else” message :thinking:

Also is it possible that the quotes are not necessary?! They also appear in the message.

Wasserstand Keller Schacht
“Der Wasserstand ist: Kritisch
Der kritische Wasserstand wurde zuletzt 12.01.2019 um 14:04 erreicht”

And I edited the indentation, because the configurator didn’t like it your way xD

message: >
  {%- if is_state('states.binary_sensor.schacht_wasserstand_alarm.state', 'off') -%}
      Der Wasserstand ist: *OK*
      Der kritische Wasserstand wurde zuletzt am
      *{{ as_timestamp(states.binary_sensor.schacht_wasserstand_alarm.last_changed) | timestamp_custom('%d.%m.%Y um %H:%M') }}* erreicht
  {%- else -%}
      Der Wasserstand ist: *Kritisch*
      Der kritische Wasserstand wurde zuletzt am
      *{{ as_timestamp(states.binary_sensor.schacht_wasserstand_alarm.last_changed) | timestamp_custom('%d.%m.%Y um %H:%M') }}* erreicht
  {%- endif -%}

No biggie - usually I don’t restart for weeks anyway :wink: