Randomize a time value?

Is there any way to randomize a time value?

I have two randomized input sliders that work. I’ve tried the following but I get a configuration error:

platform: time
  at: "{{ states('input_slider.random_hour_lr')|int ~ ':' ~ states('input_slider.random_minute_lr')|int }}:00"

The above gives the error:

“Invalid config for [automation]: Invalid time specified:”

If input_slider.random_hour_lr = 6 & input_slider.random_minute_lr = 1 when I check the template I get:

‘6:1:00’

Any pointers to fix this?

And on a similar note the following won’t work either:

platform: sun
  event: sunset
  offset: '00:{{ (range(2, 59) | random) }}:00'

The above gives the error:

“Invalid config for [automation]: offset 00:{{ (range(2, 59) | random) }}:00 should be format ‘HH:MM’ or ‘HH:MM:SS’ for dictionary value @ data[‘trigger’][0][‘offset’]”

But the following used in a delay command gives no errors:

delay: ‘{{ (range(0, 2)|random|int) }}:{{ (range(1, 59)|random|int) }}:00’

Pretty sure you need to use a Template Trigger for this.

trigger:
  platform: template
  value_template: "{{ this or that }}"

or

trigger:
  platform: template
  value_template: >-
    {% if this %}
      This
    {% else %}
      That
    {% endif %}