Help a non programmer learn to program in home assistant (General Questions)

So a general question I have is at the start of the notify service, what is the |-, >-, and > mean at the start of a message block?

Also, how do you add a line break in an automation message, is it “\n”.

Also, can you all give me some resources in order to start becoming efficient with the concepts needed to excel at using home assistant. I find myself constantly not having a clue what I’m doing when I have to start including templating, variables, and formatting within a single automation.

I’m really just in need of some resources because I feel less than proficient in making HA perform at its highest level in my setup.

Also, thank all of you for your help so far, lord knows I have had to ask for enough of it.

Those are multi-line quote markers. They are a way to tell the program reading the yaml file that what follows should be read as if it is surrounded by quotes. For HA purposes they all function the same. If you use the GUI automation and script editors you may notice that > and >- get replaced with |- when you save and reload a script.

Unfortunately, it (currently) depends on your output integration. For most \n works, but for some like the HA companion app you need to use <br>.

The most complete single resource is Home Assistant’s own documentation.

For templating make sure to check out:

https://jinja.palletsprojects.com/en/latest/templates/

1 Like

For telegram I use two line breaks, like this:

  - service: notify.telegram_general
    data:
      title: '⚡ *Lightning Event Nearby*'
      message: >
        Distance: {{ states('sensor.blitzortung_lightning_distance') }}

        Count: {{ states('sensor.blitzortung_lightning_counter') }}

Same for Signal.

Drew thank you so much for these responses. These will be very helpful for me.

@tom_l and @EdwardTFN Thank you all also for your input here. I have alot to learn. I’m just hoping that you more experienced and get me moving towards the 80% and hopefully in the long term I’ll pick up the last 20.

Read the docs, from start to finish.

Hang around on the forum and read posts that interest you.

Read and study everything that @123 posts. :blush:

4 Likes

Haha. I’ve noticed. This sounds like a good answer for sure.
@123 is a good one for sure. Very helpful.