This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.

Get the value from a dynamic variable

I dynamically create a variable name (e.q. Preset1, Preset2, etc.) and assign it to a variable (GlPresetName). Now I want te read the value of the variable in the GlPresetName. How do I achieve this?

For example:
GlPreset5 = 'Radio station 5'.
GlPresetName = 'Preset'&&PresetCounter resulting in Preset5 in GlPresetName.
Now I want the value from variable Preset5 via GlPresetName. {{$GlPresetName}}.Value does not results in 'Radio station 5'. The result is $GlPresetName.

I hope it's clear what I want to achieve.

Comments

  • JPeJPe Member
    maybe you should use {{$GlPresetName$}}    (extra $ )
  • casedacaseda Member
    If you use better logic for this then it is not possible in text style, that is only for normal (build into homey) logic.

    You could add the global token to any card though with better logic, as that will also have that value
  • @JPe I tried and the result is $GlPresetName$

    @caseda I tried both Better Logic and the Homey Logical Cards, they both end up in the same result. Looks like the value field is handled as a string no matter what the contents is.

    Thanks for your responses.
Sign In or Register to comment.