-
-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic icons causing way too many requests #3404
Comments
They work by sending the item state as query parameter. Whether or not that request will yield a different or the same icon is something not known to the app, only to the server. |
@maniac103 maybe it should be something the app could know then? We could add an api to openhab-core to get this information. For example the server could return the number ranges for which a given icon are valid ("0-1000: icon1, 1001-5000: icon2"), so the android app doesn't need to request an icon of a range already loaded. Also I found the issue that items are not updating at all is not related to the android app but to the eventstream of openhab-core. |
👍 Anything else requires some server side changes and I remember a similar issue years ago that was closed as "won't fix". I can't find it right now, though. |
But why don't fix it properly? This issue is worth to solve it properly as it easily generates a lot of traffic and probably for many people (most likely unknowingly) it will also cause more unnecessary mobile data usage which is quite bothering. |
Things I can see:
|
I agree that it needs a change to core. However I don't agree that it's a breaking change. It won't break anything. Following things are proposed:
Seems like my usecase is specific, which I think is a bit unfortunate. Openhab is way more pretty with fast updating items and there are many usecases for that. |
That's not true. The default poweroutlet icon is static, but there's nothing hindering the user from adding additional icons that make it dynamic. Because of this, compiling icons into the app also is not an option.
That's probably worth a feature request in core.
I already acknowledged this above.
Now you're saying me and @mueller-ma are just too lazy to properly think about the problem? |
That's you saying that. Other option could be to add an option to the android app to disable dynamic icon loading, maybe only for the remote server. On the local network it doesn't matter so much (besides the icons flickering - disappearing and appearing again), but connecting to the remote server it matters. |
You can enable the data saver mode to disable dynamic icons. But be aware that other data-heavy widgets won't work as well, e.g. images. I'm not saying that it shouldn't be changed something on the server side, but in this case it's getting a lot better when the formatting is applied to the icon URL. And please note that icons are cached forever until you press "Clear icon cache" in the settings. |
@mueller-ma ah I wasn't aware of the data-saver, that's good, will try it. Also wasn't aware about that it's cached forever. How does the caching work as I thought only the server knows if there is a change? In my case will also be quite some to cache (>10000 states) What would be your suggestion for that usecase? Having Grid/PV power refreshing 1-2 times a second, values usually varying between -5000W and 10000W. |
I believe we could add a new property to the sitemap widget, something like "iconIgnoreState". If present, the sitemap UI will build an icon URL without the item state and the cache will then be used whatever the item state. @maniac103 @mueller-ma : WDYT ? There is something similar in MainUI, even if I am not 100% sure of the current status of this option in OH4. |
@mueller-ma : it is a parameter for the default list widget. |
For consistency with Main UI a new Sitemap parameter |
By the way, this will be a parameter for sitemap elements. I am not in favor to hardcode something about item type in each sitemap UI. |
Finally, I think we can add a parameter |
I suggest instead |
My PR was almost ready with |
Added to the following sitemap elements: text, input, switch, slider, selection, setpoint, colorpicker and default. When set, the UI should not provide the item state when requestiong the OH icon and should not request again the icon when the item state is updated. The default is to use the item state for dynamic icon. Related to openhab/openhab-android#3404 Signed-off-by: Laurent Garnier <[email protected]>
When set, the UI should not provide the item state when requestiong the OH icon and should not request again the icon when the item state is updated. Related to openhab/openhab-android#3404 Signed-off-by: Laurent Garnier <[email protected]>
When set on a sitemap element, Basic UI ignores the item state when initially requesting the OH icon and do not request it again when the item state is updated. Depends on openhab/openhab-core#3735 Related to openhab/openhab-android#3404 Signed-off-by: Laurent Garnier <[email protected]>
It is now implemented in core framework and in Basic UI. We just need to wait for review & merge. |
I'm fine with that as well. |
Imho this makes the code in openhab/openhab-core#3735 not consistant. |
My understanding is that |
Hm, well, it is a keyword whose presence corresponds to a boolean param. |
For instance? |
Ok, that is possible and it keeps backward compatibility. |
@lolodomo What @kaikreuzer wrote sounds to me more like: If the parameter is called |
That is also what I understand.
But having both is what @kaikreuzer propose! |
How about |
I think the 'mutually exclusive' part is what @lolodomo referred to in
I agree this would be the most elegant solution. |
When set, the UI should not provide the item state when requestiong the OH icon and should not request again the icon when the item state is updated. Related to openhab/openhab-android#3404 Signed-off-by: Laurent Garnier <[email protected]>
When set on a sitemap element, Basic UI ignores the item state when initially requesting the OH icon and do not request it again when the item state is updated. Depends on openhab/openhab-core#3735 Related to openhab/openhab-android#3404 Signed-off-by: Laurent Garnier <[email protected]>
Ok, PR is changed. When the icon is implicitly defined by the sitemap element because not set neither on item nor on sitemap element, you will have to define it to make it static. Imagine this element:
and no category is set on item.
|
I do not understand this. Why is it not sufficient to write `Switch staticIcon="switch" ? |
Because you have to link your sitemap element to an item ! |
Yes, you are correct. You wrote |
When set, the UI should not provide the item state when requestiong the OH icon and should not request again the icon when the item state is updated. Related to openhab/openhab-android#3404 Signed-off-by: Laurent Garnier <[email protected]>
@openhab/android-maintainers : core PR has just been merged. This can now be handled in the Android app. |
If set, icon state should not be included when fetching the icon for a given widget. See openhab#3404 Signed-off-by: Danny Baumann <[email protected]>
See openhab#3404 Signed-off-by: Danny Baumann <[email protected]>
When set on a sitemap element, Basic UI ignores the item state when initially requesting the OH icon and do not request it again when the item state is updated. Depends on openhab/openhab-core#3735 Related to openhab/openhab-android#3404 Signed-off-by: Laurent Garnier <[email protected]>
When set on a sitemap element, Basic UI ignores the item state when initially requesting the OH icon and do not request it again when the item state is updated. Depends on openhab/openhab-core#3735 Related to openhab/openhab-android#3404 Signed-off-by: Laurent Garnier <[email protected]> Signed-off-by: Stefan Höhn <[email protected]>
When set on a sitemap element, Basic UI ignores the item state when initially requesting the OH icon and do not request it again when the item state is updated. Depends on openhab/openhab-core#3735 Related to openhab/openhab-android#3404 Signed-off-by: Laurent Garnier <[email protected]> Signed-off-by: jgeorgi <[email protected]>
When set on a sitemap element, Basic UI ignores the item state when initially requesting the OH icon and do not request it again when the item state is updated. Depends on openhab/openhab-core#3735 Related to openhab/openhab-android#3404 Signed-off-by: Laurent Garnier <[email protected]> Signed-off-by: jgeorgi <[email protected]>
When set on a sitemap element, Basic UI ignores the item state when initially requesting the OH icon and do not request it again when the item state is updated. Depends on openhab/openhab-core#3735 Related to openhab/openhab-android#3404 Signed-off-by: Laurent Garnier <[email protected]>
Actual behaviour
Each time a value is updated (with a new value which is not cached) a request is sent to openhab to load the icon. This causes incredible many request in some cases:
I am using a sitemap to show power information, this includes: grid power, PV power, battery power, power of devices, etc. The values are updated 1-2 times per second, resulting in about 10 updates per second distributed on those items. This looks incredible nice when it is actually updating. However on the app I can often see icons are flickering and also item updates are stuck until manual refresh. This github issue is for the icons, for the items not updating I still need to analyze why this is happening. In the android studio app inspection I can see that incredible many requests are done to resolve the same icon (poweroutlet, which I am using for all those items).
Generally I have the feeling the app is not really optimized when values are updated multiple times a second (as the UI gets stuck quite often), which is a pity as this looks incredible nice when it actually works.
Expected behaviour
Icons should be cached more aggressively, I'm not sure how an optimal solution could look like but maybe considering something like this
Steps to reproduce
(app is connected to local url)
Can you reproduce the issue in demo mode?
Environment data
Client
Server
The text was updated successfully, but these errors were encountered: