I have a Script that performs an Action. The action takes both a device_id and a number of minutes. The Script is configured to use a device filter field and a number field to collect this info. Everything works great in the UI where you can select a device and the template gets the correct device id.
Unfortunately, when using Assist (either text or voice) and I specify a device name (e.g. “Hose Left”), rather than converting the device name to the correct device_id, it directly passes the device name where the id is expected and the script fails. Does anybody know how to configure the script (and/or Assist) to correctly pass the device id rather than device name?
And here when it’s invoked via the Assist functionality (e.g. “Start watering on Hose Left for 1 minute”). Note that the literal “Hose Left” is passed rather than being converted to a device id.
params:
domain: rachio
service: start_watering
service_data:
duration: 1
device_id:
- Hose Left
target:
device_id:
- Hose Left
running_script: false
I guess it’s an LLM which is doing this? specifiy more clearly that it should device_id’s for that field, and not device names. You can do that in the decription of the field.
@TheFes - Yeah, the assistant I’m using is an OpenAI assistant with Prefer handling commands locally enabled.
I both renamed the hose field to hose_device_id and updated the description to device_id of the hose to run., but it’s still passing the device name rather than id. I then tried changing the description to This should be the device_id of the hose to run and not the device name., but this also did not fix the issue.
Should I be creating a custom voice command to avoid the llm trying to fill out the parameters?
<template TemplateState(<state light.back_hall_light=off; supported_color_modes=[<ColorMode.BRIGHTNESS: 'brightness'>], color_mode=None, brightness=None, icon=mdi:dome-light, friendly_name=Back Hall Light , supported_features=32 @ 2025-07-02T15:43:05.787523-05:00>)>
[alias, alias 1, alias_2]
See what’s NOT in there?
Hint…(no device ID) if the LLM hasn’t seen it in context or know how to get it - it DOES NOT exist. Im not sure It CAN without help… Maybe they added the device id in there but it’s not in the default expand. (honestly I haven’t checked, I havent needed to Im only checking on entity_id and Name or sometimes area… and a lot of label resolution, no devices.) You’ll need instructions and intent to resolve device id from entity_id first. (adds to todo list for Fridays entity resolver)
I’d be betting cash money it’s falling back to device name because it can figure out something resembling name… And so it gives it a shot.
It sounds like the main problem is the llm contexts only contain entity information and not device information.
The action I’m using takes a target, which can be an entity or a device. I had been using device, but I’ll try using an entity instead and see how that goes.
Yeah glat it worked there’s another best practice out there to target automation by entity not device because it allows portability of automation. I’m a bit draconian about it in my internal targeting and simply forget device ID exists. Glad it helped. The other thing is another thing that’s helped in my scripts is assume it’s going to throw the friendly name and resolve for ent ID right there. Choke it down at the name field. It comes in name or ent and resolves to valid ent or none at the end of the input - I got tired of trying to fight it and started working with it. Now I knea what it’s rules were… We can make it work.