Add milliseconds to the Duration Selector

The ‘Duration Selector’ for blueprints and scripts currently supports days, hours, minutes and seconds. I’d like to see a milliseconds field added as well.

The ‘Delay’ action supports milliseconds and for some automations, more granular control is needed.

If you could provide some more specific examples of what kinds of blueprint you might use this in, it might help justify this. It would not be hard to add, but I wonder if it might get challenged over if it is really needed in review.

Note you can also use a number selector if you just need to allow the user to select a specific number of milliseconds.

1 Like

My :repeat: Multi Click Button - Make any button multi-clickable blueprint needs a millisecond input for instance.
Clicking a button twice or more will usually require less than 1 second between clicks, otherwise it becomes a bit of a hassle.

Currently I’m using text input that gets split and then fed into the timeout function of the repeat loop (which ironically does support milliseconds).

Below is the code I’m using to solve the issue currently. It works fine, but it’s not a very elegant solution and it opens up user error possibilities.

Asking for the delay:

time_between_clicks:
  name: Time between clicks
  description: |
    How much time can be allowed between any 2 clicks?
    Please fill out the duration in the following format: HH:MM:SS:FFF 
    H = hours, M = minutes, S = seconds and F is milliseconds 
  default: []
  selector:
    text:

Splitting it up:

variables:
  time_split: '{{ time_between_clicks.split(":") }}'

Feeding the split time to the loop:

action:
  - repeat:
      sequence:
        - wait_for_trigger:
            ...
          timeout: 
            hours: '{{ time_split[0] | int }}'
            minutes: '{{ time_split[1] | int }}'
            seconds: '{{ time_split[2] | int }}'
            milliseconds: '{{ time_split[3] | int }}'

Maybe adding a input_duration component would also help.

Thanks for the details. I will put in a PR for your request, we’ll see if it gets approved.

1 Like

Thank you.

enable_millisecond for duration selector is merged for 2024.8.

2 Likes