However I could make the condition work only for the first actionOption Parameter.
Then I found the defaultValue Parameter. In the Props Dialog the values are shown, however, they are not assigned to the props itself when the Dialog is closed. The actionOptions are always “undefined”. Only when a defaultValue was modified, the value is assigned.
I suppose this is a bug, but not sure.
I can confirm this. You can force that default values are being saved by deleting the last character and re-adding it again.
However, why are you using a prop for each value instead of 1 for all? defaultValue: 1=Wochenprogramm1,2=Wochenprogramm2,3=Wochenprogramm3
This way you can define elements with less actionOptions without getting undefined i.e. empty list items.
Thanks for the hint @Oliver2. Just not sure I got you correctly - sorry, but not yet experienced with YAML and OH3.
You recommend to use a single props with 1 defaultValue? That’s fine as well and would also fit the requirements.
However I’m not clear in one point. Also with this approach, its required to delete/re-add at least the last character of the defaultValue in the dialog in order to get this value assigned to the prop - am I correct?
I defined this for testing now:
- defaultValue: 1=Wochenprofil 1,2=Wochenprofil 2,3=Wochenprofil 3,4=Wochenprofil 4,5=Wochenprofil 5,6=Wochenprofil 6
description: Define up to 6 Profiles
label: Profiles Names
This approach does work, however now the defaultValue is somehow obsolete, as I had to add a parameter for the undefined true condition as well. Without the check for undefined, the actionOptions are still undefined if the defaultValue wasn’t edited, as not assigned to the prop.
Is this understanding correct, or do I miss something ?
true. This is redundant. You either pre-define your values under defaultValue or actionOptions. Well, if you want to use it for yourself you instantly see that the value is not saved. You don’t really need the specification under actionOptions. This only makes sense if you want to give your widget to somebody else and want to make it less error prone.
However, I am using defaultValues, too just because I am lazy and need default Value as a template for editing.