Hello everyone, I’m encountering an issue with openHAB 5.2.3 Main UI (running on openHABian):
I created a dashboard page that, among other things, fetches a snapshot from a ZoneMinder monitor and displays it within a widget. This works perfectly on the custom page I created. I then copied the entire code for this page and pasted it directly onto the “Overview” page. Everything displays without any issues while in edit mode or in the simulation; however, as soon as I log out or open the homepage in a new browser session, this specific widget fails to appear. Interestingly, if I navigate to my custom dashboard page (where the widget always displays correctly) and then return to the homepage, the widget suddenly appears as it should.
The reason I copied the code from the dashboard page to the Overview page is that I want this specific layout to be the first thing I see when starting a session. I haven’t found any other way to achieve this, as it seems there is no built-in option to set a page other than the “Overview” page as the homepage.
Is there a solution to this problem? Please let me know what additional information you might need (perhaps some code snippets?).
A much better approach would be to copy it and paste it into the Developer Tools → UI Widgets → + and set some properties if necessary. Then you can add that custom widget to both places by name instead of copying and pasting the code. See Pages - Custom Widgets | openHAB for details.
I suspect there is something that has gone wrong when copying and pasting the whole page. Something got messed up, a misaligned indentation or something like that. What I would do is build up the layout on the Overview page as you want it (rows, columns, etc.) and copy over the widgets individually, one by one. Even better I would create each widget as a custom widget instead of copy and paste. That makes the widgets independent units which makes future edits and manipulation much easier.
Beyond that, all I can recommend is posting the code for the ZoneMinder widget itself and someone better at UI widgets hopefully will be able to help, assuming the problem is with the widget instead of the layout.
Thanks for your reply! My dashboard page consists entirely of custom widgets; the code copied from the dashboard page actually works on the overview page as well—with one limitation: when the openHAB URL is first accessed, this particular widget displays no output. It only begins to work after the dashboard page has been visited (where the exact same widget functions correctly on the very first load) and one then immediately returns to the overview page. From that point on, everything works perfectly.
I have also checked the indentation; to me, everything looks correct.
There are a couple of different possibilities. Please show all the relevant yaml.
version: 1
pages:
overview:
tags: []
props:
parameters: []
parameterGroups: []
component: oh-layout-page
config:
label: Overview
sidebar: false
layoutType: fixed
fixedType: canvas
gridEnable: false
screenWidth: 1920
screenHeight: 1080
hideNavbar: false
hideSidebarIcon: false
style:
--f7-theme-color: "#64b5f6"
--f7-page-bg-color: "#15191f"
--f7-text-color: "#e5eaf0"
--f7-label-text-color: "#cbd5df"
--f7-input-text-color: "#e5eaf0"
--f7-list-bg-color: "#252c34"
--f7-list-item-border-color: "#414b56"
--f7-card-bg-color: "#252c34"
--f7-card-border-radius: 10px
--f7-card-box-shadow: 0 3px 12px rgba(0,0,0,0.35)
--f7-block-strong-bg-color: "#252c34"
--f7-bars-bg-color: "#20262e"
--f7-bars-text-color: "#e5eaf0"
--f7-navbar-bg-color: "#20262e"
--f7-navbar-text-color: "#e5eaf0"
--f7-toolbar-bg-color: "#20262e"
--f7-toolbar-text-color: "#e5eaf0"
--f7-popup-bg-color: "#20262e"
--f7-dialog-bg-color: "#252c34"
pageStyle:
background: "linear-gradient(145deg, #252c34 0%, #15191f 45%, #202832 100%)"
color: "#e5eaf0"
scale: false
showFullscreenIcon: true
slots:
default: []
masonry: []
grid: []
canvas:
- component: oh-canvas-layer
config:
preload: true
slots:
default:
- component: oh-canvas-item
config:
x: 688
y: 29
h: 40
w: 125
slots:
default:
- component: widget:anwesenheit_kachel
config:
iconSize: 20
- component: oh-canvas-item
config:
x: 20
y: 20
h: 70
w: 211
slots:
default:
- component: widget:responsive_clock
config:
fontSize: 14px
- component: oh-canvas-item
config:
x: 19
y: 335
h: 254
w: 302
slots:
default:
- component: widget:wettercom
config: {}
- component: oh-canvas-item
config:
x: 19
y: 60
h: 271
w: 451
notStyled: true
slots:
default:
- component: widget:zoneminder_snapshot
config:
username: xxxxx
password: yyyyyyy
refreshSeconds: 15
baseUrl: http://192.168.5.18
- component: oh-canvas-item
config:
x: 7
y: 823
h: 67
w: 204
slots:
default:
- component: widget:location_jump_parameter_card_safe_color
config:
locationItem: Pool
title: Pool
iconColor: blue
- component: oh-canvas-item
config:
x: 203
y: 823
h: 68
w: 211
slots:
default:
- component: widget:location_jump_parameter_card_safe_color
config:
locationItem: Gartenteich
title: Teich
iconColor: blue
- component: oh-canvas-item
config:
x: 317
y: 327
h: 44
w: 162
slots:
default:
- component: widget:zoneminder_monitor
config:
title: Terrasse
username: xxxxx
password: yyyyyyy
monitorId: "2"
- component: oh-canvas-item
config:
x: 317
y: 398
h: 44
w: 162
slots:
default:
- component: widget:zoneminder_monitor
config:
monitorId: "3"
title: Stall
username: xxxxx
password: yyyyyyy
- component: oh-canvas-item
config:
x: 475
y: 61
h: 253
w: 336
slots:
default:
- component: widget:garbage_list_v0
config:
footer: "='Nächster Termin: ' + ((dayjs(items.Muellkalender_Next_Start.state).diff(dayjs().startOf(\"day\"), \"days\")) == 0 ? \"Heute\" : (dayjs(items.Muellkalender_Next_Start.state).diff(dayjs().startOf(\"day\"), \"days\")) == 1 ? \"Morgen\" : \"In \" + (dayjs(items.Muellkalender_Next_Start.state).diff(dayjs().startOf(\"day\"), \"days\")) + \" Tagen\")"
tomorrow: morgen
today: heute
datearray: '"Restmüll","gray","f7:trash","Restmuell_Start"|"Biotonne","te000al","f7:trash","Biomuell_Start"|"Gelber Sack","yellow","f7:trash","Gelber_Sack_Start"|"Altpapier","red","f7:trash","Altpapier_Start"|"Problemstoffe","blue","f7:trash","Problemstoffe_Start"|"Rauchfangkehrer","black","pngegg.png","Rauchfangkehrer_Start"|"Deponie","gray","mull.png","Deponie_Start"'
title: Müllkalender
- component: oh-canvas-item
config:
x: 475
y: 338
h: 251
w: 336
slots:
default:
- component: widget:calendar_timeline_widget_upcoming
config:
title: Familienkalender
- component: oh-canvas-item
config:
x: 19
y: 610
h: 210
w: 455
slots:
default:
- component: widget:dynamic-light-control
config:
title: Lampen
lightGroup: gLampen
- component: oh-canvas-item
config:
x: 477
y: 610
h: 210
w: 455
slots:
default:
- component: widget:dynamic-switch-control
config:
switchGroup: Group_Gartenverbraucher
- component: oh-canvas-item
config:
x: 816
y: 61
h: 529
w: 571
slots:
default:
- component: widget:fronius_energy_flow_v5_1
config:
title: Stromflüsse
power_solar: Fronius_Symo_Inverter_Current_Solar_Yield
popup_solar: Fronius_Symo_Inverter_Current_Solar_Yield
power_battery: Fronius_Symo_Inverter_Charge__Discharge_of_Battery
popup_battery: Fronius_Symo_Inverter_Battery_State_of_Charge
soc_battery: Fronius_Symo_Inverter_Battery_State_of_Charge
power_inverter: Fronius_Symo_Inverter_Inverter_Power
popup_inverter: Fronius_Symo_Inverter_Inverter_Power
power_solar_max: 8000
power_grid: Fronius_Symo_Inverter_Grid_Power
popup_grid: Fronius_Symo_Inverter_Grid_Power
power_house: Fronius_Symo_Inverter_Load_Power
popup_house: Fronius_Symo_Inverter_Load_Power
use_dot_gradient: true
- component: oh-canvas-item
config:
x: 936
y: 610
h: 210
w: 455
slots:
default:
- component: widget:widget_power_consumption_analyzer
config:
groupItem: Group_Power_Consumption
- component: oh-canvas-item
config:
x: 403
y: 823
h: 75
w: 213
slots:
default:
- component: widget:location_jump_parameter_card_safe_color
config:
locationItem: ZWave_Node_003_MT02650_Devolo_Thermostat_09356
title: Heizung
- component: oh-canvas-item
config:
x: 606
y: 825
h: 75
w: 213
slots:
default:
- component: widget:location_jump_parameter_card_safe_color
config:
locationItem: network
title: Netzwerk
- component: oh-canvas-item
config:
x: 823
y: 22
h: 43
w: 200
slots:
default:
- component: widget:compact_item_icon
config:
item: Lokale_Sonnendaten_Sonnenaufgang_Sonnenaufgang
icon: oh:sunrise
layout: row
showState: true
- component: oh-canvas-item
config:
x: 1192
y: 22
h: 43
w: 200
slots:
default:
- component: widget:compact_item_icon
config:
item: Lokale_Sonnendaten_Sonnenuntergang_Startzeit
icon: oh:sunset
layout: row
- component: oh-canvas-item
config:
x: 453
y: 25
h: 38
w: 156
slots:
default:
- component: widget:compact_item_icon
config:
item: Jablotron_JA100_xxxx
iconSize: 20px
fontSize: 16px
icon: oh:alarm
layout: row
The widget not being displayes on initial page load is “widget:zoneminder_snapshot”
I’m going to guess that your zoneminder widget includes an oh-context component and some variables. If that’s the case, then this is a known bug.
There is a pull request in with a fix for this bug that, last I checked, was probably going to make it in before the 5.3 release at the end of the year. Unfortunately there’s not much you can do about it until then, it’s basically a problem with the ability of the oh-context to access items that haven’t been added to the UIs item state tracking yet.
Thnk you very much for your investigations!
Just to make sure, I attach the zoneminder widget code:
version: 1
widgets:
zoneminder_snapshot:
tags:
- Kamera
props:
parameters:
- default: http://voyeur.homedomain.local
label: ZoneMinder Basis-URL
name: baseUrl
required: true
type: TEXT
- default: "1"
label: Monitor-ID
name: monitorId
required: true
type: TEXT
- label: Benutzername
name: username
required: true
type: TEXT
- label: Passwort
name: password
required: true
type: TEXT
- default: 5
label: Snapshot-Intervall in Sekunden
name: refreshSeconds
required: true
type: INTEGER
parameterGroups: []
component: oh-image
config:
url: =props.baseUrl + "/zm/cgi-bin/nph-zms?mode=single&monitor=" + props.monitorId + "&scale=50&user=" + props.username + "&pass=" + props.password
refreshInterval: =Number(props.refreshSeconds) * 1000
lazy: false
action: popup
actionModal: widget:zoneminder_live_popup
actionModalConfig: "=({baseUrl: props.baseUrl, monitorId: props.monitorId, username: props.username, password: props.password})"
style:
width: 100%
height: auto
cursor: pointer
border-radius: 8px
For the time being, I can live with saving the functional dashboard page as a browser bookmark, allowing me to access it directly. Ultimately, however, the goal is to have it displayed in kiosk mode—though I’m not sure if that’s possible for a specific page. Just to meet the WAF (Wife Acceptance Factor).
Ok, your widget does not, in fact, have an oh-context so that is not the problem. There is something else going on here that just has similar symptoms.
Do you have the same issue if you set the canvas layer’s preload to false?
yes, the same issue, I’m afraid.
The strange thing about the whole situation is that the widget does not appear when the page is initially loaded; however, as soon as I (after logging in as an admin) go to edit the page and then exit the editing dialog—without having made any changes—by clicking “back,” the widget content is displayed.
I’ve run a few more tests and observed the following:
In the widget editor, a snapshot is displayed when the username/password combination is correct, while a “broken link” icon appears if the combination is incorrect—so far, so good.
On the overview page, however, the display remains empty when the username/password combination is correct, whereas a “broken link” icon appears if the combination is incorrect.
I’m going to check the ZoneMinder API logs for any errors.
Checked ZM error logs: As expected, ZoneMinder throws an error for the invalid user/password combinations only
Another check:
I entered an invalid username/password combination for the ZoneMinder widget on the overview page, then logged out and restarted the browser session. Once again, the widget area remains empty during the initial load—HOWEVER: if I click over to my functional custom dashboard page and then navigate back to the overview page, a “broken link” icon suddenly appears (which is actually the correct behavior). It seems there might be an issue with the initial loading process?
I agree, that’s why I asked about the preload setting.
Do you have to edit the page, or is just navigating to any other page and navigating back sufficient?
no, simple forward and back navigation is sufficient
One thing that still puzzles me a bit: is there a difference in how a custom page (like my dashboard page) loads compared to the standard overview page? I ask because accessing my dashboard page directly displays the widget output immediately.
Only because the overview page is a tabbed page, but that shouldn’t really impact the content any.
My guess is that it is not any difference between the two pages; it’s just that the second time the widget is loaded is always successful. That doesn’t matter if its 1 - Overview and 2 - Dashboard, or 1 - Overview and 2 - back to Overview.
To test that you could take the widget off the overview page and reload the UI (so we’re testing 1 - Dashboard and 2 - Dashboard). Then, if the issue is the widget handling itself and not the page handling, you will see the widget fail the first time you load the dashboard page, but navigating away and back to the dashboard will display the widget properly.
I’m not sure I understand you correctly: you want me to remove the widget from the overview page and then reload the UI? What am I testing by doing that? Sorry, I’m a bit lost here.
If I understand correctly, your widget is on two different pages: the overview and another dashboard page. I suspect that if the widget is not on your overview page that it will fail to load the first time you open the dashboard page because that will be the first time the UI processes the widget. If you reopen the dashboard page a second time it will work correctly.
If I have misunderstood and this widget only exists on the overview, then, to perform the same test, just create a quick test page with the widget on it and remove the widget from the overview page. The idea is to make sure that it is not anything special about the overview page that is causing the prolem.
Ah, okay – here’s the sequence of events:
New browser session → access http://openhab:8080 → overview page with empty widget output → navigate to a custom dashboard containing the same widget → navigate back to the overview page: the widget content is now displayed.
New browser session → access http://openhab:8080/page/page_ed204701e0 → the widget is displayed → navigate to the overview page: the widget is displayed.
In both cases, it is the same widget with exactly the same parameters. The code from the custom “dashboard” page was transferred to the “overview” page via copy-and-paste within the page editor.
I have now inserted the widget into a test page, and it displays without any issues.
Interestingly, I am now seeing the same behavior as with the dashboard page: when the overview page is loaded for the first time, the widget is empty; however, after visiting the test page and then navigating to the overview page, the widget content appears.
Well, at this point it certainly sounds like a bug and unless there are any errors in the browser console that tell us where to look when the widget fails to load, I don’t know what else to try and track down.
At this point, I suggest filing a bug report in the UI repository.
I figured as much ![]()
I’ll try to report a bug like this myself; in the past (in a former life), I used to let my guys handle that…
In any case, thank you very much for your help.
A timid question: in which repository—or for which repository—should I submit the issue on GitHub? There are several UI respositories
It can get a little overwhelming. This is not specific to a certain mobile interface, but seems to be an issue with MainUI itself. MainUI and the other historically official UIs (basicUI etc.) are all under the single webui repo:
You should file the issue there and just make sure you select the MainUI bug report template.