openhab / openhab-core

Core framework of openHAB
https://www.openhab.org/
Eclipse Public License 2.0
925 stars 424 forks source link

UoM item in group #1504

Closed mstormi closed 3 years ago

mstormi commented 4 years ago

I had this UoM item

Number:Intensity maxSonnenscheinRad "max. Sonneneinstrahlung zu dieser Uhrzeit [%.1f W/m²]" <sun> (Sonnenschutz,Einstellungen)

with a valid value but on updates it kept causing trouble in both groups it is in. (Both groups have no specific type or auto calculation of AVG or similar)

2020-05-29 08:43:40.903 [WARN ] [pse.smarthome.core.items.GenericItem] - failed notifying listener 'Einstellungen (Type=GroupItem, Members=45, State=NULL, Label=Einstellungen, Category=gear, Groups=[All])' about state update of item maxSonnenscheinRad: Unable to convert to system unit during compare.
java.lang.IllegalArgumentException: Unable to convert to system unit during compare.
        at org.eclipse.smarthome.core.library.types.QuantityType.compareTo(QuantityType.java:171) ~[bundleFile:?]
        at org.eclipse.smarthome.core.library.types.QuantityType.equals(QuantityType.java:156) ~[bundleFile:?]
        at org.eclipse.smarthome.core.items.GenericItem$1.run(GenericItem.java:260) [bundleFile:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_222]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_222]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]
2020-05-29 08:43:40.903 [WARN ] [pse.smarthome.core.items.GenericItem] - failed notifying listener 'Sonnenschutz (Type=GroupItem, Members=20, State=1, Label=Sonnenschutz, Category=sun, Groups=[All])' about state update of item maxSonnenscheinRad: Unable to convert to system unit during compare.
java.lang.IllegalArgumentException: Unable to convert to system unit during compare.
        at org.eclipse.smarthome.core.library.types.QuantityType.compareTo(QuantityType.java:171) ~[bundleFile:?]
        at org.eclipse.smarthome.core.library.types.QuantityType.equals(QuantityType.java:156) ~[bundleFile:?]
        at org.eclipse.smarthome.core.items.GenericItem$1.run(GenericItem.java:260) [bundleFile:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_222]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_222]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]

On another occasion I got

2020-05-29 09:42:58.026 [ERROR] [me.core.internal.events.EventHandler] - Creation of ESH-Event failed, because one of the registered event factories has thrown an exception: Error invoking #valueOf(String) on class 'org.eclipse.smarthome.core.library.types.QuantityType' with value '360.24870776619883 1/(m²·m²)'.
java.lang.IllegalStateException: Error invoking #valueOf(String) on class 'org.eclipse.smarthome.core.library.types.QuantityType' with value '360.24870776619883 1/(m²·m²)'.
        at org.eclipse.smarthome.core.items.events.ItemEventFactory.parseSimpleClassName(ItemEventFactory.java:189) ~[?:?]
        at org.eclipse.smarthome.core.items.events.ItemEventFactory.parseType(ItemEventFactory.java:157) ~[?:?]
        at org.eclipse.smarthome.core.items.events.ItemEventFactory.getState(ItemEventFactory.java:135) ~[?:?]
        at org.eclipse.smarthome.core.items.events.ItemEventFactory.createStateChangedEvent(ItemEventFactory.java:130) ~[?:?]
        at org.eclipse.smarthome.core.items.events.ItemEventFactory.createEventByType(ItemEventFactory.java:83) ~[?:?]
        at org.eclipse.smarthome.core.events.AbstractEventFactory.createEvent(AbstractEventFactory.java:55) ~[?:?]
        at org.eclipse.smarthome.core.internal.events.EventHandler.createESHEvent(EventHandler.java:134) ~[?:?]
        at org.eclipse.smarthome.core.internal.events.EventHandler.handleEvent(EventHandler.java:108) ~[?:?]
        at org.eclipse.smarthome.core.internal.events.EventHandler.handleEvent(EventHandler.java:85) ~[?:?]
        at org.eclipse.smarthome.core.internal.events.ThreadedEventHandler.lambda$0(ThreadedEventHandler.java:67) ~[?:?]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.GeneratedMethodAccessor1804.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_222]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_222]
        at org.eclipse.smarthome.core.items.events.ItemEventFactory.parseSimpleClassName(ItemEventFactory.java:180) ~[?:?]
        ... 10 more
Caused by: java.lang.IllegalArgumentException: unexpected token 8
        at tec.uom.se.quantity.Quantities.getQuantity(Quantities.java:80) ~[?:?]
        at org.eclipse.smarthome.core.library.types.QuantityType.<init>(QuantityType.java:95) ~[?:?]
        at org.eclipse.smarthome.core.library.types.QuantityType.valueOf(QuantityType.java:138) ~[?:?]
        at sun.reflect.GeneratedMethodAccessor1804.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_222]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_222]
        at org.eclipse.smarthome.core.items.events.ItemEventFactory.parseSimpleClassName(ItemEventFactory.java:180) ~[?:?]
        ... 10 more
cweitkamp commented 4 years ago

Thanks for reporting. We had a similar issue #1373 which is fixed by #1377 and #1406 in OH3.

mstormi commented 4 years ago

Running 2.5.5 so #1377 should be in ?

cweitkamp commented 4 years ago

No, unfortunately not. OH 2.5.x is based on OHC 2.5 which has been released on 16th Dec. 2019. #1377 has been merged in Feb. 2020.

mstormi commented 4 years ago

Oh, ok. That's confusing many users not just me. Will there ever be an update to OHC2.5? Else it does not make sense to maintain things in 2 places, does it ? (given that OH3 has its own branch)

cweitkamp commented 4 years ago

We do not maintain the core in two places. OHC2.5 was a final release and we do not plan to release any updates for it in the future. This repository only contains a "master" branch for OHC3.

mstormi commented 4 years ago

Ah, so I misunderstood your statement (as #1377 being a fix to OH2.5 and #1406 being the same fix just applied to OH3). Man sollte mal boolsche Logik-Klammern in der Sprache einführen :-) Ok so no fix for now. Will then remove that item from the group as a workaround.

mstormi commented 4 years ago

How do you handle cases like this in Github ? keep open until we can validate it's fixed in OH3?

cweitkamp commented 4 years ago

There is no special way to handle such cases. Fell free to close this issue or not.

cweitkamp commented 3 years ago

@mstormi May I ask you to check if it is fixed in OH3? Thanks.

mstormi commented 3 years ago

Haven't ever seen it again since running OH3 so I think it's fixed.