Skip to content
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

[Basic UI] After GenericItem.setCategory(…) icons are not updated until manual reload #1938

Closed
dilyanpalauzov opened this issue Jun 24, 2023 · 7 comments
Labels
basic ui Basic UI bug Something isn't working

Comments

@dilyanpalauzov
Copy link

dilyanpalauzov commented Jun 24, 2023

I update an icon of an item using .setCategory(), as described at openhab/openhab-android#3427 . The icons are not updated in Basic UI, until I manually reload the page.

After I manually reload (F5) the webpage, the new icon is shown, so .setCategory() has indeed performed the desired change.

I have openHAB 3.4.2.

@dilyanpalauzov dilyanpalauzov added the bug Something isn't working label Jun 24, 2023
@dilyanpalauzov dilyanpalauzov changed the title [Basic UI] After GenericItem.setCategory(…) icons are not updated until manual reload [Basic UI] After GenericItem.setCategory(…) icons are not updated until manual reload Jun 24, 2023
@lolodomo
Copy link
Contributor

I don't think it is really expected to use setCategory inside a rule.
IMHO, the category of an item should only be updated during configuration, either in config file or using MainUI and REST API.
So, I am not surprised that the category is not dynamically updated by BasicUI. I am even not sure that this information is sent by the server to the UI through SSE.

@mueller-ma
Copy link
Member

I cannot say anything about when this function should or should not be called, but couldn't the server send a "item changed" sse event anyway?

@lolodomo
Copy link
Contributor

lolodomo commented Jul 17, 2023

Few additional information:

  1. I believe the principle of sitemap UIs is to react to item state updates, not to item setup updates.
  2. But even on an item state update (after a change of item category), Basic UI will not update the icon type until the page is reloaded, this information is parsed only once (using the sitemap REST API) when the page is opened and not later when the page is updated (SSE events).
  3. It looks like there is an icon member in the DTO SitemapWidgetEvent used by the SSE mechanism but looking at the code, I believe it is never set by the server.

I will probably not investigate more, my opinion is that sitemap UIs are not conceived to react in real time to setup changes. A simple page reload after a change of setup looks fine to me. And changing the category of an item or sitemap widget is a setup change.

@dilyanpalauzov
Copy link
Author

openhab/openhab-android#3427 described the use case for this request and states, that the server does not send category-changed events.

Page reload does not help here. The item is suuposed to present many properties of a device(equipment) in a compact way. One piece of the presentation is the icon(category). When the state of one item changes, the icon of of another item is modifed.

E.g. when one item is ON the icon of another item presents the symbol I. When the item changes to OFF, the icon of the second item is updated to to show O.

@proggprod
Copy link

This is a valid use case imo. I use the key: property to refresh repeaters and other widgets

key: =Math.random() + items.itemThatWillChangeToCauseARefresh.state

@lolodomo
Copy link
Contributor

lolodomo commented Aug 14, 2023

Ok, I propose to extend the syntax for icon parameter to make it more dynamic:, that is with conditions on possible other item states. This will also add a dynamic feature when using non openHAB icons.
The proposed syntax is just similar to iconcolor/labelcolor/valuecolor:
icon=[item1==0=temperature, item2==1=oh:classic:humidity, ==0=material:settings, material:home]
The dynamic computation of the icon will be done by the server. There will be only a minor change required in sitemap UIs to take into account the changed icon coming in a field of the SSE events.

lolodomo added a commit to lolodomo/openhab-core that referenced this issue Aug 14, 2023
Related to openhab/openhab-webui#1938

Example: icon=[item1>0=temperature,==0=material::settings,material::home]

Signed-off-by: Laurent Garnier <[email protected]>
lolodomo added a commit to lolodomo/openhab-core that referenced this issue Aug 14, 2023
Related to openhab/openhab-webui#1938

Allow dynamic icon based on other item states.
Allow dynamic icon even with non OH icon sources.

Example: icon=[item1>0=temperature,==0=material::settings,material::home]

Signed-off-by: Laurent Garnier <[email protected]>
lolodomo added a commit to lolodomo/openhab-core that referenced this issue Aug 14, 2023
Related to openhab/openhab-webui#1938

Allow dynamic icon based on other item states.
Allow dynamic icon even with non OH icon sources.

Example: icon=[item1>0=temperature,==0=material::settings,f7::house]

Signed-off-by: Laurent Garnier <[email protected]>
lolodomo added a commit to lolodomo/openhab-core that referenced this issue Aug 14, 2023
Related to openhab/openhab-webui#1938

Allow dynamic icon based on other item states.
Allow dynamic icon even with non OH icon sources.

Example: icon=[item1>0=temperature,==0=material::settings,f7::house]

Signed-off-by: Laurent Garnier <[email protected]>
lolodomo added a commit to lolodomo/openhab-core that referenced this issue Aug 14, 2023
Related to openhab/openhab-webui#1938

Allow dynamic icon based on other item states.
Allow dynamic icon even with non OH icon sources.

Example: icon=[item1>0=temperature,==0=material::settings,f7::house]

Signed-off-by: Laurent Garnier <[email protected]>
lolodomo added a commit to lolodomo/openhab-core that referenced this issue Aug 14, 2023
Related to openhab/openhab-webui#1938

Allow dynamic icon based on other item states.
Allow dynamic icon even with non OH icon sources.

Example: icon=[item1>0=temperature,==0=material::settings,f7::house]

Signed-off-by: Laurent Garnier <[email protected]>
lolodomo added a commit to lolodomo/openhab-core that referenced this issue Aug 14, 2023
Related to openhab/openhab-webui#1938

