OH3 Widget popover question


just getting into the Pages/Widgets feature. Just created a floorplan with markers. Clicking on them opens a popover. Now the following question: is there a way to pass a variable (or something like name of marker calling the popover would be enough) to the popover? I have a few markers showing different values. Clicking on them should open a popover which allows to do some settings (matching the markers corresponding items). It would be easy to create a own widget for each marker but isn’t there a better solution?

ok already figuerd it out after re-reading the wiki-pages here for the 6-time. Got it working with Yannick example of the keypad. (did try it similar way already but did not work but with the example its clear) If someone encounter same:
ex. use this inside the config part of a marker etc.

  action: popover
  actionModal: widget:rollershutter_popup
    item: Tester

define inside the widget under the “props/parameter” label your item like

- context: item
  description: An item to control
  label: Item
  name: item
  required: false
  type: TEXT

and use it inside your widget like


So i can now finally have a multiple marker which open (when clicking on them) a popover using already the right item (with only one widget)
Once you get into the YAML and understanding it, it’s getting simpler every time. I like it.

You can also set more items. Just use the item-name you set (unde props in your widget) inside the actionModalConfig like:

    item_1: TestItem1
    item_2: TestItem2

In this manner you can also pass other values or things like variables (instead of the item i use props)


Thanks. You figured it out. The docs are being worked on but there’s still a lot to write on that matter.

I’ve not yet migrated those Pages. If you can go and add what you’ve learned to them that would be greatly appreciated.

can I also send params to a page? e.g. set the oh-time-series within a Chart page through a parameter?

When I add a

- context: item

it gets removed from my chart page after saving.

Chart pages are still largely ignoring expressions so props wouldn’t be useful anyways.
But that’s something that would have to be improved in the next months, so you could have “generic” pages with props and e.g. open them in an action context, in a popup or even standard navigation, with the prop values assigned by the “caller”.

It’s been planned from the start but still needs work.
That’s why the description of the target props when you select a page-or-widget-related action hint at pages defining props too.

I see. Thanks Yannick!