What do these dashes do

Hello everyone,

Can someone tell me how the dashes in this code work?

{%- if trigger.to_state.state != "not_home" -%}

They remove any whitespace in the template.

in that specific case you won’t see anything in HA. You can leave them out.

the only time they matter is if the returned value {{…}} has some extra whitespace at the beginning or at the end of the returned value in HA itself or more likely if you need to get rid of a bunch of extra whitespace in the template editor.

I personally never use them unless I’m in the template editor and I have a long template I’m testing causes the result to be way down the right part of the screen.

If you want to have several values on the same line, then they are used to remove line feeds.

Insert your own automation here and play with it.

type: markdown
content: >-
  {{-((as_timestamp(now())-as_timestamp(state_attr('automation.turn_on_outdoor_light_strip_at_sun_down','last_triggered'),0))/86400)|int -}}D 
  {{-(((as_timestamp(now())-as_timestamp(state_attr('automation.turn_on_outdoor_light_strip_at_sun_down','last_triggered'),0))%86400)/3600)|int -}}:
  {{-(((as_timestamp(now())-as_timestamp(state_attr('automation.turn_on_outdoor_light_strip_at_sun_down','last_triggered'),0))%86400)%60)|int -}}

Thank you very much for your response