Hello,
just one quick how to (if anyhow)
I have a script which generates picture with shadows of the house based on sun/time. It’s saved as static file in OH, every change.
In the version 3.x Images shown on basicUI has been automatically refreshed
In the 4.x seems they are cached and to view changes I need to hit hard refresh in the browser.
I’ve seen solution in here
Is there any other way how to make dynamic image on UI refreshed?
well the difference is, that he is calling html which refreshes itself.
but I’m calling svg, which refreshes itself, but webview does not care. Not sure if those are the same things.
I need to digout if svg has got some expiration header or smthing like that.
(again. in older version of OH this worked just fine …)
Webview is implemented in Basic UI with iframe. The src attribute of this iframe is set when opening the page and then never updated. I don’t see how the content of the iframe could have been automatically refreshed in the past by the app itself. And no change was done for this element.
Maybe a behaviour change in the browser you use?
Are you still using the same browser and what browser?
If I recon it correctly, it was updated when page got loaded, not automatically each minute.
What’s different now is that content is not updated till hard refresh of the browser.
And this svg is not on the main page, so shall be update everytime I go into the subframe.
Later today I’ll run OH3.x again to see if it is browser issue or something in the OH4
Am using still same browser for ages in the iPad which controls whole house, so this has not changed. Also on all of my computers with various different browsers it acts same.
My thinking is, maybe browser see this as static values each time? (not sure how OH interprets item values) so it’s not random number each change, but always the same name - therefor cached by browsers by default?
I even do not understand your syntax. You request a SVG image passing to it parameters ? This is something possible ? What do you expect exactly with “?{{itemValue(‘Sun_Azimuth’)}}” ? “itemValue” comes from where ?
You expect itemValue as being an existing JavaScript table provided by the JavaScript of Basic UI ?
This table does not exist in smarthome.js and I clearly do not remember to have removed it in the past.
Starting the UI (using Chromium on Ubuntu) it will always first load the cached image. I remember not having this issue before, not sure since when exactly this happens. Could be since version 4.x. I’m currently on openHAB 4.1.1 - Release Build
Not being able to find an option in Chromium to clear all cache on exit makes it worse
It was really working in the past… But I can’t really tell if that was just coincidence or really because it was called with actual number.
Anyway, if we probably found why it’s being cached. Is there a way how to call it with some parameter?
I can indeed do rule to populate any item, or something else with random number each time, but the question is how it will be translated in the BasicUI? eg. how to write it properly on the sitemap.
First, I would like to understand what you were doing and learn about that. I am not familiar with this syntax of HTML URL “/static/shadow.svg?{{itemValue(‘Sun_Azimuth’)}}”. How should a browser handle the part “{{itemValue(‘Sun_Azimuth’)}}” ? Is it supposed to interpret something ?
It’s the HABPanel angularJS syntax. It looks like it was even taken from a HABPanel thread. I can’t imagine that it has any actual function in the sitemap webview.
A Webview element is currently attached to no item, that is the initial point so you can’t expect a refresh based on an item update. If something should be implemented to add refresh capability to the Webview element, certainly it will not be with such exotic syntax. We should imagine something that will be intuitive and consistent with what exists for other sitemap elements.
Please open a feature request in GitHub - openhab/openhab-core: Core framework of openHAB explaining your need of a refresh feature for the Webview sitemap element. Then this will be discussed with all the maintainers. This new feature will require changes everywhere, core framework for sitemap syntax extension and updated sitemap REST API, Main UI for the sitemap generator and of course all sitemap UIs (Basic UI, Android app, iOS app).