OH3 Widget vars default value

That has not been my experience, although I may be doing the multiple levels differently to how you are, but mine are working in the 3rd level as per your picture. The widget I use and works, is in the marketplace called camera mp4 history if you wish to look and play with its code. I define the variable in the widget and only use defaultValue to set the value, not create the variables. I use multiple widgets all on the same page and they do not share a GLOBAL variable, but unique separate variables that all work as intended in each widget. The defaultValue appears to just set all variables in the page with the given name. If you are not defining the variable in the widget, then this may be the reason it works for me and not for you.

I am not an expert and don’t know if this is the wrong way, but it works for me and hope it can help you. Hopefully someone with some time to donate can: 1. document this. 2. Request a way to do it at the widget level with a github issue as clearly multiple people are wanting this.

Hi Matt

Thanks for the feedback.

I have taken a look at your code. But I cannot see where you are calling the wiget from a page and assigning the variable? Am I missing something?

I have submitted a gitHub request. Would be nice to get a plus 1 from you (and others) if you have the time.

I am also happy to try and document the workaround if I can get it to work. I am clearly missing some thing though.

Hi Matt
Please could you explain what you mean here? How do you define that variable in the widget?