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.
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
mauriceb
Member
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.
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
You could add the global token to any card though with better logic, as that will also have that value
@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.