OH4.0.2 Cell Based Widget not working on Overview Page but works on "other" Pages

Hi All.

I have a strange issue that I cannot seem to debug at all.

I have created a widget that pops up a f7-block when one of the components is pressed as follows:
Working

This works from the Widget Editor as well as my Overview-Test page.

However if I use the exact same code on my Overview page, the popup just does not happen. The press is detected but nothing pops up:

Not Working

I have cut down the code as much as I can to try and see what the issue is, but just no luck.

I have tried on a clean install by adding just this Cell to the overview page and get the same issue - so it appears this is something to do with the overview page.

I have other widgets on the Overview that do a similar Popup with no issue, so I am at a loss.

The code is as follows:

component: oh-cell
config:
  on: true
  title: Test
slots:
  background:
    - component: f7-block
      config:
        style:
          height: 100%
          margin: 0
          padding: 0
          position: absolute
          width: 100%
    - component: f7-block
      config:
        style:
          bottom: 5px
          left: 0px
          margin: 0
          padding: 0
          position: absolute
          width: 100%
      slots:
        default:
          - component: oh-button
            config:
              popupOpen: .test1234-pop
              style:
                height: 100%
                width: 100%
              text: OPEN
    - component: f7-popup
      config:
        class: test1234-pop
        style:
          --f7-popup-tablet-height: 720px
          --f7-popup-tablet-width: 360px
          background-color: rgb(220,220,220)
          border-radius: 30px
          height: 720px
          text-overflow: ellipsis
          width: 360px
      slots:
        default:
          - component: f7-block
            config:
              popupClose: .test1234-pop
              style:
                --f7-popup-tablet-height: 720px
                --f7-popup-tablet-width: 360px
                background-color: rgb(220,220,220)
                border-radius: 30px
                height: 720px
                margin: 0
                padding: 0
                text-overflow: ellipsis
                width: 360px
            slots:
              default:
                - component: oh-button
                  config:
                    clearVariable:
                      - mpptDetailShow
                    large: true
                    popupClose: .modal-in
                    style:
                      background: rgb(220,220,220)
                      color: white
                      display: flex
                      height: 30px
                      left: 5px
                      position: absolute
                      top: 5px
                      width: 30px
                      z-index: 999
                  slots:
                    default:
                      - component: f7-icon
                        config:
                          color: white
                          f7: clear_fill
                          style:
                            color: black
                            font-size: 20px
                            margin: auto
                - component: Label
                  config:
                    style:
                      font-size: 25px
                      font-weight: 500
                      padding-left: 50px
                      width: 100%
                    text: Test
                - component: f7-block
                  config:
                    style:
                      margin: 0
                      padding: 0
                      top: 0px
                  slots:
                    default:
                      - component: oh-link
                        config:
                          action: variable
                          actionVariable: mpptDetailShow
                          actionVariableValue: '=(vars.mpptDetailShow == "null") ? true : !(vars.mpptDetailShow)'
                          style:
                            height: 100%
                            width: 100%
                            z-index: 0
                        slots:
                          default:
                            - component: oh-gauge
                              config:
                                borderBgColor: gray
                                borderColor: green
                                borderWidth: 20
                                class:
                                  - margin-top
                                  - margin-bottom
                                value: 4400
                                labelText: MPPT Total
                                max: 6600
                                min: 0
                                size: 150
                                style:
                                  left: 5px
                                type: semicircle
                                valueFontSize: 15
                                valueTextColor: green
                - component: f7-block
                  config:
                    style:
                      background: white
                      border: 1px solid black
                      border-radius: 20px
                      left: 15px
                      margin: 0
                      opacity: 1
                      overflow: hidden
                      padding: 0
                      position: absolute
                      top: 133px
                      width: 330px
                    visible: =(vars.mpptDetailShow) == true
                  slots:
                    default:
                      - component: oh-gauge
                        config:
                          borderBgColor: gray
                          borderColor: green
                          borderWidth: 20
                          class:
                            - margin-top
                            - margin-bottom
                          value: 1500
                          labelText: MPPT 1
                          max: 3300
                          min: 0
                          size: 145
                          style:
                            left: 10px
                            margin: 0
                            padding: 0
                          type: semicircle
                          valueFontSize: 15
                          valueTextColor: green

Any suggestions on what the issue might be?

Thanks
Mark

I suspect the issue is that you have set the z-index of a couple of the elements. It’s almost certainly showing, it’s just behind the overview page background (which has a z-index of 1 so you’re z-index of 0 is getting shunted all the way to back).

You usually shouldn’t need to worry about z-index (but that’s not a hard and fast rule), so I recommend trying to figure out what it is about the structure of the widget that seems to require this and restructure the entire thing so that you don’t need an absolute z-index and can just let the system handle it.

Thanks for the Reply Justin

I also thought that. I only added the z-index entries to rty and force the popup to the front. I get the same issue with or without them.

I have just tried again. And weirdly the popup works (This is the forst time I have seen it work on the Overview Page
:
Working Ant

But tthen I refreshed the page (that is all I did), and not working again.
Not Working Ant

I am hoping there is some sort of debugging you can suggest in teh browser? I have tried looking at inspect etc, but not sure what to look for?

I do nto get this issue at all on any other pages, or in the Widget Editor - do you still think this would be a z-index issue?

That’s still where my focus would be for now.

Open the browser console and watch the output there when you click on the cell. Make sure it doesn’t report any errors. If nothing shows up there then you really have narrowed it down to just a location of the rendered object issue and on a mobile screen like that there’s not too many places to hide other than “under other things”.

You have also given your popup a fairly unique class (test1234-pop), so when you think it should be open and you don’t see it, then search for the class name. You should just be able to click anywhere in the elements widow and press ctrl + f to bring up an input that will search the whole page structure. That will let you know that the element is actaully on the page, you just can’t see it and you can then see if changing some of the position or z-index parameters brings it back to visible.

I have just realized that I have explained this really badly… Sorry.

The Popup part is working fine. The issue is the f7-block which would either be displayed or not depending on the value of a variable - so looks like a popup.

- component: f7-block
  config:
    style:
      background: white
      border: 1px solid black
      border-radius: 20px
      left: 15px
      margin: 0
      opacity: 1
      overflow: hidden
      padding: 0
      position: absolute
      top: 133px
      width: 330px
    visible: =(vars.mpptDetailShow) == true
  slots:
    default:
      - component: oh-gauge
        config:
          borderBgColor: gray
          borderColor: green
          borderWidth: 20
          class:
            - margin-top
            - margin-bottom
          value: 1500
          labelText: MPPT 1
          max: 3300
          min: 0
          size: 145
          style:
            left: 10px
            margin: 0
            padding: 0
          type: semicircle
          valueFontSize: 15
          valueTextColor: green

The visibility is set based on:

actionVariableValue: '=(vars.mpptDetailShow == "null") ? true : !(vars.mpptDetailShow)'
visible: =(vars.mpptDetailShow) == true

Even removing the visibility expression does not display the block.

I will also investigate your other suggestions and report back.

Ah sorry, I understand now. Yes, then it’s less likely (although not impossible) that it’s a z-index issue.

I’ve seen a few strange visibility issues a little similar to this in the past, but those were all related to visibility of child elements of a repeater changing.

Do you have a stylesheet define somewhere else on that Overview page that may be applied to the f7-block (Long shot but worth checking for)?

Also, you could try it with just:

visible: =vars.mpptDetailShow

and

actionVariableValue: =!(vars.mpptDetailShow)

Those are equivalent to what you had, logically, but may be more direct and therefore less prone to breaking.

Thanks again Justin (and sorry for the confusion caused by my bad explanation)

I have simplified the widget some more (removed the oh-gauge and used an oh-icon). I have also added some “logging” to see what happens with the variable.

I manage to capture the following, which shows the widget working initially (randomly seems to work sometimes) and then no longer working after a page reload (too large to include in post):

What is really weird is that this only seems to happen on the Overview page. No issues on my other pages (I have an Overview-TEST Page for staging and testing).

My updated code with fixed expression and removed z-index):

component: oh-cell
config:
  title: Test
slots:
  background:
    - component: f7-block
      config:
        style:
          height: 100%
          margin: 0
          padding: 0
          position: absolute
          width: 100%
    - component: f7-block
      config:
        style:
          bottom: 5px
          left: 0px
          margin: 0
          padding: 0
          position: absolute
          width: 100%
      slots:
        default:
          - component: oh-button
            config:
              popupOpen: .test1234-pop
              style:
                height: 100%
                width: 100%
              text: OPEN
    - component: f7-popup
      config:
        class: test1234-pop
        style:
          --f7-popup-tablet-height: 720px
          --f7-popup-tablet-width: 360px
          background-color: rgb(220,220,220)
          border-radius: 30px
          height: 720px
          text-overflow: ellipsis
          width: 360px
      slots:
        default:
          - component: f7-block
            config:
              popupClose: .test1234-pop
              style:
                background-color: rgb(220,220,220)
                border-radius: 30px
                height: 720px
                margin: 0
                padding: 0
                text-overflow: ellipsis
                width: 360px
            slots:
              default:
                - component: oh-button
                  config:
                    clearVariable:
                      - mpptDetailShow
                    large: true
                    popupClose: .modal-in
                    style:
                      background: rgb(220,220,220)
                      color: white
                      display: flex
                      height: 30px
                      left: 5px
                      position: absolute
                      top: 5px
                      width: 30px
                  slots:
                    default:
                      - component: f7-icon
                        config:
                          color: white
                          f7: clear_fill
                          style:
                            color: black
                            font-size: 20px
                            margin: auto
                - component: Label
                  config:
                    style:
                      font-size: 25px
                      font-weight: 500
                      padding-left: 50px
                      width: 100%
                    text: Test
                - component: Label
                  config:
                    style:
                      font-size: 25px
                      font-weight: 500
                      padding-left: 50px
                      width: 100%
                    text: ="Variable Value " + vars.mpptDetailShow
                - component: f7-block
                  config:
                    style:
                      margin: 0
                      padding: 0
                      top: 0px
                  slots:
                    default:
                      - component: oh-link
                        config:
                          action: variable
                          actionVariable: mpptDetailShow
                          actionVariableValue: '=(vars.mpptDetailShow == "null") ? true :
                            !(vars.mpptDetailShow)'
                          style:
                            height: 100%
                            width: 100%
                        slots:
                          default:
                            - component: f7-icon
                              config:
                                color: white
                                f7: ant
                                style:
                                  color: black
                                  font-size: 100px
                                  margin: auto
                - component: f7-block
                  config:
                    style:
                      background: white
                      border: 1px solid black
                      border-radius: 20px
                      left: 15px
                      margin: 0
                      opacity: 1
                      overflow: hidden
                      padding: 0
                      position: absolute
                      top: 133px
                      width: 330px
                    visible: =(vars.mpptDetailShow) == true
                  slots:
                    default:
                      - component: f7-icon
                        config:
                          color: white
                          f7: ant
                          style:
                            color: black
                            font-size: 100px
                            margin: auto

I have also confirmed again that I see the same on a clean install of OH4.0.2 with no binding etc at all.

EDIT: Upgraded test system to openHAB 4.1.0 Build #3606 and see the same. Also do not see any console errors.

The only issue with this way is that the Block starts off being displayed, which I would prefer not. It also requires two clicks to remove.,

Thanks
Mark

I have done a further test with no Popup or anything “fancy”. Just an oh- cell with an oh-button that toggles a variable to affect the oh-cell title:

component: oh-cell
config:
  title: ="Test " + vars.testVariable
slots:
  background:
    - component: f7-block
      config:
        style:
          height: 100%
          margin: 0
          padding: 0
          position: absolute
          width: 100%
    - component: f7-block
      config:
        style:
          bottom: 5px
          left: 0px
          margin: 0
          padding: 0
          position: absolute
          width: 100%
      slots:
        default:
          - component: oh-button
            config:
              action: variable
              actionVariable: testVariable
              actionVariableValue: '=(vars.testVariable == "null") ? true : !(vars.testVariable)'
              style:
                height: 100%
                width: 100%
              text: OPEN

This also works on my Overview-TEST page:
Overview-TEST

However on Overview page the variable does not change:
Overview

It looks therefore that there is a problem setting a variable when on the Overview page for some reason?

EDIT: I can also confirm that if I leave the Overview page open for an extended time (30 to 90 minutes) the widget starts to work?

I cannot replicate the issue with the test widget you’ve provided. It works just fine both on my test page and on my overview page. I’m on a 4.1 snapshot that’s a few weeks old (#3576), so between 4.0.2 and your newest snapshot test. I’m testing it on chrome (although according to the angry “update” button at the top, I’m not on the very latest version of chrome); that appears to be the browser you are using as well in the video.

Do you see any errors appear in the browser console when you click on the button?

Ok, this is just getting weird…

I am on the latest Chrome, though I have tested with edge as well as Firefox and see the same issue.

I also see the issue with the Android App, though not able to test that it works if the page has been open for an extended time. I will try figure a way to test with that.

There are no errors in the browser console. This is just after a page refresh on my “clean” install. Before refresh was working, after not:

image

Very… Just don’t know what else to try. I can’t understand why only the Overview page is affected and even on a completely clean install.

What about initializing the variable on the overview page? Does that help?

config:
  defineVars:
    testVariable: true

Do you mean via the “Code” tab on the actual overview page?

I applied the code there, extract as follows:

config:
  label: Overview
  defineVars:
    testVariable: true
blocks:
  - component: oh-block
    config: {}
    slots:
      default:
        - component: oh-grid-cells
          config: {}
          slots:
            default:
              - component: oh-cell
                config:
                  title: Test
                slots:
                  background:
                    - component: f7-block
                      config:
                        style:
                          height: 100%

Strangely that does seem to help when in the Settings, Pages view. But the variable is not defined when the actual Overview page is viewed.

I also thought from a while back it was not possible to define a variable? I even logged a GIT request for that?

Tested with random value and is set on the page when veiwed via Settings/Pages. But not on actual page

Also managed to test with Android App. Same symptom. If yoh wsut on the page long enough it works

Ok, I think you’ve got something that warrants a github issue.

I was able to reproduce your error to some extent now. When I first tested your stripped down widget code, I actually saved it as a standalone widget and added that widget to the overview page. This works exactly as expected. Just now, I added that widget to the overview page again and also added the same yaml directly to the overview page right next to it. This gives me two identical widgets side-by-side. The one that is the standalone widget still works as expected, but the one defined in-line on the page does not show any change in the variable status either on that widget or on another widget referencing that page variable. You are correct; there is something not working about variables defined on the overview page (which is odd, as that part of the overview page code does not appear to have changed in 3 years).

It has never been, and is still not, possible to define variables with default values in the widget editor. It has been possible to define variables on pages using defineVars nearly since the beginning because one of the original ideas behind variables was the ability to pass information between different widgets on the same page, and this gives the variables a page-wide context so all widgets can access them.

Indeed, it seems that whatever is impacting variable use on the overview page is effecting even the initializing of the variables using defineVars but only when displayed, the editing window does appear to work.

This is still the most mysterious part. It seems that eventually the overview page variable system does come online, but I cannot begin to image why this take 30 minutes. That make no sense at all to me.

Thanks for all the help Justin. I will submit an issue in the morning. Am I correct that this would be under webui?

That’s where I’d start.

I did not realize that defineVars should be available on the Overview page. This would go a long way to eliminate warnings such as:

07:59:32.346 [WARN ] [se.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: undefined_Partition_In_Exit_Delay
07:59:32.346 [WARN ] [se.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: undefined_Partition_Has_All_Zones_Closed

which result from the variable not having been initialized yet when the page is opened.

Hopefully some day my feature request will get picked up :slight_smile:

I have logged this current issue as follows:

So that is why I am getting this:?
2023-08-31 16:16:17.931 [WARN ] [e.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn’t exist: undefined

If I open the page I get that warning.
Then I go to another page and if I open that page where I am getting the warning I don’t get the warning.
The widgets I have on that page all seem to work and I cannot see anything that I have that is not being referenced.
The warning I get doesn’t even say what the item is (that would be handy if it did).

Mine is slightly different. It is constructed from the undefined part which is prepended to create the actual item name.

Yours is referring a completely undefined item, but assume it could be a similar issue if you are using variables etc?

It doesn’t bother me but it is something I have noticed.
When I get time I may look deeper into the issue.
I did modify a widget someone else had done and I cut bits out of it so there may be something I have missed.
Probably something I have done.

Your pages work fine because this is just a warning. It doesn’t interfere with the functioning of the page. But, it’s just as Mark said; it means that on that particular page you have a widget that attempts to connect to an item, but the expression that should result in the name of an existing item instead results in the name of an item which doesn’t exist (in this case the full expression result is undefined).

I went through a while back and fixed all the instances of that in my more used pages. It shaved about 250ms off of the loading time for the pages and got rid of the warnings and nothing else.