Some questions from writing my first custom widget

Dear community,

recently, I started with openHAB and everything works quite well.
Now I am writing my first custom widget and came along some questions that I could not find an answer for.
This is my first post and I am quite new to the community. So my apologies if I missed some topics that answer some of my questions.

These are my (current) questions:
Sharing the widget

  1. Is it enough to open a topic and add the widgetgallery tag?
  2. How do I link the topic with code on github?
  3. Is there a problem if I collect multiple widgets in one repository (e.g. in different subfolders)?
  4. Can I also open one topic for multiple similar widgets or should I open one for each of them?

5. I have some problems to set default value for a color setting. I would like to take the default value from the themes color settings. Is this possible in the settings or do I have to find a workaround in the code?
6. There are some things that built-in widgets can do that custom widgets can’t do. Especially, I am missing the ability to have a dynamic number of settings (like the dynamic number of series in a chart). This would allow to build more generic widgets. Is this planned as a feature? Is there a workaround?

Thanks in advance


Don’t upload the widget.json, but post a link to your repo. Like this

You should not mix repos to begin with. Stick to 1 repo, 1 purpose.

1 widget, 1 topic

Not sure what you mean. Themes are class driven.

You can always create your own settings modal

Hi Luckymallari,

thank you for answering my questions.
This helps me a lot.
Still there are some points where I would like to “dig a bit deeper”.

I totally agree with you. Just the definition / granularity of “1 purpose” could be subject of discussion :wink:
For me, it would be reasonable to

  • put all my HABPanel Widgets that I’d like to share into one repo
  • put all openHAB staff dealing with a specific device into one repo
  • put exactly one widget into one repo (personally, I don’t like this option, especially if some widgets share common code, but that’s just my opinion)
    So I would like to hear if there is a problem, if I bundle things in a reasonable way.

OK, understood. No bundles, here

These classes define colors like background-color, text-color and highlighted text color.
I would like to use e.g. the text color as default, but allow the user to change the color in the settings.

This sounds interesting. How can I do that?
I just know how to define setting for custom widgets in the normal way (see image below)

My apologies if my questions were / are not clear enough. I will consider to upload an early stage widget to explain more concrete what my problems are. Just right now I feel that the code is still too messy to share :roll_eyes: