UoM Errors in Groups since OH 2.5

Items and groups that worked fine in 2.4 now generate warnings and errors in 2.5.

I suspect it has to do with QuantityTypes and Groups. Unfortunately I can’t identify the exact problem from the error messages.

I hope someone can help me.

2019-12-24 12:03:38.849 [WARN ] [pse.smarthome.core.items.GenericItem] - failed notifying listener 'Wetter (Type=GroupItem, Members=6, State=NULL, Label=Wetterdaten, Category=sun_clouds)' about state update of item Solarstrahlung: Can not compare incompatible units.
java.lang.IllegalArgumentException: Can not compare incompatible units.
	at org.eclipse.smarthome.core.library.types.QuantityType.compareTo(QuantityType.java:174) ~[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]
2019-12-24 12:03:38.850 [WARN ] [pse.smarthome.core.items.GenericItem] - failed notifying listener 'Ps_Rrd4j (Type=GroupItem, Members=23, State=NULL, Label=RRD4J, Category=null)' about state update of item Solarstrahlung: Can not compare incompatible units.
java.lang.IllegalArgumentException: Can not compare incompatible units.
	at org.eclipse.smarthome.core.library.types.QuantityType.compareTo(QuantityType.java:174) ~[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]
java.lang.IllegalArgumentException: Can not compare incompatible units.
	at org.eclipse.smarthome.core.library.types.QuantityType.compareTo(QuantityType.java:174) ~[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]
2019-12-24 12:05:11.059 [WARN ] [pse.smarthome.core.items.GenericItem] - failed notifying listener 'org.eclipse.smarthome.core.persistence.internal.PersistenceManagerImpl@a2c66f' about state update of item Solarstrahlung: Can not compare incompatible units.
java.lang.IllegalArgumentException: Can not compare incompatible units.
	at org.eclipse.smarthome.core.library.types.QuantityType.compareTo(QuantityType.java:174) ~[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]
2019-12-24 12:05:11.062 [ERROR] [me.core.internal.events.EventHandler] - Dispatching/filtering event for subscriber 'org.eclipse.smarthome.core.events.EventSubscriber' failed: Can not compare incompatible units.
java.lang.IllegalArgumentException: Can not compare incompatible units.
	at org.eclipse.smarthome.core.library.types.QuantityType.compareTo(QuantityType.java:174) ~[?:?]
	at org.eclipse.smarthome.core.library.types.QuantityType.equals(QuantityType.java:156) ~[?:?]
	at org.eclipse.smarthome.core.items.GenericItem.applyState(GenericItem.java:234) ~[?:?]
	at org.eclipse.smarthome.core.items.GenericItem.setState(GenericItem.java:219) ~[?:?]
	at org.eclipse.smarthome.core.library.items.NumberItem.setState(NumberItem.java:121) ~[?:?]
	at org.eclipse.smarthome.core.internal.items.ItemUpdater.receiveUpdate(ItemUpdater.java:75) ~[?:?]
	at org.eclipse.smarthome.core.items.events.AbstractItemEventSubscriber.receive(AbstractItemEventSubscriber.java:52) ~[?:?]
	at org.eclipse.smarthome.core.internal.events.EventHandler.lambda$0(EventHandler.java:155) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_222]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_222]
	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]
2019-12-24 12:05:11.059 [WARN ] [pse.smarthome.core.items.GenericItem] - failed notifying listener 'Ps_Rrd4j (Type=GroupItem, Members=23, State=NULL, Label=RRD4J, Category=null)' about state update of item Solarstrahlung: Can not compare incompatible units.
java.lang.IllegalArgumentException: Can not compare incompatible units.
	at org.eclipse.smarthome.core.library.types.QuantityType.compareTo(QuantityType.java:174) ~[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]
2019-12-24 12:05:42.057 [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 '114.0 1/(m²·m²)'.
java.lang.IllegalStateException: Error invoking #valueOf(String) on class 'org.eclipse.smarthome.core.library.types.QuantityType' with value '114.0 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.GeneratedMethodAccessor82.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.GeneratedMethodAccessor82.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

The item definition, which probably concerns it, looks as follows:

Group	Wetter			"Wetterdaten"		<sun_clouds>
Group	Ps_Rrd4j        "RRD4J"

Number:Temperature      Temperatur		"Temperatur [%.1f °C]"		<temperature>	(Ps_Rrd4j, Wetter)    { http="<[weatherCache:30000:REGEX(.*Temperatur:.*?\\s*(\\d+.\\d+)\\s*°C.*)]" }
Number:Dimensionless    Luftfeuchte		"Luftfeuchte [%d %%]"		<humidity>		(Ps_Rrd4j, Wetter)    { http="<[weatherCache:30000:REGEX(.*Luftfeuchte:.*?\\s*(\\d+)\\s*%.*)]" }
Number:Pressure	        Luftdruck		"Luftdruck [%.1f hPa]"		<pressure>		(Ps_Rrd4j, Wetter)    { http="<[weatherCache:30000:REGEX(.*Luftdruck:.*?\\s*(\\d+.\\d+)\\s*hPa.*)]" }
Number:Speed	        Regenrate		"Regenrate [%.1f mm/h]"		<rain>			(Ps_Rrd4j, Wetter)    { http="<[weatherCache:30000:REGEX(.*Regen \\(Rate\\):.*?\\s*(\\d+.\\d+)\\s*mm\\/h.*)]" }
Number:Speed	        Wind			"Wind [%.1f km/h]"			<wind>			(Ps_Rrd4j, Wetter)    { http="<[weatherCache:30000:REGEX(.*Wind:.*?\\s*(\\d+.\\d+)\\s*km\\/h.*)]" }
Number:Intensity	    Solarstrahlung	"Solarstrahlung [%d W/m²]"	<solarplant>	(Ps_Rrd4j, Wetter)    { http="<[weatherCache:30000:REGEX(.*Solarstrahlung:.*?\\s*(\\d+)\\s*Watt\\/m².*)]" }

What about the comparison rule?

This maybe the Problem

This also amazes me. But what does this unit 1/**(m²·m²)** mean? I do not use such a unit anywhere. Is it possible to determine where this unit comes from?

Looks a bit like an intensity, for a guess.

It’s a bit curious why the group is even bothering to process member updates with no aggregation function specified. If it’s not a bug, it would be a performance enhancement not to do so.

I have commented out all rules where these items occur. There are only the item definitions without rules.
I have now cleaned up the cache and restarted it. Unfortunately still the same problem:

2019-12-24 14:51:47.694 [WARN ] [pse.smarthome.core.items.GenericItem] - failed notifying listener 'Wetter (Type=GroupItem, Members=6, State=NULL, Label=Wetterdaten, Category=sun_clouds)' about state update of item Regenrate: 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]

That is not a supported Unit of Measurement.

List of Units

All units which are currently supported by default are listed in the tables below.

Imperial:

Type Unit Symbol
Pressure Inch of Mercury inHg
Temperature Fahrenheit °F
Speed Miles per Hour mph
Length Inch in
Length Foot ft
Length Yard yd
Length Chain ch
Length Furlong fur
Length Mile mi
Length League lea

SI:

Type Unit Symbol
Acceleration Metre per square Second m/s²
AmountOfSubstance Mole mol
Angle Radian rad
Angle Degree °
Angle Minute Angle
Angle Second Angle ‘’
Area Square Metre
ArealDensity Dobson Unit DU
CatalyticActivity Katal kat
Dimensionless Percent %
Dimensionless Parts per Million ppm
Dimensionless Decibel dB
ElectricPotential Volt V
ElectricCapacitance Farad F
ElectricCharge Coulomb C
ElectricConductance Siemens S
ElectricCurrent Ampere A
ElectricInductance Henry H
ElectricResistance Ohm Ω
Energy Joule J
Energy Watt Second Ws
Energy Watt Hour Wh
Energy KiloWatt Hour kWh
Force Newton N
Frequency Hertz Hz
Illuminance Lux lx
Intensity Irradiance W/m²
Length Metre m
Length Kilometre km
LuminousFlux Lumen lm
LuminousIntensity Candela cd
MagneticFlux Weber Wb
MagneticFluxDensity Tesla T
Mass Kilogram kg
Mass Gram g
Power Watt W
Pressure Pascal Pa
Pressure hectoPascal hPa
Pressure Millimetre of Mercury mmHg
Pressure Bar bar
Pressure milliBar mbar
Radioactivity Becquerel Bq
RadiationDoseAbsorbed Gray Gy
RadiationDoseEffective Sievert Sv
SolidAngle Steradian sr
Speed Metre per Second m/s
Speed Kilometre per Hour km/h
Speed Knot kn
Temperature Kelvin K
Temperature Celsius °C
Time Second s
Time Minute min
Time Hour h
Time Day d
Time Week week
Time Year y
Volume Cubic Metre

Prefixes:

Name Symbol Value
Yotta Y 10²⁴
Zetta Z 10²¹
Exa E 10¹⁸
Peta P 10¹⁵
Tera T 10¹²
Giga G 10⁹
Mega M 10⁶
Kilo k 10³
Hecto h 10²
Deca da 10
Deci d 10⁻¹
Centi c 10⁻²
Milli m 10⁻³
Micro µ 10⁻⁶
Nano n 10⁻⁹
Pico p 10⁻¹²
Femto f 10⁻¹⁵
Atto a 10⁻¹⁸
Zepto z 10⁻²¹
Yocto y 10⁻²⁴

From the Doc’s at units-of-measurement I find that Intensity has W/m². Maybe the Source of that Value has a problem or an other Unit. The result may confusing the UnitParser.

I haven’t defined that unit anywhere.
I only have the following units, which should all exist. At least they existed in OH 2.4 :wink:

Number:Temperature      Temperatur		"Temperatur [%.1f °C]"
Number:Dimensionless    Luftfeuchte		"Luftfeuchte [%d %%]"
Number:Pressure	        Luftdruck		"Luftdruck [%.1f hPa]"
Number:Speed	        Regenrate		"Regenrate [%.1f mm/h]"
Number:Speed	        Wind			"Wind [%.1f km/h]"
Number:Intensity	    Solarstrahlung	"Solarstrahlung [%d W/m²]"

That one is not in the list for 2.4 or 2.5.

image

It is telling you that your Item regenerate is at the heart of this.

You seem to have specified units for that of mm/h I don’t think Number:Speed supports those units, so you end up with some kind of mashed up guess.

Doesn’t that work with the prefixes? Instead of kilo, milli is used for the speed specification?

km/h exists, but instead of the prefix ‘k’ the prefix ‘m’ is used --> mm/h

In OH 2.4 it worked perfectly with the specification mm/h.

Likely, but m/h does not exist. You removed part of a supported unit instead of just appending a prefix.
You may be able to use mm/s and divide the result. That should be more accurate than using km/h and multiplying the result.

“Used to work” might mean the validation has been tightened up.

I’m still of the opinion that the parent group need not be poking at this - but if it didn’t, something else likely would in display or something like.

1 Like

Since the unit mm/s seems to be really not supported. I have removed it:

Number:Temperature      Temperatur		"Temperatur [%.1f °C]"
Number:Dimensionless    Luftfeuchte		"Luftfeuchte [%d %%]"
Number:Pressure	        Luftdruck		"Luftdruck [%.1f hPa]"
Number Regenrate		"Regenrate [%.1f]"
Number:Speed	        Wind			"Wind [%.1f km/h]"
Number:Intensity	    Solarstrahlung	"Solarstrahlung [%d W/m²]"

But now I still get the following error message:

2019-12-24 18:16:24.948 [vent.ItemStateChangedEvent] - Wind changed from 17.7 km/h to 27.4 km/h
2019-12-24 18:16:25.005 [vent.ItemStateChangedEvent] - Solarstrahlung changed from 0.0 W/m² to 0.0 W/m²
2019-12-24 18:16:55.629 [WARN ] [pse.smarthome.core.items.GenericItem] - failed notifying listener 'org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleEngineImpl@10be966' about state update of item Wind: Can not compare incompatible units.
java.lang.IllegalArgumentException: Can not compare incompatible units.
	at org.eclipse.smarthome.core.library.types.QuantityType.compareTo(QuantityType.java:174) ~[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]
2019-12-24 18:16:55.629 [ERROR] [me.core.internal.events.EventHandler] - Dispatching/filtering event for subscriber 'org.eclipse.smarthome.core.events.EventSubscriber' failed: Can not compare incompatible units.
java.lang.IllegalArgumentException: Can not compare incompatible units.
	at org.eclipse.smarthome.core.library.types.QuantityType.compareTo(QuantityType.java:174) ~[?:?]
	at org.eclipse.smarthome.core.library.types.QuantityType.equals(QuantityType.java:156) ~[?:?]
	at org.eclipse.smarthome.core.items.GenericItem.applyState(GenericItem.java:234) ~[?:?]
	at org.eclipse.smarthome.core.items.GenericItem.setState(GenericItem.java:219) ~[?:?]
	at org.eclipse.smarthome.core.library.items.NumberItem.setState(NumberItem.java:121) ~[?:?]
	at org.eclipse.smarthome.core.internal.items.ItemUpdater.receiveUpdate(ItemUpdater.java:75) ~[?:?]
	at org.eclipse.smarthome.core.items.events.AbstractItemEventSubscriber.receive(AbstractItemEventSubscriber.java:52) ~[?:?]
	at org.eclipse.smarthome.core.internal.events.EventHandler.lambda$0(EventHandler.java:155) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_222]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_222]
	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]
2019-12-24 18:16:55.629 [WARN ] [pse.smarthome.core.items.GenericItem] - failed notifying listener 'org.eclipse.smarthome.core.persistence.internal.PersistenceManagerImpl@109cb09' about state update of item Wind: Can not compare incompatible units.
java.lang.IllegalArgumentException: Can not compare incompatible units.
	at org.eclipse.smarthome.core.library.types.QuantityType.compareTo(QuantityType.java:174) ~[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]
2019-12-24 18:17:26.370 [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 '27.4 1/(h·h)'.
java.lang.IllegalStateException: Error invoking #valueOf(String) on class 'org.eclipse.smarthome.core.library.types.QuantityType' with value '27.4 1/(h·h)'.
	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.GeneratedMethodAccessor80.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.GeneratedMethodAccessor80.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

I cross-checked the units against the list. I only use units that are also on the list. But it does not work anymore.

RuleEngineImpl

The error is caused by a Rule.

And the error is clear:

item Wind: Can not compare incompatible units.
java.lang.IllegalArgumentException: Can not compare incompatible units.

You updated your Items but did you update your Rules?

with value ‘27.4 1/(h·h)’

Assuming this is the value in your Rule it really makes no sense at all. What’s 1/(h-h) supposed to be?

Again, like rossko57 said, doesn’t work anymore can mean “it’s always been broken, the error checking is only now firmed up to where OH tells you about it.”

1 Like

Out of curiosity, I tried -
items

Group gBananas "aggregation"
Number:Speed testSpeed "test speed" (gBananas)
Number testnoSpeed "test plain" (gBananas)

and rule fragment, close as I could approximate to what your channels do

postUpdate(testSpeed.name , "11")
postUpdate(testnoSpeed.name , "111")
Thread::sleep(1000)
logInfo("test","with " + testSpeed.state.toString)
logInfo("test","without " + testnoSpeed.state.toString)

postUpdate(testSpeed.name , "22 leagues")
postUpdate(testnoSpeed.name , "222 leagues")
Thread::sleep(1000)
logInfo("test","with " + testSpeed.state.toString)
logInfo("test","without " + testnoSpeed.state.toString)

postUpdate(testSpeed.name , "33 km/h")
postUpdate(testnoSpeed.name , "33 km/h")
Thread::sleep(1000)
logInfo("test","with " + testSpeed.state.toString)
logInfo("test","without " + testnoSpeed.state.toString)

postUpdate(testSpeed.name , "44 mm/h")
postUpdate(testnoSpeed.name , "44 mm/h")
Thread::sleep(1000)
logInfo("test","with " + testSpeed.state.toString)
logInfo("test","without " + testnoSpeed.state.toString)

results

2019-12-24 20:26:46.820 [INFO ] [.eclipse.smarthome.model.script.test] - with 11.0 km/h
2019-12-24 20:26:46.821 [INFO ] [.eclipse.smarthome.model.script.test] - without 111

2019-12-24 20:26:46.823 [WARN ] [rthome.model.script.actions.BusEvent] - Cannot convert '22 leagues' to a state type which item 'testSpeed' accepts: [DecimalType, QuantityType, UnDefType].
2019-12-24 20:26:46.825 [WARN ] [rthome.model.script.actions.BusEvent] - Cannot convert '222 leagues' to a state type which item 'testnoSpeed' accepts: [DecimalType, QuantityType, UnDefType].
2019-12-24 20:26:47.827 [INFO ] [.eclipse.smarthome.model.script.test] - with 11.0 km/h
2019-12-24 20:26:47.828 [INFO ] [.eclipse.smarthome.model.script.test] - without 111

2019-12-24 20:26:48.833 [INFO ] [.eclipse.smarthome.model.script.test] - with 32.99997360002111816666666666666667 km/h
2019-12-24 20:26:48.836 [INFO ] [.eclipse.smarthome.model.script.test] - without 33 km/h

2019-12-24 20:26:49.840 [INFO ] [.eclipse.smarthome.model.script.test] - with 0.00004399996480002815755555555555555555 km/h
2019-12-24 20:26:49.841 [INFO ] [.eclipse.smarthome.model.script.test] - without 44 mm/h

Conclusions;
test 1 - you can update a QuantityType Item with a plain number - the state will just assume the system default units i.e. km/h for Speed

test 2 - you can update a “plain” Number with a valid QuantityType, and it will acquire the units you gave. Noted that surprise before. Suspect this will not have the full properties of a defined QT e.g. conversions.

test 3 -neither Number nor QT Item will accept some numeric with made-up units. Attempt ignored.

test 4 - mm/h is accepted as a valid QT, updates QT Item with conversion to its current units (km/h) , and updates plain Number as given.

Note that in no cases could I set an invalid Item state, so in turn I could not provoke a Group based error.

Where does that leave you?
My postUpdate(string,string) is only an approximation of what a binding does.
Note in particular that you are using a version 1.x binding for your Items, not channels. v1.x bindings have no idea about units and Quantity Types, were not invented in OH1.
Trying to get around this by building a string "numeric units" is I think doomed to failure. I’ve not seen any documentation that suggests this could work.

As you can see here, there is the unit. It is only not yet listed in the documentation.

@rossko57 the results of test 1 makes me curious because I experienced a different result in Units Of Measurement (Illuminance) format error · Issue #986 · openhab/openhab-core · GitHub.

There is a pending PR to update the documentation with all available units in OH 2.5:

What’s subtly different about my little test (writing plain Number to Quantity Item) is that there is no units “hint” in Item label [format]. So in case its something to do with use of [%unit%] in label, I edited my test Item - still fine, post a plain number to Quantity type and Item assumes new value with km/h.
Perhaps Java version matters - I have Oracle 1.8

Looking again at my results, there is the odd case of posting 44 mm/h and it getting stored as 0.000044 km/h. I thought it would store in given units, never work this stuff out :crazy_face: