Double quotes or not?

hi,

once again i´m confused, so sorry for my fool noob question…

as i have seen different examples (in forums, ha-documentation) with and without double quotes for title, message, channel etc.

i wonder when double quotes in (e.g. automation) needed or not?
it seems both following notify examples are running correctly

example:

title, message, channel WITHOUT double quotes…

automation:
  - alias: Removing Motion channel
    trigger:
      ...
    action:
        action: notify.all_devices
        data:
          title: my title
          message: my message text
          data:
            ttl: 0
            priority: high
            color: red
            channel: HASSIO_ALERT

title, message, channel WITH double quotes…

automation:
  - alias: Removing Motion channel
    trigger:
      ...
    action:
        action: notify.all_devices
        data:
          title: "my title"
          message: "my message text"
          data:
            ttl: 0
            priority: high
            color: red
            channel: "HASSIO_ALERT"

so what?

when are dblquotes really neccessary, or appreceated?

thanx for lighten me up!

br
Frank

It’s YAML which is a widely used format and not specific to HA,

3 Likes

In addition to the excellent explanation that PeteRage linked to, in Home Assistant the words on and off have special meaning (synonymous with true/false) so they should be wrapped in quotes.

Example

alias: test
trigger:
  - platform: state
    entity_id: binary_sensor.hallway_motion
    from: 'off'
    to: 'on'
3 Likes