Allow dynamic icon based on other item states.
Allow dynamic icon even with non OH icon sources.

Example: icon=[item1>0=temperature,==0=material::settings,f7::house]

Signed-off-by: Laurent Garnier <[email protected]>
lolodomo added a commit to lolodomo/openhab-core that referenced this issue Aug 14, 2023
Related to openhab/openhab-webui#1938

Allow dynamic icon based on other item states.
Allow dynamic icon even with non OH icon sources.

Example: icon=[item1>0=temperature,==0=material::settings,f7::house]

Signed-off-by: Laurent Garnier <[email protected]>
lolodomo added a commit to lolodomo/openhab-core that referenced this issue Aug 14, 2023
Related to openhab/openhab-webui#1938

Allow dynamic icon based on other item states.
Allow dynamic icon even with non OH icon sources.

Example: icon=[item1>0=temperature,==0=material::settings,f7::house]

Signed-off-by: Laurent Garnier <[email protected]>
lolodomo added a commit to lolodomo/openhab-core that referenced this issue Aug 14, 2023
Related to openhab/openhab-webui#1938

Allow dynamic icon based on other item states.
Allow dynamic icon even with non OH icon sources.

Example: icon=[item1>0=temperature,==0=material::settings,f7::house]

Signed-off-by: Laurent Garnier <[email protected]>
lolodomo added a commit to lolodomo/openhab-core that referenced this issue Sep 30, 2023
…ditional rules for icon

Allow multiple conditions with AND operator in visibility/color/icon rules

Closes openhab#3058

Also allow dynamic icon based on other item states.
Allow dynamic icon even with non OH icon sources.

Example: icon=[item1>0=temperature,==0=material:settings,f7:house]

Related to openhab/openhab-webui#1938

Signed-off-by: Laurent Garnier <[email protected]>
lolodomo added a commit to lolodomo/openhab-core that referenced this issue Sep 30, 2023
…ditional rules for icon

Allow multiple conditions with AND operator in visibility/color/icon rules

Closes openhab#3058

Also allow dynamic icon based on other item states.
Allow dynamic icon even with non OH icon sources.

Example: icon=[item1>0=temperature,==0=material:settings,f7:house]

Related to openhab/openhab-webui#1938

Signed-off-by: Laurent Garnier <[email protected]>
lolodomo added a commit to lolodomo/openhab-core that referenced this issue Sep 30, 2023
…ditional rules for icon

Allow multiple conditions with AND operator in visibility/color/icon rules

Closes openhab#3058

Also allow dynamic icon based on other item states.
Allow dynamic icon even with non OH icon sources.

Example: icon=[item1>0=temperature,==0=material:settings,f7:house]

Related to openhab/openhab-webui#1938

Signed-off-by: Laurent Garnier <[email protected]>
lolodomo added a commit to lolodomo/openhab-core that referenced this issue Oct 1, 2023
…ditional rules for icon

Allow multiple conditions with AND operator in visibility/color/icon rules

Closes openhab#3058

Also allow dynamic icon based on other item states.
Allow dynamic icon even with non OH icon sources.

Example: icon=[item1>0=temperature,==0=material:settings,f7:house]

Related to openhab/openhab-webui#1938

Unit tests added or extended to cover the new features.

Signed-off-by: Laurent Garnier <[email protected]>
lolodomo added a commit to lolodomo/openhab-core that referenced this issue Oct 1, 2023
…ditional rules for icon

Allow multiple conditions with AND operator in visibility/color/icon rules

Closes openhab#3058

Also allow dynamic icon based on other item states.
Allow dynamic icon even with non OH icon sources.

Example: icon=[item1>0=temperature,==0=material:settings,f7:house]

Related to openhab/openhab-webui#1938

Unit tests added or extended to cover the new features.

Signed-off-by: Laurent Garnier <[email protected]>
lolodomo added a commit to lolodomo/openhab-core that referenced this issue Oct 2, 2023
This allows dynamic icons based on items states even with non OH icon sources.

Example: icon=[item1>0=temperature,==0=material:settings,f7:house]

Related to openhab/openhab-webui#1938

Signed-off-by: Laurent Garnier <[email protected]>
lolodomo added a commit to lolodomo/openhab-core that referenced this issue Oct 2, 2023
This allows dynamic icons based on items states even with non OH icon sources.
This also allows overwritting the default handling with state done by the icon servlet.

Example: icon=[item1>0=temperature,==0=material:settings,f7:house]

Related to openhab/openhab-webui#1938

Signed-off-by: Laurent Garnier <[email protected]>
lolodomo added a commit to lolodomo/openhab-core that referenced this issue Oct 2, 2023
This allows dynamic icons based on items states even with non OH icon sources.
This also allows overwritting the default handling with state done by the icon servlet.

Example: icon=[item1>0=temperature,==0=material:settings,f7:house]

Related to openhab/openhab-webui#1938

Signed-off-by: Laurent Garnier <[email protected]>
kaikreuzer pushed a commit to openhab/openhab-core that referenced this issue Oct 15, 2023
This allows dynamic icons based on items states even with non OH icon sources.
This also allows overwritting the default handling with state done by the icon servlet.

Example: icon=[item1>0=temperature,==0=material:settings,f7:house]

Related to openhab/openhab-webui#1938

Signed-off-by: Laurent Garnier <[email protected]>
@lolodomo
Copy link
Contributor

With openhab/openhab-core#3819 and openhab/openhab-core#3820 merged, I believe your use cases are now covered by the ability to define more complex rules in the sitemap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
basic ui Basic UI bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants