eclipse-archived / smarthome

Eclipse SmartHome™ project
https://www.eclipse.org/smarthome/
Eclipse Public License 2.0
865 stars 782 forks source link

References to items in the Frame declaration, within a sitemap, block updates on icons! #2902

Closed sailorsail closed 7 years ago

sailorsail commented 7 years ago

In a clean install of openHAB 2.0 Release Build, I've used the following configuration: file.items

Switch Light_WCSmall_Ceiling    "Light Ceiling WC Small"                
Switch Light_WCBig_Ceiling  "Light Ceiling WC Big"              
Number Temp_WCBig       "Temperature WC Big [%.2f °C]"  

file.sitemap

sitemap demo label="demo" {
    Text label="WC1" {
        Frame label="test" {
            Switch item=Light_WCBig_Ceiling
            }
        }
    Text label="WC2" {
        Frame item=Temp_WCBig {
            Switch item=Light_WCSmall_Ceiling
            }
        }
    }

When I toggle 'Light_WCBig_Ceiling', within “WC1” page, the update of the icon is performed; no refresh is necessary on the user interface (either iOS or Web Basic UI). However if I toggle 'Light_WCBig_Ceiling', within “WC2” page, the update of the icon is not performed. Nevertheless, if I refresh the page, navigate back, and in again, the change is then shown. The only diference here is the use of item=Temp_WCBig in the Frame declaration. Allegedly, the use of items in frame declarations is possible, but I wasn’t expecting the different behaviour. Shouldn’t the reaction to the toggle be consistent, or is this the expected behaviour? Do you have any ideias about what's going on?

kaikreuzer commented 7 years ago

Same question that I asked before: Did you identify this to be a problem with the Basic UI only? Does it work with the Classic UI and the native apps?

sailorsail commented 7 years ago

I did, but I forgot to mention it here! Either Basic UI, Classic UI or native iOS present the same behaviour.

lolodomo commented 7 years ago

I can confirm this bug, I was able to reproduce it. Maybe a problem with produced SSE events ?

lolodomo commented 7 years ago

In fact, all items in such a frame are simply not updated, even when the update is triggered outside.

I should mention some validation errors of my sitemap at OH startup when using such a frame:

2017-04-30 20:24:01.924 [ERROR] [xtext.validation.CompositeEValidator] - Error executing EValidator
java.lang.IllegalArgumentException: The sources EClass 'Sitemap' does not expose the feature 'Widget.LabelColor'
        at org.eclipse.xtext.validation.FeatureBasedDiagnostic.<init>(FeatureBasedDiagnostic.java:33)
        at org.eclipse.xtext.validation.AbstractDeclarativeValidator.createDiagnostic(AbstractDeclarativeValidator.java:613)
        at org.eclipse.xtext.validation.AbstractDeclarativeValidator.acceptError(AbstractDeclarativeValidator.java:556)
        at org.eclipse.xtext.validation.AbstractDeclarativeValidator.error(AbstractDeclarativeValidator.java:441)
        at org.eclipse.xtext.validation.AbstractDeclarativeValidator.error(AbstractDeclarativeValidator.java:420)
        at org.eclipse.xtext.validation.AbstractDeclarativeValidator.error(AbstractDeclarativeValidator.java:408)
        at org.eclipse.smarthome.model.validation.SitemapValidator.checkFramesInWidgetList(SitemapValidator.java:53)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_121]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_121]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_121]
        at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_121]
        at org.eclipse.xtext.validation.AbstractDeclarativeValidator$MethodWrapper.invoke(AbstractDeclarativeValidator.java:118)
        at org.eclipse.xtext.validation.AbstractDeclarativeValidator.internalValidate(AbstractDeclarativeValidator.java:312)
        at org.eclipse.xtext.validation.AbstractInjectableValidator.validate(AbstractInjectableValidator.java:71)
        at org.eclipse.xtext.validation.CompositeEValidator.validate(CompositeEValidator.java:151)
...
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
        at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)[org.eclipse.osgi-3.10.101.v20150820-1432.jar:]
2017-04-30 20:24:02.099 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'maison.sitemap', using it anyway:
Error executing EValidator

Maybe it is something not accepted. I should admit that Eclipse Smarthome Designer does not mention an error.

lolodomo commented 7 years ago

I fixed this problem for Classic UI.

I will fix it later for Basic UI. I know how to fix it. The bug is here: https://github.com/eclipse/smarthome/blob/master/bundles/io/org.eclipse.smarthome.io.rest.sitemap/src/main/java/org/eclipse/smarthome/io/rest/sitemap/internal/PageChangeListener.java#L129

lolodomo commented 7 years ago

I also fixed the problem for Basic UI.