Can I omit quotation marks when using time in an automation?

Hi! I was wondering if you can omit the quotation marks when using time in an automation like in the following example.

- alias: turn on lights in living room
  - platform: state
    - sensor.livingroom_motion
    to: 'on'
  - condition: time
    after: 18:00:00
    before: 06:00:00
  - service: light.turn_on
      - light.livingroom_ceiling

I understand that time has to be entered as a string (therefore the quotation marks). So in case this is not possible, why isn’t it? Is it because the entered time (e.g. 18:00:00) is not being recognized as a string? What would the data type of 18:00:00 be in that case?

YAML tries to be human friendly, by minimizing the need for special syntax characters when the data is simple. The most common YAML special characters in YAML are:

  • : - Between key/value pairs
  • - - Denotes a sequence entry
  • # - Starts a comment

It’s because the : character is a normal YAML character. So if you don’t wrap in in quotes, the YAML parser will try to do something else with it beyond home assistant’s control…before even passing it to the backend.

actually I don’t know a programming or scripting language which allows to use date/time without string delimiters.

the thing which could be considered to be exception is unix timestamp which is just a number and representing UTC time. but again while it can be converted to date and time usually requires to be explicitely converted if date/time is required

Thank you for your replies!