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.
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
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!