UoM Errors in Groups since OH 2.5

I was assuming the documentation was complete.

I’m afraid you’re right. I also ran several more tests. I couldn’t find anything wrong. But once I link the http binding, the problems show up.

This can either be due to the 1.x binding or to the more frequent changes that are possible with the HTTP binding than in my manual test.

Here’s a code snippet that you can take over and run directly. You only need the HTTP binding and the REGEX transformation.

Group					Test_Weather		"Weather Data"				<sun_clouds>					
Number:Temperature		Test_Temperature	"Temperatur [%.1f °C]"		<temperature>	(Test_Weather)	{ http="<[https://www.random.org/decimal-fractions/?num=1&dec=1&col=1&format=html&rnd=new:3000:REGEX(.*numbers:.*?\\s*(\\d+.\\d+)\\s*.*)]" }
Number:Dimensionless	Test_Humidity		"Humidity [%d %%]"			<humidity>		(Test_Weather)	{ http="<[https://www.random.org/decimal-fractions/?num=1&dec=1&col=1&format=html&rnd=new:3000:REGEX(.*numbers:.*?\\s*(\\d+.\\d+)\\s*.*)]" }
Number:Pressure			Test_Airpressure	"Air Pressure [%.1f hPa]"	<pressure>		(Test_Weather)	{ http="<[https://www.random.org/decimal-fractions/?num=1&dec=1&col=1&format=html&rnd=new:3000:REGEX(.*numbers:.*?\\s*(\\d+.\\d+)\\s*.*)]" }
Number:Speed			Test_Rainrate		"Rain Rate [%.1f mm/h]"		<rain>			(Test_Weather)	{ http="<[https://www.random.org/decimal-fractions/?num=1&dec=1&col=1&format=html&rnd=new:3000:REGEX(.*numbers:.*?\\s*(\\d+.\\d+)\\s*.*)]" }
Number:Speed			Test_Wind			"Wind [%.1f km/h]"			<wind>			(Test_Weather)	{ http="<[https://www.random.org/decimal-fractions/?num=1&dec=1&col=1&format=html&rnd=new:3000:REGEX(.*numbers:.*?\\s*(\\d+.\\d+)\\s*.*)]" }
Number:Intensity		Test_Solarradiation	"Solar Radiation [%d W/m²]"	<solarplant>	(Test_Weather)	{ http="<[https://www.random.org/decimal-fractions/?num=1&dec=1&col=1&format=html&rnd=new:3000:REGEX(.*numbers:.*?\\s*(\\d+.\\d+)\\s*.*)]" }

You have to run it longer. It works very well for a while and in between the errors suddenly appear:

2019-12-25 00:05:46.588 [WARN ] [pse.smarthome.core.items.GenericItem] - failed notifying listener 'org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleEngineImpl@10be966' about state update of item Test_Rainrate: 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-25 00:05:46.588 [WARN ] [pse.smarthome.core.items.GenericItem] - failed notifying listener 'Test_Weather (Type=GroupItem, Members=6, State=NULL, Label=Weather Data, Category=sun_clouds)' about state update of item Test_Rainrate: 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-25 00:05:46.588 [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]

Although here the message “RuleEngineImpl” appears again. These items are certainly not involved in any rule.

I don’t know what else to say. I am not surprised that QuantityType Items do not work very well with 1.x bindings that were never written for usewith QuantityTypes.

1 Like

But there is no alternative to HTTP binding? Or is there a way to use quantity types with an HTTP binding?

No and no, I don’t think so.