#Can't seem to use text variable correctly in automation

1 messages · Page 1 of 1 (latest)

weak stump
#

I am attempting to use a "helper" text as a variable in a light control automation. I have attached some screenshots. I appear to not be inserting or declaring the variable correctly to text?

The text helper is named "input_text.nanoleaf_canvas_daily_scene". I want to turn on a light and pass the current text of that helper as the 'profile' part of the light-on automation.

In the trace attached, the literal text "input_text.nanoleaf_canvas_daily_scene" is being passed as the variable instead of the current text of that helper.

#
  scene: input_text.nanoleaf_canvas_daily_scene```
#
metadata: {}
target:
  device_id: 9d61f794cafb86e584b045f1a13dc751
data:
  profile: "{{ scene }}"
#

These are my current two actions in the automation:

Define variable, added via "Add Helper Block"

Light on, added via "Add Action"

junior lark
#

That's not how you refer to the state of an entity in a template

dim robin
#

And most device_id stuff has no idea what templares are.

junior lark
#

I don't think that's a problem here

#

It's not a device action

dim robin
#

I still blam it (for most things).

weak stump
junior lark
#

Or use the variable name that you defined

weak stump
#

So I could use

states('scenes')

can I skip the variable defintion and just use the first option I gave?

junior lark
#

Remove the quotes

weak stump
#

Understood

weak stump
#
  scene: states('input_text.nanoleaf_canvas_daily_scene')```

This seems to be correct, it sort of "popped up" for me when I began typing the helper name in and showed me the text it resolved to
#
metadata: {}
target:
  device_id: 9d61f794cafb86e584b045f1a13dc751
data:
  profile: {{ scene }}

This appears to be wrong however, when I view a trace after a failed run:

#

Do I need to do states(scene) as well in the action?

junior lark
#

that's where you do it]

weak stump
#
metadata: {}
target:
  device_id: 9d61f794cafb86e584b045f1a13dc751
data:
  profile: states(scene)

This seems to send the literal text "states(scene)" and not the variable as expected

junior lark
#

you're bouncing around 🙂

weak stump
#

yes thank you I understand I do not get it

weak stump
junior lark
#

ok

#

and please don't move to a device action as you just posted

weak stump
#

Huh? Move to device action?

junior lark
#

from your initial example:

#
variables:
  scene: input_text.nanoleaf_canvas_daily_scene

action: light.turn_on
metadata: {}
target:
  device_id: 9d61f794cafb86e584b045f1a13dc751
data:
  profile: "{{ states(scene) }}"
#

simple as that

weak stump
junior lark
#

clearly

weak stump
junior lark
#

I gave you the code, use that

weak stump
#

huh?

#

that is a trace result...

#

I posted a trace result for troublehsooting and you're saying do not do that?

junior lark
#

just the code I gav eyou

#

define the variable, then use the variable in the template to retrieve the state

weak stump
#

It did not work, but you told me not to post trace results

junior lark
#

I misintrepreted the screenshot of the trace to be an action that you wrote, so please ignore that

weak stump
#

This has been super frustrating and I am going to keep Googling

#

Thank you for trying

junior lark
#

ok

weak stump
# junior lark clearly

This was not at all helpful

From a moderator too?

All because you misunderstood?

I even said I am new to HA

Truly infuriating trying to get help from a human being

Someone else DMed me and helped with my issue

Please re-think your approach. Speed matters MUCH less than clarity for new users.

dim robin
#

I still go back to Device_id stuff doesn't do templates. Use an entity ID.

#

Use an entity_id.