Custom sentence returning intended '6' as '6:00'

I am using a custom sentence which feeds a pick a number trigger. I said “Pick a number from 6 to 10” but Assist read that as “Pick a number from 6:00 to 10:00” using a custom sentence. Is this expected?

I can do 30 to 100 and it works so I’m guessing it is only the low numbers that will cause this

Is there a workaround for this or a way to force a certain format for a number. Note that I am using a custom sentence automation and don’t have the flexibility to create this in YAML

I have not had that specific issue, but you can use templates to modify the values returned in slots. Post your automation so we can see what you are doing.

alias: View Assist - Random Fun
description: ""
trigger:
  - platform: conversation
    command:
      - Ask [the] magic (8 | eight) ball
    id: magic8ball
  - platform: conversation
    command:
      - Flip [a] coin
    id: flipcoin
  - platform: conversation
    command:
      - Pick a number from {fromnum} to {tonum}
    id: picknumber
  - platform: conversation
    command:
      - (Lets play rock paper scissors | rock paper scissors)
    id: rockpaperscissors
  - platform: conversation
    command:
      - Roll a dice
    id: rolldice
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - magic8ball
        sequence:
          - set_conversation_response: |-
              The magic eight ball says ... {{ [
                "Cannot predict now",
                "Yes",
                "As I see it, yes",
                "My reply is no",
                "Better not tell you now",
                "Without a doubt",
                "It is certain",
                "Most likely",
                "Very doubtful",
                "Reply hazy, try again",
                "My sources say no",
                "Ask again later",
                "Outlook not so good",
                "Yes definitely",
                "It is decidedly so",
                "Don't count on it",
                "Signs point to yes",
                "You may rely on it",
                "Outlook good",
                "Concentrate and ask again"
              ] | random }}
      - conditions:
          - condition: trigger
            id:
              - flipcoin
        sequence:
          - set_conversation_response: |-
              Here goes... it landed on {{ [
                "heads",
                "tails"
              ] | random }}
      - conditions:
          - condition: trigger
            id:
              - picknumber
        sequence:
          - set_conversation_response: >-
              I'm thinking of a number ... ... ... my number is {{
              range(trigger.slots.fromnum|int, trigger.slots.tonum|int) | random
              }}
      - conditions:
          - condition: trigger
            id:
              - rockpaperscissors
        sequence:
          - set_conversation_response: |-
              Lets play!!! Rock Paper Scissors shoot ... {{ [
                "rock",
                "paper",
                "scissors"
              ] | random }}
      - conditions:
          - condition: trigger
            id:
              - rolldice
        sequence:
          - set_conversation_response: I rolled a {{ range(1, trigger.slots.diefaces|int) | random }}
mode: single

This is a combination of a few different ‘games’. Note that the pick a number and dice will suffer from this same issue. Thanks for looking

You may also run into issues if/when it returns “six” instead of “6”. The converter I put together to handle that kind of thing is at: https://gist.github.com/Didgeridrew/88175322bf8028b43fc3612246fb8416

Here’s what I’ve been using (with a fix for the “06:00” issue added):

alias: Sentence - Random Number/Dice Roll
description: ""
trigger:
  - platform: conversation
    command:
      - (generate|pick|give me) [a] [random] number between {num_1} and {num_2}
      - d {num_2} [dice] roll
      - roll a d {num_2} [dice]
condition: []
action:
  - variables:
      num_1: |
        {% set x = trigger.slots.num_1 %}
        {%- if x is undefined %} 
          1
        {%- elif x | is_number %} 
          {{ x }}
        {%- else %}
          {%- set x = x.split(":")[0] if ":" in x else x %}
          {%- from 'tools.jinja' import to_numeral -%}
          {{- to_numeral(x) }}
        {%- endif %}
      num_2: |
        {% set x = trigger.slots.num_2 %}
        {%- if x is undefined %}
          6
        {%- elif x | is_number %}
          {{ x }}
        {%- else %}
          {%- set x = x.split(":")[0] if ":" in x else x %}
          {%- from 'tools.jinja' import to_numeral -%}
          {{- to_numeral(x) }}
        {%- endif %}
  - set_conversation_response: "{{ range(num_1| int, num_2| int + 1) | random }}"
mode: single

EDIT: Corrected a couple typos

Wowsers! Thanks man. I am tracking what you are doing. Kind of stinks it’s necessary but I do get the fact that Assist is doing its best to get the context right and that’s not the easiest thing to do at times.

Again, I appreciate this and will gladly lift it and use it with my automations!