Hour in template

Is this template syntax correct?

    - condition: template
      value_template: >
        {{ 18 <= now().hour <= 23:59 }}

If not how to change it to have also minutes?

If you are comparing hours, do not include minutes. The below will do what you want:

{{ 18 <= now().hour < 24 }}

Any reason why not using the time condition?

condition:
  condition: time
  # At least one of the following is required.
  after: '15:00:00'
  before: '02:00:00'

:ok_hand: :pray:

Yes, you’re right… now i know two methods to do this… :smile: