I have openHAB running on an Android Tablet using the Android App.
Recently the APP started crashing multiple times a day - sometimes with unloadable reports, sometimes not.
I eventually managed to get some logs which I submitted and the suspicion was that the APP was not at fault but that the “WebView (Chrome) process and/or the graphics driver crashed”.
I tried everything to work around that, including a Factory Reset of the device.
As a last resort I removed everything except a Clock Widget from the Overview Page. With it like that the Page has been stable for more than a day.
I have added back all the oh-cells except for the last two created ones and seems stable too.
What I would like to understand is how the Overview page could cause the Android App to crash while “IDLE” with oh-cell closed?
Do these unopened oh-cells still get rendered somehow that could cause this?
How do I work out what in my oh-cell could be causing the issue?
I think the answer here is “partially”. The cell contents container is the same whether the cell is opened or not, and if you have other elements in there with cell-opened-fade-in class then those contents are indeed loaded even if the cell is closed, they just have an opacity of 0 which then gets animated to 100 to get the fade-in effect.
Whether or not that’s what’s causing the issue is hard to say, but it’s definitely a possibility. You should be able to inspect the page in a desktop browser and see if the elements are actually listed in the rendered page code even with the cells closed.
Thanks Justin. I did investigate this and yes - the components do seem to be rendered.
I have managed to narrow down the issue to a specific widget (by manually removing each cell till the issue was no longer evident) - and in fact to the “work around” that you proposed for getting Charts to refresh. My Code is as follows,
Sounds to me like something is just getting overloaded. Charting is not a trivial processing task. There’s quite a bit of data transfer as the persistence database gets queried each time (especially depending on the frequency of the time series and the time frame of the chart), then the e-charts library has to render the data as an svg before it gets displayed. I don’t know the specs on the tablet you’re using, but it’s possible that’s just too much to ask it to do constantly at the refresh rate you’ve selected.
You could try using a lower refresh rate and see if that decreases the problem.
You can also try to use the visible property on the whole popup. When visible is false, a component (and therefore all it’s children) is just not rendered. Because you’re using an oh-button, you can use the popupOpen and oh actions simultaneously, so you could set a variable with that button that controls the visible property on the popup. Of course, the popup close buttons would have to clear that variable also which means it will have to be a page level variable instead of just in the widgets so that all the components have access to it.
Thanks Just for your as usual insightful response.
I agree that something may be getting overloaded. The tablet is not the most powerful but was able to happily run Minecraft etc. before I took it over from my kids.
I really like this idea, so gave it a go with a small widget that I use as the basis for my others.
As usual with me I ran into a few issues:
Applying the visibility to the f7-popup did not work, so my next best option was to apply to the f7-block inside the popup.
I then also ran into the issue with variables on the Overview page - similar issue to what I have had before
Works in widget builder
Works on a layout page
*Works on Overview page when in Run Mode from Settings
*Does NOT work on Overview page
Does it work if you don’t make it a page level variable but just keep it at the level of the cell that has the popup? That scope should probably be sufficient.
Another option would be to stop the refreshing while the popup is closed. You should have a rule that is changing the item which changes the state of UI_Refresh_Timer, you can add another item switch item e.g., UI_Refresh_Toggle, and set that in the condition of the rule (But Only IF...UI_Refresh_Toggle == ON). Then instead of changing a variable in your widget, if that widget sends ON and OFF commands to the toggle item then the graph will still be rendered all the time but only refreshing when displayed (i.e., the toggle item is on).
The one caveat with this is that when you first open the graph it may still be showing an old version and, depending on your refresh rate, you may have to wait a bit to see the new graph. You can easily fix this by also adding the UI_Refresh_Toggle state to the key property as well. Then the graph will also refresh every time the popup is opened.
I set the value in the oh-cell, and only tried to set a default vlue at the Page level.
It seems that when using the Overview page, variables in general do not work.
The only way I have been able to get them to work is to call a completely separate widget using widget:xxx, which is not ideal.
I have for now removed the refresh completely. But as you mentioned you can then get a stale chart. Have to refresh the Overview page to get an update.
I will have a look at you rother suggestions. So thank you for that.